From bc7433efba87f3394144cfb6b25132bc990b8472 Mon Sep 17 00:00:00 2001 From: pox7nspca <3344802307@qq.com> Date: Wed, 12 Nov 2025 22:55:05 +0800 Subject: [PATCH 1/3] Update DeptController.java --- .../com/qiujie/controller/DeptController.java | 94 +++++++++++++++---- 1 file changed, 74 insertions(+), 20 deletions(-) diff --git a/hrm/src/main/java/com/qiujie/controller/DeptController.java b/hrm/src/main/java/com/qiujie/controller/DeptController.java index 03d28aa..11ae1a7 100644 --- a/hrm/src/main/java/com/qiujie/controller/DeptController.java +++ b/hrm/src/main/java/com/qiujie/controller/DeptController.java @@ -2,7 +2,7 @@ package com.qiujie.controller; import com.qiujie.entity.Dept; import com.qiujie.dto.ResponseDTO; -import com.qiujie.service.DeptService; +import com.qiujie.service.DeptService; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; @@ -24,68 +24,122 @@ import java.util.List; * @since 2022-03-07 */ @RestController +// 标识当前类为REST风格控制器,返回数据为JSON格式 @RequestMapping("/dept") +// 定义基础请求路径,所有接口路径前缀为/dept public class DeptController { + // 定义基础请求路径,所有接口路径前缀为/dept @Autowired private DeptService deptService; + /** + * 新增部门接口 + * @param dept 部门实体对象(通过请求体传递) + * @return 统一响应结果(包含操作状态、数据或错误信息) + */ + + @ApiOperation("新增")// Swagger文档注解,说明接口功能 + @PostMapping// 接收POST请求,完整路径为/dept - @ApiOperation("新增") - @PostMapping @PreAuthorize("hasAnyAuthority('system:department:add')") public ResponseDTO add(@RequestBody Dept dept) { return this.deptService.add(dept); } + /** + * 逻辑删除部门接口(非物理删除,仅标记删除状态) + * @param id 部门ID(通过URL路径传递) + * @return 统一响应结果 + */ @ApiOperation("逻辑删除") - @DeleteMapping("/{id}") - @PreAuthorize("hasAnyAuthority('system:department:delete')") + @DeleteMapping("/{id}")// 接收DELETE请求,完整路径为/dept/{id} + @PreAuthorize("hasAnyAuthority('system:department:delete')")// 权限控制 public ResponseDTO delete(@PathVariable Integer id) { return this.deptService.delete(id); } + /** + * 批量逻辑删除部门接口 + * @param ids 部门ID列表(通过URL路径传递,多个ID用逗号分隔) + * @return 统一响应结果 + */ @ApiOperation("批量逻辑删除") - @DeleteMapping("/batch/{ids}") - @PreAuthorize("hasAnyAuthority('system:department:delete')") + @DeleteMapping("/batch/{ids}")// 接收DELETE请求,完整路径为/dept/batch/{ids} + @PreAuthorize("hasAnyAuthority('system:department:delete')")// 权限控制 public ResponseDTO deleteBatch(@PathVariable List ids) { return this.deptService.deleteBatch(ids); } + /** + * 编辑更新部门信息接口 + * @param dept 包含更新信息的部门实体对象(通过请求体传递) + * @return 统一响应结果 + */ @ApiOperation("编辑更新") - @PutMapping - @PreAuthorize("hasAnyAuthority('system:department:edit')") + @PutMapping// 接收PUT请求,完整路径为/dept + @PreAuthorize("hasAnyAuthority('system:department:edit')")// 权限控制 public ResponseDTO edit(@RequestBody Dept dept) { return this.deptService.edit(dept); } + /** + * 根据ID查询部门详情接口 + * @param id 部门ID(通过URL路径传递) + * @return 统一响应结果(包含查询到的部门信息) + */ + + @ApiOperation("查询")//根据ID查询部门 + @GetMapping("/{id}")// 接收GET请求,完整路径为/dept/{id} - @ApiOperation("查询") - @GetMapping("/{id}") public ResponseDTO query(@PathVariable Integer id) { return this.deptService.query(id); } + /** + * 查询所有部门接口 + * @return 统一响应结果(包含所有部门的列表数据) + */ - @ApiOperation("查询所有") - @GetMapping("/all") + @ApiOperation("查询所有")//查询所有部门 + @GetMapping("/all")// 接收GET请求,完整路径为/dept/all public ResponseDTO queryAll(){ return this.deptService.queryAll(); } + /** + * 条件分页查询部门接口 + * @param current 当前页码(默认第1页) + * @param size 每页条数(默认10条) + * @param name 部门名称(查询条件,可选) + * @return 统一响应结果(包含分页查询结果) + */ - @ApiOperation("条件查询") - @GetMapping + @ApiOperation("条件查询")//条件分页查询部门 + @GetMapping// 接收GET请求,完整路径为/dept @PreAuthorize("hasAnyAuthority('system:department:list','system:department:search')") + // 权限控制:拥有两个权限中的任意一个即可访问 public ResponseDTO list(@RequestParam(defaultValue = "1") Integer current, @RequestParam(defaultValue = "10") Integer size, String name) { return this.deptService.list(current, size, name); } +/** + * 部门数据导出接口(导出为文件) + * @param response HTTP响应对象,用于输出文件流 + * @param filename 导出的文件名 + * @throws Exception 可能抛出IO异常或其他处理异常 + */ - @ApiOperation("数据导出接口") - @GetMapping("/export/{filename}") - @PreAuthorize("hasAnyAuthority('system:department:export')") + @ApiOperation("数据导出接口")//部门数据导出接口 + @GetMapping("/export/{filename}")// 接收GET请求,完整路径为/dept/export/{filename} + @PreAuthorize("hasAnyAuthority('system:department:export')")// 权限控制 public void export(HttpServletResponse response,@PathVariable String filename) throws Exception { this.deptService.export(response,filename); } +/** + * 部门数据导入接口(从文件导入数据) + * @param file 上传的文件(包含部门数据) + * @return 统一响应结果(包含导入成功/失败信息) + * @throws IOException 可能抛出文件读取异常 + */ @ApiOperation("数据导入接口") - @PostMapping("/import") - @PreAuthorize("hasAnyAuthority('system:department:import')") + @PostMapping("/import")// 接收POST请求,完整路径为/dept/import + @PreAuthorize("hasAnyAuthority('system:department:import')")// 权限控制 public ResponseDTO imp(MultipartFile file) throws IOException { return this.deptService.imp(file); } -- 2.34.1 From 45c52de7ccc355d914681acfcb62d5273c07d21b Mon Sep 17 00:00:00 2001 From: pox7nspca <3344802307@qq.com> Date: Wed, 12 Nov 2025 23:04:21 +0800 Subject: [PATCH 2/3] Update DocsController.java --- .../com/qiujie/controller/DocsController.java | 143 +++++++++++++----- 1 file changed, 106 insertions(+), 37 deletions(-) diff --git a/hrm/src/main/java/com/qiujie/controller/DocsController.java b/hrm/src/main/java/com/qiujie/controller/DocsController.java index 3f53d0a..d7f52c5 100644 --- a/hrm/src/main/java/com/qiujie/controller/DocsController.java +++ b/hrm/src/main/java/com/qiujie/controller/DocsController.java @@ -16,92 +16,161 @@ import java.io.IOException; import java.util.List; /** - * 文件上传接口 + * 文件文档管理相关接口控制器 + * 负责处理文件的增删改查、上传、下载、导入导出等请求 * * @Author qiujie * @Date 2022/2/24 * @Version 1.0 */ -@RestController -@RequestMapping("/docs") +@RestController // 标识为REST风格控制器,返回JSON格式响应 +@RequestMapping("/docs") // 基础请求路径,所有接口路径前缀为/docs public class DocsController { + // 自动注入文件文档服务层对象,用于调用业务逻辑 @Autowired private DocsService docsService; - @ApiOperation("新增") - @PostMapping + /** + * 新增文件文档记录 + * @param docs 文件文档实体对象(包含文件相关信息,通过请求体传递) + * @return 统一响应结果(操作状态、数据或错误信息) + */ + @ApiOperation("新增文件文档记录") // Swagger注解,描述接口功能 + @PostMapping // 接收POST请求,完整路径为/docs public ResponseDTO add(@RequestBody Docs docs) { return this.docsService.add(docs); } - @ApiOperation("逻辑删除") - @DeleteMapping("/{id}") - @PreAuthorize("hasAnyAuthority('system:docs:delete')") + /** + * 逻辑删除文件文档记录(仅标记删除状态,不物理删除) + * @param id 要删除的文件文档ID(通过URL路径传递) + * @return 统一响应结果 + */ + @ApiOperation("逻辑删除文件文档记录") + @DeleteMapping("/{id}") // 接收DELETE请求,完整路径为/docs/{id} + @PreAuthorize("hasAnyAuthority('system:docs:delete')") // 权限控制:仅拥有该权限的用户可访问 public ResponseDTO delete(@PathVariable Integer id) { return this.docsService.delete(id); } - @ApiOperation("批量逻辑删除") - @DeleteMapping("/batch/{ids}") - @PreAuthorize("hasAnyAuthority('system:docs:delete')") + /** + * 批量逻辑删除文件文档记录 + * @param ids 要删除的文件文档ID列表(通过URL路径传递,多个ID用逗号分隔) + * @return 统一响应结果 + */ + @ApiOperation("批量逻辑删除文件文档记录") + @DeleteMapping("/batch/{ids}") // 接收DELETE请求,完整路径为/docs/batch/{ids} + @PreAuthorize("hasAnyAuthority('system:docs:delete')") // 权限控制 public ResponseDTO deleteBatch(@PathVariable List ids) { return this.docsService.deleteBatch(ids); } - @ApiOperation("编辑更新") - @PutMapping - @PreAuthorize("hasAnyAuthority('system:docs:edit')") + /** + * 编辑更新文件文档记录信息 + * @param docs 包含更新信息的文件文档实体(通过请求体传递) + * @return 统一响应结果 + */ + @ApiOperation("编辑更新文件文档记录") + @PutMapping // 接收PUT请求,完整路径为/docs + @PreAuthorize("hasAnyAuthority('system:docs:edit')") // 权限控制 public ResponseDTO edit(@RequestBody Docs docs) { return this.docsService.edit(docs); } - @ApiOperation("查询") - @GetMapping("/{id}") + /** + * 根据ID查询文件文档详情 + * @param id 文件文档ID(通过URL路径传递) + * @return 统一响应结果(包含查询到的文件文档信息) + */ + @ApiOperation("根据ID查询文件文档详情") + @GetMapping("/{id}") // 接收GET请求,完整路径为/docs/{id} public ResponseDTO query(@PathVariable Integer id) { return this.docsService.query(id); } - @ApiOperation("分页条件查询") - @GetMapping - @PreAuthorize("hasAnyAuthority('system:docs:list','system:docs:search')") - public ResponseDTO list(@RequestParam(defaultValue = "1") Integer current, @RequestParam(defaultValue = "10") Integer size, String oldName, String staffName) { + /** + * 分页条件查询文件文档列表 + * @param current 当前页码(默认第1页) + * @param size 每页条数(默认10条) + * @param oldName 文件名(查询条件,可选) + * @param staffName 操作人姓名(查询条件,可选) + * @return 统一响应结果(包含分页查询结果) + */ + @ApiOperation("分页条件查询文件文档列表") + @GetMapping // 接收GET请求,完整路径为/docs + @PreAuthorize("hasAnyAuthority('system:docs:list','system:docs:search')") // 权限控制:拥有两个权限中的任意一个即可访问 + public ResponseDTO list(@RequestParam(defaultValue = "1") Integer current, + @RequestParam(defaultValue = "10") Integer size, + String oldName, + String staffName) { return this.docsService.list(current, size, oldName, staffName); } - @ApiOperation("数据导出接口") - @GetMapping("/export/{filename}") - @PreAuthorize("hasAnyAuthority('system:docs:export')") - public void export(HttpServletResponse response,@PathVariable String filename) throws IOException { - this.docsService.export(response,filename); + /** + * 文件文档数据导出接口(将数据导出为文件) + * @param response HTTP响应对象,用于输出文件流 + * @param filename 导出的文件名 + * @throws IOException 可能抛出文件IO异常 + */ + @ApiOperation("文件文档数据导出接口") + @GetMapping("/export/{filename}") // 接收GET请求,完整路径为/docs/export/{filename} + @PreAuthorize("hasAnyAuthority('system:docs:export')") // 权限控制 + public void export(HttpServletResponse response, @PathVariable String filename) throws IOException { + this.docsService.export(response, filename); } - @ApiOperation("数据导入接口") - @PostMapping("/import") - @PreAuthorize("hasAnyAuthority('system:docs:import')") + /** + * 文件文档数据导入接口(从上传的文件导入数据) + * @param file 包含数据的上传文件 + * @return 统一响应结果(包含导入结果信息) + * @throws IOException 可能抛出文件读取异常 + */ + @ApiOperation("文件文档数据导入接口") + @PostMapping("/import") // 接收POST请求,完整路径为/docs/import + @PreAuthorize("hasAnyAuthority('system:docs:import')") // 权限控制 public ResponseDTO imp(MultipartFile file) throws IOException { return this.docsService.imp(file); } - - @ApiOperation("文件上传") - @PostMapping("/upload/{id}") - @PreAuthorize("hasAnyAuthority('system:docs:upload')") + /** + * 文件上传接口(将文件内容上传并关联到指定文档记录) + * @param file 要上传的文件 + * @param id 关联的文档记录ID(通过URL路径传递) + * @return 统一响应结果(包含上传结果信息) + * @throws IOException 可能抛出文件上传IO异常 + */ + @ApiOperation("文件上传接口") + @PostMapping("/upload/{id}") // 接收POST请求,完整路径为/docs/upload/{id} + @PreAuthorize("hasAnyAuthority('system:docs:upload')") // 权限控制 public ResponseDTO upload(MultipartFile file, @PathVariable Integer id) throws IOException { return this.docsService.upload(file, id); } - @ApiOperation("文件下载") - @GetMapping("/download/{filename}") - @PreAuthorize("hasAnyAuthority('system:docs:download')") + /** + * 文件下载接口(根据文件名下载文件) + * @param filename 要下载的文件名(通过URL路径传递) + * @param response HTTP响应对象,用于输出文件流 + * @throws IOException 可能抛出文件读取或输出异常 + */ + @ApiOperation("文件下载接口") + @GetMapping("/download/{filename}") // 接收GET请求,完整路径为/docs/download/{filename} + @PreAuthorize("hasAnyAuthority('system:docs:download')") // 权限控制 public void download(@PathVariable String filename, HttpServletResponse response) throws IOException { this.docsService.download(filename, response); } - @ApiOperation("文件下载") + /** + * 头像文件下载接口(本质是复用文件下载逻辑,用于获取头像文件) + * @param filename 头像文件名(通过URL路径传递) + * @param response HTTP响应对象,用于输出文件流 + * @throws IOException 可能抛出文件读取或输出异常 + */ + @ApiOperation("头像文件下载接口") @GetMapping("/avatar/{filename}") + // 接收GET请求,完整路径为/docs/avatar/{filename} public void getAvatar(@PathVariable String filename, HttpServletResponse response) throws IOException { this.docsService.download(filename, response); } -} +} \ No newline at end of file -- 2.34.1 From 65ad6b1987c4d9712aa3158403b0544e13252908 Mon Sep 17 00:00:00 2001 From: pox7nspca <3344802307@qq.com> Date: Wed, 12 Nov 2025 23:07:05 +0800 Subject: [PATCH 3/3] Update StaffController.java --- .../qiujie/controller/StaffController.java | 161 +++++++++++++----- 1 file changed, 120 insertions(+), 41 deletions(-) diff --git a/hrm/src/main/java/com/qiujie/controller/StaffController.java b/hrm/src/main/java/com/qiujie/controller/StaffController.java index f1a3799..a50d15c 100644 --- a/hrm/src/main/java/com/qiujie/controller/StaffController.java +++ b/hrm/src/main/java/com/qiujie/controller/StaffController.java @@ -1,6 +1,5 @@ package com.qiujie.controller; - import com.qiujie.dto.ResponseDTO; import com.qiujie.entity.Staff; import com.qiujie.service.StaffRoleService; @@ -17,107 +16,187 @@ import java.util.List; /** *

- * 前端控制器 + * 员工管理模块前端控制器 + * 负责处理员工的增删改查、角色分配、密码验证与重置、数据导入导出等请求 *

* * @author qiujie * @since 2022-01-27 */ -@RestController -@RequestMapping("/staff") +@RestController // 标识为REST风格控制器,返回JSON格式响应 +@RequestMapping("/staff") // 基础请求路径,所有接口路径前缀为/staff public class StaffController { + // 自动注入员工服务层对象,处理员工核心业务逻辑 @Autowired private StaffService staffService; + // 自动注入员工-角色关联服务层对象,处理员工角色分配相关业务 @Autowired private StaffRoleService staffRoleService; - @ApiOperation("新增") - @PostMapping - @PreAuthorize("hasAnyAuthority('system:staff:add')") + /** + * 新增员工 + * @param staff 员工实体对象(包含员工基本信息,通过请求体传递) + * @return 统一响应结果(操作状态、数据或错误信息) + */ + @ApiOperation("新增员工") // Swagger注解,描述接口功能 + @PostMapping // 接收POST请求,完整路径为/staff + @PreAuthorize("hasAnyAuthority('system:staff:add')") // 权限控制:仅拥有该权限的用户可访问 public ResponseDTO add(@RequestBody Staff staff) { return this.staffService.add(staff); } - @ApiOperation("逻辑删除") - @DeleteMapping("/{id}") - @PreAuthorize("hasAnyAuthority('system:staff:delete')") + /** + * 逻辑删除员工(仅标记删除状态,不物理删除数据) + * @param id 要删除的员工ID(通过URL路径传递) + * @return 统一响应结果 + */ + @ApiOperation("逻辑删除员工") + @DeleteMapping("/{id}") // 接收DELETE请求,完整路径为/staff/{id} + @PreAuthorize("hasAnyAuthority('system:staff:delete')") // 权限控制 public ResponseDTO delete(@PathVariable Integer id) { return this.staffService.delete(id); } - @ApiOperation("批量逻辑删除") - @DeleteMapping("/batch/{ids}") - @PreAuthorize("hasAnyAuthority('system:staff:delete')") + /** + * 批量逻辑删除员工 + * @param ids 要删除的员工ID列表(通过URL路径传递,多个ID用逗号分隔) + * @return 统一响应结果 + */ + @ApiOperation("批量逻辑删除员工") + @DeleteMapping("/batch/{ids}") // 接收DELETE请求,完整路径为/staff/batch/{ids} + @PreAuthorize("hasAnyAuthority('system:staff:delete')") // 权限控制 public ResponseDTO deleteBatch(@PathVariable List ids) { return this.staffService.deleteBatch(ids); } - @ApiOperation("编辑更新") - @PutMapping - @PreAuthorize("hasAnyAuthority('system:staff:edit','system:staff:enable')") + /** + * 编辑更新员工信息(含员工状态启用/禁用) + * @param staff 包含更新信息的员工实体(通过请求体传递) + * @return 统一响应结果 + */ + @ApiOperation("编辑更新员工信息") + @PutMapping // 接收PUT请求,完整路径为/staff + @PreAuthorize("hasAnyAuthority('system:staff:edit','system:staff:enable')") // 权限控制:拥有两个权限中的任意一个即可访问 public ResponseDTO edit(@RequestBody Staff staff) { return this.staffService.edit(staff); } - @ApiOperation("查询") - @GetMapping("/{id}") + /** + * 根据ID查询员工基础信息 + * @param id 员工ID(通过URL路径传递) + * @return 统一响应结果(包含查询到的员工基础信息) + */ + @ApiOperation("根据ID查询员工基础信息") + @GetMapping("/{id}") // 接收GET请求,完整路径为/staff/{id} public ResponseDTO query(@PathVariable Integer id) { return this.staffService.query(id); } - @ApiOperation("查询员工信息") - @GetMapping("/info/{id}") + /** + * 根据ID查询员工详细信息(可能包含关联的部门、角色等扩展信息) + * @param id 员工ID(通过URL路径传递) + * @return 统一响应结果(包含员工详细信息) + */ + @ApiOperation("根据ID查询员工详细信息") + @GetMapping("/info/{id}") // 接收GET请求,完整路径为/staff/info/{id} public ResponseDTO queryInfo(@PathVariable Integer id) { return this.staffService.queryInfo(id); } - @ApiOperation("多条件分页查询") - @GetMapping - @PreAuthorize("hasAnyAuthority('system:staff:list','system:staff:search')") - public ResponseDTO list(@RequestParam(defaultValue = "1") Integer current, @RequestParam(defaultValue = "10") Integer size, String name, String birthday, Integer deptId, Integer status) { + /** + * 多条件分页查询员工列表 + * @param current 当前页码(默认第1页) + * @param size 每页条数(默认10条) + * @param name 员工姓名(查询条件,可选) + * @param birthday 员工生日(查询条件,可选) + * @param deptId 所属部门ID(查询条件,可选) + * @param status 员工状态(查询条件,可选,如启用/禁用) + * @return 统一响应结果(包含分页查询结果) + */ + @ApiOperation("多条件分页查询员工列表") + @GetMapping // 接收GET请求,完整路径为/staff + @PreAuthorize("hasAnyAuthority('system:staff:list','system:staff:search')") // 权限控制 + public ResponseDTO list(@RequestParam(defaultValue = "1") Integer current, + @RequestParam(defaultValue = "10") Integer size, + String name, + String birthday, + Integer deptId, + Integer status) { return this.staffService.list(current, size, name, birthday, deptId, status); } - @ApiOperation("数据导出接口") - @GetMapping("/export/{filename}") - @PreAuthorize("hasAnyAuthority('system:staff:export')") + /** + * 员工数据导出接口(将员工数据导出为文件) + * @param response HTTP响应对象,用于输出文件流 + * @param filename 导出的文件名(通过URL路径传递) + * @throws IOException 可能抛出文件IO异常 + */ + @ApiOperation("员工数据导出接口") + @GetMapping("/export/{filename}") // 接收GET请求,完整路径为/staff/export/{filename} + @PreAuthorize("hasAnyAuthority('system:staff:export')") // 权限控制 public void export(HttpServletResponse response, @PathVariable String filename) throws IOException { this.staffService.export(response, filename); } - @ApiOperation("数据导入接口") - @PostMapping("/import") - @PreAuthorize("hasAnyAuthority('system:staff:import')") + /** + * 员工数据导入接口(从上传的文件导入员工数据) + * @param file 包含员工数据的上传文件 + * @return 统一响应结果(包含导入结果信息) + * @throws IOException 可能抛出文件读取异常 + */ + @ApiOperation("员工数据导入接口") + @PostMapping("/import") // 接收POST请求,完整路径为/staff/import + @PreAuthorize("hasAnyAuthority('system:staff:import')") // 权限控制 public ResponseDTO imp(MultipartFile file) throws IOException { return this.staffService.imp(file); } + /** + * 为员工分配角色 + * @param id 员工ID(通过URL路径传递) + * @param roleIds 角色ID列表(通过请求体传递,指定要分配的角色) + * @return 统一响应结果(包含角色分配结果) + */ @ApiOperation("为员工设置角色") - @PostMapping("/set/{id}") - @PreAuthorize("hasAnyAuthority('system:staff:set_role')") + @PostMapping("/set/{id}") // 接收POST请求,完整路径为/staff/set/{id} + @PreAuthorize("hasAnyAuthority('system:staff:set_role')") // 权限控制 public ResponseDTO setRole(@PathVariable Integer id, @RequestBody List roleIds) { return this.staffRoleService.setRole(id, roleIds); } - @ApiOperation("得到员工的角色") - @GetMapping("/staff/{id}") + /** + * 查询指定员工已分配的角色 + * @param id 员工ID(通过URL路径传递) + * @return 统一响应结果(包含员工的角色列表) + */ + @ApiOperation("查询员工已分配的角色") + @GetMapping("/staff/{id}") // 接收GET请求,完整路径为/staff/staff/{id} public ResponseDTO queryByStaffId(@PathVariable Integer id) { return this.staffRoleService.queryByStaffId(id); } - - @ApiOperation("检查员工的密码") - @GetMapping("/{pwd}/{id}") + /** + * 验证员工密码是否正确 + * @param pwd 待验证的密码(通过URL路径传递) + * @param id 员工ID(通过URL路径传递) + * @return 统一响应结果(包含密码验证结果) + */ + @ApiOperation("验证员工密码") + @GetMapping("/{pwd}/{id}") // 接收GET请求,完整路径为/staff/{pwd}/{id} public ResponseDTO validate(@PathVariable String pwd, @PathVariable Integer id) { return this.staffService.validate(pwd, id); } - @ApiOperation("更新密码") - @PutMapping("/reset") + /** + * 重置员工密码 + * @param staff 包含员工ID和新密码的实体对象(通过请求体传递) + * @return 统一响应结果(包含密码重置结果) + */ + @ApiOperation("重置员工密码") + @PutMapping("/reset") // 接收PUT请求,完整路径为/staff/reset public ResponseDTO reset(@RequestBody Staff staff) { return this.staffService.reset(staff); } -} - +} \ No newline at end of file -- 2.34.1