From be4d1027ec4cb97ae148ab02004fe33e20e55115 Mon Sep 17 00:00:00 2001 From: pq7sc2z5f <3289822358@qq.com> Date: Wed, 19 Nov 2025 10:11:01 +0800 Subject: [PATCH 01/17] Update DeptController.java --- .../com/qiujie/controller/DeptController.java | 107 +++++++++++++----- 1 file changed, 77 insertions(+), 30 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..1a5b77f 100644 --- a/hrm/src/main/java/com/qiujie/controller/DeptController.java +++ b/hrm/src/main/java/com/qiujie/controller/DeptController.java @@ -14,81 +14,128 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; - /** - *

- * 前端控制器 - *

- * + * 部门管理前端控制器 + * 处理部门相关的所有HTTP请求,包括增删改查、导入导出等操作 + * * @author qiujie * @since 2022-03-07 */ -@RestController -@RequestMapping("/dept") +@RestController // 标识为RESTful控制器,返回数据均为JSON格式 +@RequestMapping("/dept") // 定义基础请求路径为/dept public class DeptController { - @Autowired + + @Autowired // 自动注入部门服务类 private DeptService deptService; + /** + * 新增部门接口 + * @param dept 部门实体对象,通过请求体传入 + * @return 操作结果响应 + */ @ApiOperation("新增") - @PostMapping - @PreAuthorize("hasAnyAuthority('system:department:add')") + @PostMapping // 处理POST请求,路径为/dept + @PreAuthorize("hasAnyAuthority('system:department:add')") // 需要具备新增部门权限 public ResponseDTO add(@RequestBody Dept dept) { return this.deptService.add(dept); } + /** + * 逻辑删除部门接口 + * @param id 部门ID,通过路径参数传入 + * @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列表,通过路径参数传入 + * @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,通过路径参数传入 + * @return 部门信息响应 + */ @ApiOperation("查询") - @GetMapping("/{id}") + @GetMapping("/{id}") // 处理GET请求,路径为/dept/{id} public ResponseDTO query(@PathVariable Integer id) { return this.deptService.query(id); } + /** + * 查询所有部门信息接口 + * @return 所有部门列表响应 + */ @ApiOperation("查询所有") - @GetMapping("/all") + @GetMapping("/all") // 处理GET请求,路径为/dept/all public ResponseDTO queryAll(){ return this.deptService.queryAll(); } + /** + * 条件分页查询部门列表接口 + * @param current 当前页码,默认为1 + * @param size 每页大小,默认为10 + * @param name 部门名称(模糊查询条件) + * @return 分页部门列表响应 + */ @ApiOperation("条件查询") - @GetMapping - @PreAuthorize("hasAnyAuthority('system:department:list','system:department:search')") - public ResponseDTO list(@RequestParam(defaultValue = "1") Integer current, @RequestParam(defaultValue = "10") Integer size, String name) { + @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响应对象,用于输出Excel文件 + * @param filename 导出文件名,通过路径参数传入 + * @throws Exception 可能抛出IO异常等 + */ @ApiOperation("数据导出接口") - @GetMapping("/export/{filename}") - @PreAuthorize("hasAnyAuthority('system:department:export')") - public void export(HttpServletResponse response,@PathVariable String filename) throws Exception { - this.deptService.export(response,filename); + @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 Excel文件对象,包含部门数据 + * @return 导入结果响应 + * @throws IOException 可能抛出IO异常 + */ @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); } - -} - +} \ No newline at end of file -- 2.34.1 From d8fcd60dcf9a7845457f61ccf431a0b92d947178 Mon Sep 17 00:00:00 2001 From: pq7sc2z5f <3289822358@qq.com> Date: Wed, 19 Nov 2025 10:12:47 +0800 Subject: [PATCH 02/17] Update AttendanceController.java --- .../controller/AttendanceController.java | 124 +++++++++++++----- 1 file changed, 94 insertions(+), 30 deletions(-) diff --git a/hrm/src/main/java/com/qiujie/controller/AttendanceController.java b/hrm/src/main/java/com/qiujie/controller/AttendanceController.java index a7236cb..12f798b 100644 --- a/hrm/src/main/java/com/qiujie/controller/AttendanceController.java +++ b/hrm/src/main/java/com/qiujie/controller/AttendanceController.java @@ -2,7 +2,6 @@ package com.qiujie.controller; import com.qiujie.service.AttendanceService; import com.qiujie.entity.Attendance; - import com.qiujie.dto.ResponseDTO; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; @@ -15,91 +14,156 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; - /** - *

- * 前端控制器 - *

- * + * 考勤管理前端控制器 + * 处理考勤相关的所有HTTP请求,包括考勤记录的增删改查、导入导出等操作 + * * @author qiujie * @since 2022-03-29 */ -@RestController -@RequestMapping("/attendance") +@RestController // 标识为RESTful控制器,返回数据均为JSON格式 +@RequestMapping("/attendance") // 定义基础请求路径为/attendance public class AttendanceController { - @Autowired + @Autowired // 自动注入考勤服务类 private AttendanceService attendanceService; + /** + * 新增考勤记录接口 + * @param attendance 考勤实体对象,通过请求体传入 + * @return 操作结果响应 + */ @ApiOperation("新增") - @PostMapping + @PostMapping // 处理POST请求,路径为/attendance public ResponseDTO add(@RequestBody Attendance attendance) { return this.attendanceService.add(attendance); } + /** + * 逻辑删除考勤记录接口 + * @param id 考勤记录ID,通过路径参数传入 + * @return 操作结果响应 + */ @ApiOperation("逻辑删除") - @DeleteMapping("/{id}") + @DeleteMapping("/{id}") // 处理DELETE请求,路径为/attendance/{id} public ResponseDTO delete(@PathVariable Integer id) { return this.attendanceService.delete(id); } + /** + * 批量逻辑删除考勤记录接口 + * @param ids 考勤记录ID列表,通过路径参数传入 + * @return 操作结果响应 + */ @ApiOperation("批量逻辑删除") - @DeleteMapping("/batch/{ids}") + @DeleteMapping("/batch/{ids}") // 处理DELETE请求,路径为/attendance/batch/{ids} public ResponseDTO deleteBatch(@PathVariable List ids) { return this.attendanceService.deleteBatch(ids); } + /** + * 编辑更新考勤记录接口 + * @param attendance 考勤实体对象,通过请求体传入 + * @return 操作结果响应 + */ @ApiOperation("编辑更新") - @PutMapping + @PutMapping // 处理PUT请求,路径为/attendance public ResponseDTO edit(@RequestBody Attendance attendance) { return this.attendanceService.edit(attendance); } + /** + * 根据ID查询考勤记录详情接口 + * @param id 考勤记录ID,通过路径参数传入 + * @return 考勤记录信息响应 + */ @ApiOperation("查询") - @GetMapping("/{id}") + @GetMapping("/{id}") // 处理GET请求,路径为/attendance/{id} public ResponseDTO query(@PathVariable Integer id) { return this.attendanceService.query(id); } + /** + * 条件分页查询考勤记录列表接口 + * @param current 当前页码,默认为1 + * @param size 每页大小,默认为10 + * @param name 员工姓名(模糊查询条件) + * @param deptId 部门ID(筛选条件) + * @param month 月份(格式如:2024-01) + * @return 分页考勤记录列表响应 + */ @ApiOperation("条件查询") - @GetMapping - @PreAuthorize("hasAnyAuthority('performance:attendance:list','performance:attendance:search')") - public ResponseDTO list(@RequestParam(defaultValue = "1") Integer current, @RequestParam(defaultValue = "10") Integer size, String name, Integer deptId, String month) { + @GetMapping // 处理GET请求,路径为/attendance + @PreAuthorize("hasAnyAuthority('performance:attendance:list','performance:attendance:search')") // 需要具备考勤列表查看或搜索权限 + public ResponseDTO list(@RequestParam(defaultValue = "1") Integer current, + @RequestParam(defaultValue = "10") Integer size, + String name, + Integer deptId, + String month) { return this.attendanceService.list(current, size, name, deptId, month); } + /** + * 考勤数据导出接口 + * @param response HTTP响应对象,用于输出Excel文件 + * @param month 导出数据的月份,通过路径参数传入 + * @param filename 导出文件名,通过路径参数传入 + * @throws IOException 可能抛出IO异常 + */ @ApiOperation("数据导出接口") - @GetMapping("/export/{month}/{filename}") - @PreAuthorize("hasAnyAuthority('performance:attendance:export')") - public void export(HttpServletResponse response, @PathVariable String month,@PathVariable String filename) throws IOException { - this.attendanceService.export(response, month,filename); + @GetMapping("/export/{month}/{filename}") // 处理GET请求,路径为/attendance/export/{month}/{filename} + @PreAuthorize("hasAnyAuthority('performance:attendance:export')") // 需要具备考勤数据导出权限 + public void export(HttpServletResponse response, + @PathVariable String month, + @PathVariable String filename) throws IOException { + this.attendanceService.export(response, month, filename); } + /** + * 考勤数据导入接口 + * @param file Excel文件对象,包含考勤数据 + * @return 导入结果响应 + * @throws IOException 可能抛出IO异常 + */ @ApiOperation("数据导入接口") - @PostMapping("/import") - @PreAuthorize("hasAnyAuthority('performance:attendance:import')") + @PostMapping("/import") // 处理POST请求,路径为/attendance/import + @PreAuthorize("hasAnyAuthority('performance:attendance:import')") // 需要具备考勤数据导入权限 public ResponseDTO imp(MultipartFile file) throws IOException { return this.attendanceService.imp(file); } + /** + * 根据员工ID和日期查询考勤记录接口 + * @param id 员工ID,通过路径参数传入 + * @param date 日期字符串,格式如:2024-01-15 + * @return 考勤记录信息响应 + */ @ApiOperation("查询") - @GetMapping("/{id}/{date}") + @GetMapping("/{id}/{date}") // 处理GET请求,路径为/attendance/{id}/{date} public ResponseDTO queryByStaffIdAndDate(@PathVariable Integer id, @PathVariable String date) { return this.attendanceService.queryByStaffIdAndDate(id, date); } + /** + * 保存或更新考勤记录接口 + * 如果考勤记录存在则更新,不存在则新增 + * @param attendance 考勤实体对象,通过请求体传入 + * @return 操作结果响应 + */ @ApiOperation("保存或更新") - @PutMapping("/set") - @PreAuthorize("hasAnyAuthority('performance:attendance:set')") + @PutMapping("/set") // 处理PUT请求,路径为/attendance/set + @PreAuthorize("hasAnyAuthority('performance:attendance:set')") // 需要具备设置考勤权限 public ResponseDTO setAttendance(@RequestBody Attendance attendance) { return this.attendanceService.setAttendance(attendance); } + /** + * 查询所有考勤记录接口 + * @return 所有考勤记录列表响应 + */ @ApiOperation("获取所有") - @GetMapping("/all") + @GetMapping("/all") // 处理GET请求,路径为/attendance/all public ResponseDTO queryAll() { return this.attendanceService.queryAll(); } - -} - +} \ No newline at end of file -- 2.34.1 From fab07a697f9a790532fe1656eacbe59fbabff497 Mon Sep 17 00:00:00 2001 From: pq7sc2z5f <3289822358@qq.com> Date: Wed, 19 Nov 2025 10:14:38 +0800 Subject: [PATCH 03/17] Update CityController.java --- .../com/qiujie/controller/CityController.java | 106 +++++++++++++----- 1 file changed, 76 insertions(+), 30 deletions(-) diff --git a/hrm/src/main/java/com/qiujie/controller/CityController.java b/hrm/src/main/java/com/qiujie/controller/CityController.java index b811ec7..a9a4ca9 100644 --- a/hrm/src/main/java/com/qiujie/controller/CityController.java +++ b/hrm/src/main/java/com/qiujie/controller/CityController.java @@ -14,83 +14,129 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; - /** - *

- * 前端控制器 - *

- * + * 城市管理前端控制器 + * 处理城市相关的所有HTTP请求,包括城市信息的增删改查、导入导出等操作 + * 通常用于管理员工所在城市信息,可能与薪资计算、补贴等相关 + * * @author qiujie * @since 2022-03-23 */ -@RestController -@RequestMapping("/city") +@RestController // 标识为RESTful控制器,返回数据均为JSON格式 +@RequestMapping("/city") // 定义基础请求路径为/city public class CityController { - @Autowired + + @Autowired // 自动注入城市服务类 private CityService cityService; + /** + * 新增城市信息接口 + * @param city 城市实体对象,通过请求体传入 + * @return 操作结果响应 + */ @ApiOperation("新增") - @PostMapping - @PreAuthorize("hasAnyAuthority('money:city:add')") + @PostMapping // 处理POST请求,路径为/city + @PreAuthorize("hasAnyAuthority('money:city:add')") // 需要具备新增城市权限(money权限域) public ResponseDTO add(@RequestBody City city) { return this.cityService.add(city); } + /** + * 逻辑删除城市信息接口 + * @param id 城市ID,通过路径参数传入 + * @return 操作结果响应 + */ @ApiOperation("逻辑删除") - @DeleteMapping("/{id}") - @PreAuthorize("hasAnyAuthority('money:city:delete')") + @DeleteMapping("/{id}") // 处理DELETE请求,路径为/city/{id} + @PreAuthorize("hasAnyAuthority('money:city:delete')") // 需要具备删除城市权限 public ResponseDTO delete(@PathVariable Integer id) { return this.cityService.delete(id); } + /** + * 批量逻辑删除城市信息接口 + * @param ids 城市ID列表,通过路径参数传入 + * @return 操作结果响应 + */ @ApiOperation("批量逻辑删除") - @DeleteMapping("/batch/{ids}") - @PreAuthorize("hasAnyAuthority('money:city:delete')") + @DeleteMapping("/batch/{ids}") // 处理DELETE请求,路径为/city/batch/{ids} + @PreAuthorize("hasAnyAuthority('money:city:delete')") // 需要具备删除城市权限 public ResponseDTO deleteBatch(@PathVariable List ids) { return this.cityService.deleteBatch(ids); } + /** + * 编辑更新城市信息接口 + * @param city 城市实体对象,通过请求体传入 + * @return 操作结果响应 + */ @ApiOperation("编辑更新") - @PutMapping - @PreAuthorize("hasAnyAuthority('money:city:edit')") + @PutMapping // 处理PUT请求,路径为/city + @PreAuthorize("hasAnyAuthority('money:city:edit')") // 需要具备编辑城市权限 public ResponseDTO edit(@RequestBody City city) { return this.cityService.edit(city); } + /** + * 根据ID查询城市详情接口 + * @param id 城市ID,通过路径参数传入 + * @return 城市信息响应 + */ @ApiOperation("查询") - @GetMapping("/{id}") + @GetMapping("/{id}") // 处理GET请求,路径为/city/{id} public ResponseDTO query(@PathVariable Integer id) { return this.cityService.query(id); } + /** + * 查询所有城市信息接口 + * @return 所有城市列表响应 + */ @ApiOperation("查询所有") - @GetMapping("/all") + @GetMapping("/all") // 处理GET请求,路径为/city/all public ResponseDTO queryAll() { return this.cityService.queryAll(); } + /** + * 条件分页查询城市列表接口 + * @param current 当前页码,默认为1 + * @param size 每页大小,默认为10 + * @param name 城市名称(模糊查询条件) + * @return 分页城市列表响应 + */ @ApiOperation("条件查询") - @GetMapping - @PreAuthorize("hasAnyAuthority('money:city:list','money:city:search')") - public ResponseDTO list(@RequestParam(defaultValue = "1") Integer current, @RequestParam(defaultValue = "10") Integer size, String name) { + @GetMapping // 处理GET请求,路径为/city + @PreAuthorize("hasAnyAuthority('money:city:list','money:city:search')") // 需要具备城市列表查看或搜索权限 + public ResponseDTO list(@RequestParam(defaultValue = "1") Integer current, + @RequestParam(defaultValue = "10") Integer size, + String name) { return this.cityService.list(current, size, name); } - + /** + * 城市数据导出接口 + * @param response HTTP响应对象,用于输出Excel文件 + * @param filename 导出文件名,通过路径参数传入 + * @throws IOException 可能抛出IO异常 + */ @ApiOperation("数据导出接口") - @GetMapping("/export/{filename}") - @PreAuthorize("hasAnyAuthority('money:city:export')") + @GetMapping("/export/{filename}") // 处理GET请求,路径为/city/export/{filename} + @PreAuthorize("hasAnyAuthority('money:city:export')") // 需要具备城市数据导出权限 public void export(HttpServletResponse response, @PathVariable String filename) throws IOException { this.cityService.export(response, filename); } + /** + * 城市数据导入接口 + * @param file Excel文件对象,包含城市数据 + * @return 导入结果响应 + * @throws IOException 可能抛出IO异常 + */ @ApiOperation("数据导入接口") - @PostMapping("/import") - @PreAuthorize("hasAnyAuthority('money:city:import')") + @PostMapping("/import") // 处理POST请求,路径为/city/import + @PreAuthorize("hasAnyAuthority('money:city:import')") // 需要具备城市数据导入权限 public ResponseDTO imp(MultipartFile file) throws IOException { return this.cityService.imp(file); } - - -} - +} \ No newline at end of file -- 2.34.1 From af91108b139c3258f6b89bad04b752f824e6628c Mon Sep 17 00:00:00 2001 From: pq7sc2z5f <3289822358@qq.com> Date: Wed, 19 Nov 2025 10:20:15 +0800 Subject: [PATCH 04/17] Update DocsController.java --- .../com/qiujie/controller/DocsController.java | 125 ++++++++++++++---- 1 file changed, 96 insertions(+), 29 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..f2c9be7 100644 --- a/hrm/src/main/java/com/qiujie/controller/DocsController.java +++ b/hrm/src/main/java/com/qiujie/controller/DocsController.java @@ -16,92 +16,159 @@ import java.io.IOException; import java.util.List; /** - * 文件上传接口 + * 文件管理前端控制器 + * 处理文档文件的上传、下载、管理等操作,包括文件信息的CRUD和文件本身的操作 * * @Author qiujie * @Date 2022/2/24 * @Version 1.0 */ - -@RestController -@RequestMapping("/docs") +@RestController // 标识为RESTful控制器,返回数据均为JSON格式 +@RequestMapping("/docs") // 定义基础请求路径为/docs public class DocsController { - @Autowired + @Autowired // 自动注入文档服务类 private DocsService docsService; + /** + * 新增文档信息接口(不包含文件本身,只添加文档元数据) + * @param docs 文档实体对象,通过请求体传入 + * @return 操作结果响应 + */ @ApiOperation("新增") - @PostMapping + @PostMapping // 处理POST请求,路径为/docs public ResponseDTO add(@RequestBody Docs docs) { return this.docsService.add(docs); } + /** + * 逻辑删除文档信息接口 + * @param id 文档ID,通过路径参数传入 + * @return 操作结果响应 + */ @ApiOperation("逻辑删除") - @DeleteMapping("/{id}") - @PreAuthorize("hasAnyAuthority('system:docs:delete')") + @DeleteMapping("/{id}") // 处理DELETE请求,路径为/docs/{id} + @PreAuthorize("hasAnyAuthority('system:docs:delete')") // 需要具备删除文档权限 public ResponseDTO delete(@PathVariable Integer id) { return this.docsService.delete(id); } + /** + * 批量逻辑删除文档信息接口 + * @param ids 文档ID列表,通过路径参数传入 + * @return 操作结果响应 + */ @ApiOperation("批量逻辑删除") - @DeleteMapping("/batch/{ids}") - @PreAuthorize("hasAnyAuthority('system:docs:delete')") + @DeleteMapping("/batch/{ids}") // 处理DELETE请求,路径为/docs/batch/{ids} + @PreAuthorize("hasAnyAuthority('system:docs:delete')") // 需要具备删除文档权限 public ResponseDTO deleteBatch(@PathVariable List ids) { return this.docsService.deleteBatch(ids); } + /** + * 编辑更新文档信息接口 + * @param docs 文档实体对象,通过请求体传入 + * @return 操作结果响应 + */ @ApiOperation("编辑更新") - @PutMapping - @PreAuthorize("hasAnyAuthority('system:docs:edit')") + @PutMapping // 处理PUT请求,路径为/docs + @PreAuthorize("hasAnyAuthority('system:docs:edit')") // 需要具备编辑文档权限 public ResponseDTO edit(@RequestBody Docs docs) { return this.docsService.edit(docs); } + /** + * 根据ID查询文档详情接口 + * @param id 文档ID,通过路径参数传入 + * @return 文档信息响应 + */ @ApiOperation("查询") - @GetMapping("/{id}") + @GetMapping("/{id}") // 处理GET请求,路径为/docs/{id} public ResponseDTO query(@PathVariable Integer id) { return this.docsService.query(id); } + /** + * 分页条件查询文档列表接口 + * @param current 当前页码,默认为1 + * @param size 每页大小,默认为10 + * @param oldName 文件原始名称(模糊查询条件) + * @param staffName 员工姓名(关联查询条件) + * @return 分页文档列表响应 + */ @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) { + @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); } + /** + * 文档数据导出接口(导出文档元数据信息,非文件本身) + * @param response HTTP响应对象,用于输出Excel文件 + * @param filename 导出文件名,通过路径参数传入 + * @throws IOException 可能抛出IO异常 + */ @ApiOperation("数据导出接口") - @GetMapping("/export/{filename}") - @PreAuthorize("hasAnyAuthority('system:docs:export')") - public void export(HttpServletResponse response,@PathVariable String filename) throws IOException { - this.docsService.export(response,filename); + @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); } + /** + * 文档数据导入接口(导入文档元数据信息) + * @param file Excel文件对象,包含文档元数据 + * @return 导入结果响应 + * @throws IOException 可能抛出IO异常 + */ @ApiOperation("数据导入接口") - @PostMapping("/import") - @PreAuthorize("hasAnyAuthority('system:docs:import')") + @PostMapping("/import") // 处理POST请求,路径为/docs/import + @PreAuthorize("hasAnyAuthority('system:docs:import')") // 需要具备文档数据导入权限 public ResponseDTO imp(MultipartFile file) throws IOException { return this.docsService.imp(file); } - + /** + * 文件上传接口(上传实际文件内容) + * @param file 要上传的文件对象 + * @param id 关联的文档ID,通过路径参数传入 + * @return 上传结果响应 + * @throws IOException 可能抛出IO异常 + */ @ApiOperation("文件上传") - @PostMapping("/upload/{id}") - @PreAuthorize("hasAnyAuthority('system:docs:upload')") + @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); } + /** + * 文件下载接口(下载实际文件内容) + * @param filename 文件名,通过路径参数传入 + * @param response HTTP响应对象,用于输出文件流 + * @throws IOException 可能抛出IO异常 + */ @ApiOperation("文件下载") - @GetMapping("/download/{filename}") - @PreAuthorize("hasAnyAuthority('system:docs:download')") + @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); } + /** + * 头像下载接口(公开接口,无需权限验证) + * 用于获取用户头像等公开文件 + * @param filename 文件名,通过路径参数传入 + * @param response HTTP响应对象,用于输出文件流 + * @throws IOException 可能抛出IO异常 + */ @ApiOperation("文件下载") - @GetMapping("/avatar/{filename}") + @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 dfb813692b9b9d0b12c10be0f7309f29907e0515 Mon Sep 17 00:00:00 2001 From: pq7sc2z5f <3289822358@qq.com> Date: Wed, 19 Nov 2025 10:21:51 +0800 Subject: [PATCH 05/17] Update InsuranceController.java --- .../controller/InsuranceController.java | 115 +++++++++++++----- 1 file changed, 86 insertions(+), 29 deletions(-) diff --git a/hrm/src/main/java/com/qiujie/controller/InsuranceController.java b/hrm/src/main/java/com/qiujie/controller/InsuranceController.java index 738d30f..e9dc8fb 100644 --- a/hrm/src/main/java/com/qiujie/controller/InsuranceController.java +++ b/hrm/src/main/java/com/qiujie/controller/InsuranceController.java @@ -3,7 +3,6 @@ package com.qiujie.controller; import com.qiujie.entity.Staff; import com.qiujie.service.InsuranceService; import com.qiujie.entity.Insurance; - import com.qiujie.dto.ResponseDTO; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; @@ -16,83 +15,141 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; - /** - *

- * 前端控制器 - *

- * + * 社保管理前端控制器 + * 处理员工社保信息的增删改查、导入导出以及社保设置等操作 + * 社保信息通常包括养老保险、医疗保险、失业保险、工伤保险、生育保险等 + * * @author qiujie * @since 2022-03-23 */ -@RestController -@RequestMapping("/insurance") +@RestController // 标识为RESTful控制器,返回数据均为JSON格式 +@RequestMapping("/insurance") // 定义基础请求路径为/insurance public class InsuranceController { - @Autowired + + @Autowired // 自动注入社保服务类 private InsuranceService insuranceService; + /** + * 新增社保信息接口 + * @param insurance 社保实体对象,通过请求体传入 + * @return 操作结果响应 + */ @ApiOperation("新增") - @PostMapping + @PostMapping // 处理POST请求,路径为/insurance public ResponseDTO add(@RequestBody Insurance insurance) { return this.insuranceService.add(insurance); } + /** + * 逻辑删除社保信息接口 + * @param id 社保记录ID,通过路径参数传入 + * @return 操作结果响应 + */ @ApiOperation("逻辑删除") - @DeleteMapping("/{id}") + @DeleteMapping("/{id}") // 处理DELETE请求,路径为/insurance/{id} public ResponseDTO delete(@PathVariable Integer id) { return this.insuranceService.delete(id); } + /** + * 批量逻辑删除社保信息接口 + * @param ids 社保记录ID列表,通过路径参数传入 + * @return 操作结果响应 + */ @ApiOperation("批量逻辑删除") - @DeleteMapping("/batch/{ids}") + @DeleteMapping("/batch/{ids}") // 处理DELETE请求,路径为/insurance/batch/{ids} public ResponseDTO deleteBatch(@PathVariable List ids) { return this.insuranceService.deleteBatch(ids); } + /** + * 编辑更新社保信息接口 + * @param insurance 社保实体对象,通过请求体传入 + * @return 操作结果响应 + */ @ApiOperation("编辑更新") - @PutMapping + @PutMapping // 处理PUT请求,路径为/insurance public ResponseDTO edit(@RequestBody Insurance insurance) { return this.insuranceService.edit(insurance); } + /** + * 根据ID查询社保详情接口 + * @param id 社保记录ID,通过路径参数传入 + * @return 社保信息响应 + */ @ApiOperation("查询") - @GetMapping("/{id}") + @GetMapping("/{id}") // 处理GET请求,路径为/insurance/{id} public ResponseDTO query(@PathVariable Integer id) { return this.insuranceService.query(id); } + /** + * 根据员工ID查询社保信息接口 + * @param id 员工ID,通过路径参数传入 + * @return 该员工的社保信息响应 + */ @ApiOperation("查询") - @GetMapping("/staff/{id}") + @GetMapping("/staff/{id}") // 处理GET请求,路径为/insurance/staff/{id} public ResponseDTO queryByStaffId(@PathVariable Integer id) { return this.insuranceService.queryByStaffId(id); } + /** + * 多条件分页查询社保列表接口 + * @param current 当前页码,默认为1 + * @param size 每页大小,默认为10 + * @param name 员工姓名(模糊查询条件) + * @param deptId 部门ID(筛选条件) + * @return 分页社保列表响应 + */ @ApiOperation("多条件分页查询") - @GetMapping - @PreAuthorize("hasAnyAuthority('money:insurance:list','money:insurance:search')") - public ResponseDTO list(@RequestParam(defaultValue = "1") Integer current, @RequestParam(defaultValue = "10") Integer size, String name, Integer deptId){ - return this.insuranceService.list(current, size, name,deptId); + @GetMapping // 处理GET请求,路径为/insurance + @PreAuthorize("hasAnyAuthority('money:insurance:list','money:insurance:search')") // 需要具备社保列表查看或搜索权限 + public ResponseDTO list(@RequestParam(defaultValue = "1") Integer current, + @RequestParam(defaultValue = "10") Integer size, + String name, + Integer deptId) { + return this.insuranceService.list(current, size, name, deptId); } + /** + * 社保数据导出接口 + * @param response HTTP响应对象,用于输出Excel文件 + * @param filename 导出文件名,通过路径参数传入 + * @throws IOException 可能抛出IO异常 + */ @ApiOperation("数据导出接口") - @GetMapping("/export/{filename}") - @PreAuthorize("hasAnyAuthority('money:insurance:export')") - public void export(HttpServletResponse response,@PathVariable String filename) throws IOException { - this.insuranceService.export(response,filename); + @GetMapping("/export/{filename}") // 处理GET请求,路径为/insurance/export/{filename} + @PreAuthorize("hasAnyAuthority('money:insurance:export')") // 需要具备社保数据导出权限 + public void export(HttpServletResponse response, @PathVariable String filename) throws IOException { + this.insuranceService.export(response, filename); } + /** + * 社保数据导入接口 + * @param file Excel文件对象,包含社保数据 + * @return 导入结果响应 + * @throws IOException 可能抛出IO异常 + */ @ApiOperation("数据导入接口") - @PostMapping("/import") - @PreAuthorize("hasAnyAuthority('money:insurance:import')") + @PostMapping("/import") // 处理POST请求,路径为/insurance/import + @PreAuthorize("hasAnyAuthority('money:insurance:import')") // 需要具备社保数据导入权限 public ResponseDTO imp(MultipartFile file) throws IOException { return this.insuranceService.imp(file); } + /** + * 为员工设置社保信息接口 + * 通常用于初始化或更新员工的社保缴纳信息 + * @param insurance 社保实体对象,通过请求体传入 + * @return 操作结果响应 + */ @ApiOperation("为员工设置社保") - @PostMapping("/set") - @PreAuthorize("hasAnyAuthority('money:insurance:set')") + @PostMapping("/set") // 处理POST请求,路径为/insurance/set + @PreAuthorize("hasAnyAuthority('money:insurance:set')") // 需要具备设置社保权限 public ResponseDTO setInsurance(@RequestBody Insurance insurance) { return this.insuranceService.setInsurance(insurance); } -} - +} \ No newline at end of file -- 2.34.1 From 7035b95cc20bc61e67660e2330d38474712cae61 Mon Sep 17 00:00:00 2001 From: pq7sc2z5f <3289822358@qq.com> Date: Wed, 19 Nov 2025 10:22:50 +0800 Subject: [PATCH 06/17] Update LeaveController.java --- .../qiujie/controller/LeaveController.java | 88 ++++++++++++++----- 1 file changed, 65 insertions(+), 23 deletions(-) diff --git a/hrm/src/main/java/com/qiujie/controller/LeaveController.java b/hrm/src/main/java/com/qiujie/controller/LeaveController.java index baf4953..74cab19 100644 --- a/hrm/src/main/java/com/qiujie/controller/LeaveController.java +++ b/hrm/src/main/java/com/qiujie/controller/LeaveController.java @@ -11,77 +11,119 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; - /** - *

- * 请假表 前端控制器 - *

- * + * 请假管理前端控制器 + * 处理请假相关的所有HTTP请求,包括请假信息的增删改查、部门假期设置等操作 + * 请假信息包括年假、病假、事假、婚假、产假等各种假期类型 + * * @author qiujie * @since 2022-03-27 */ -@RestController -@RequestMapping("/leave") +@RestController // 标识为RESTful控制器,返回数据均为JSON格式 +@RequestMapping("/leave") // 定义基础请求路径为/leave public class LeaveController { - @Autowired + + @Autowired // 自动注入请假服务类 private LeaveService leaveService; + /** + * 新增请假记录接口 + * @param leave 请假实体对象,通过请求体传入 + * @return 操作结果响应 + */ @ApiOperation("新增") - @PostMapping + @PostMapping // 处理POST请求,路径为/leave public ResponseDTO add(@RequestBody Leave leave) { return this.leaveService.add(leave); } + /** + * 逻辑删除请假记录接口 + * @param id 请假记录ID,通过路径参数传入 + * @return 操作结果响应 + */ @ApiOperation("逻辑删除") - @DeleteMapping("/{id}") + @DeleteMapping("/{id}") // 处理DELETE请求,路径为/leave/{id} public ResponseDTO delete(@PathVariable Integer id) { return this.leaveService.delete(id); } + /** + * 批量逻辑删除请假记录接口 + * @param ids 请假记录ID列表,通过路径参数传入 + * @return 操作结果响应 + */ @ApiOperation("批量逻辑删除") - @DeleteMapping("/batch/{ids}") + @DeleteMapping("/batch/{ids}") // 处理DELETE请求,路径为/leave/batch/{ids} public ResponseDTO deleteBatch(@PathVariable List ids) { return this.leaveService.deleteBatch(ids); } + /** + * 编辑更新请假记录接口 + * @param leave 请假实体对象,通过请求体传入 + * @return 操作结果响应 + */ @ApiOperation("编辑更新") - @PutMapping + @PutMapping // 处理PUT请求,路径为/leave public ResponseDTO edit(@RequestBody Leave leave) { return this.leaveService.edit(leave); } + /** + * 根据ID查询请假详情接口 + * @param id 请假记录ID,通过路径参数传入 + * @return 请假信息响应 + */ @ApiOperation("查询") - @GetMapping("/{id}") + @GetMapping("/{id}") // 处理GET请求,路径为/leave/{id} public ResponseDTO query(@PathVariable Integer id) { return this.leaveService.query(id); } - + /** + * 根据部门ID和请假类型编号查询请假信息接口 + * @param deptId 部门ID,通过路径参数传入 + * @param typeNum 请假类型编号,通过路径参数传入 + * @return 请假信息响应 + */ @ApiOperation("获取") - @GetMapping("/{deptId}/{typeNum}") + @GetMapping("/{deptId}/{typeNum}") // 处理GET请求,路径为/leave/{deptId}/{typeNum} public ResponseDTO queryByDeptIdAndTypeNum(@PathVariable Integer deptId, @PathVariable Integer typeNum) { return this.leaveService.queryByDeptIdAndTypeNum(deptId, typeNum); } + /** + * 设置部门假期政策接口 + * 用于配置不同部门的假期规则和额度 + * @param leave 请假实体对象,包含假期设置信息,通过请求体传入 + * @return 操作结果响应 + */ @ApiOperation("设置假期") - @PostMapping("/set") - @PreAuthorize("hasAnyAuthority('system:department:setting')") + @PostMapping("/set") // 处理POST请求,路径为/leave/set + @PreAuthorize("hasAnyAuthority('system:department:setting')") // 需要具备部门设置权限 public ResponseDTO setLeave(@RequestBody Leave leave) { return this.leaveService.setLeave(leave); } - + /** + * 根据部门ID查询请假信息接口 + * @param id 部门ID,通过路径参数传入 + * @return 该部门的请假信息响应 + */ @ApiOperation("查询") - @GetMapping("/dept/{id}") + @GetMapping("/dept/{id}") // 处理GET请求,路径为/leave/dept/{id} public ResponseDTO queryByDeptId(@PathVariable Integer id) { return this.leaveService.queryByDeptId(id); } + /** + * 查询所有请假信息接口 + * @return 所有请假记录列表响应 + */ @ApiOperation("获取所有") - @GetMapping("/all") + @GetMapping("/all") // 处理GET请求,路径为/leave/all public ResponseDTO queryAll() { return this.leaveService.queryAll(); } - -} - +} \ No newline at end of file -- 2.34.1 From e62f05e0672b5adb25a119191bdc11c34fc7de14 Mon Sep 17 00:00:00 2001 From: pq7sc2z5f <3289822358@qq.com> Date: Wed, 19 Nov 2025 10:23:50 +0800 Subject: [PATCH 07/17] Update LoginController.java --- .../qiujie/controller/LoginController.java | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/hrm/src/main/java/com/qiujie/controller/LoginController.java b/hrm/src/main/java/com/qiujie/controller/LoginController.java index 45ea3a2..1c785d2 100644 --- a/hrm/src/main/java/com/qiujie/controller/LoginController.java +++ b/hrm/src/main/java/com/qiujie/controller/LoginController.java @@ -13,24 +13,40 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; /** - * 登录注册接口 + * 登录注册控制器 + * 处理用户登录、验证码获取等认证相关功能 * * @Author : qiujie * @Date : 2022/1/30 */ -@RestController +@RestController // 标识为RESTful控制器,返回数据均为JSON格式 public class LoginController { - @Autowired + @Autowired // 自动注入登录服务类 private LoginService loginService; - @PostMapping("/login/{validateCode}") + /** + * 用户登录接口 + * 验证用户凭证(用户名/密码)和验证码,生成认证令牌 + * + * @param staff 员工实体对象,通过请求体传入,包含登录凭证(如用户名、密码) + * @param validateCode 验证码,通过路径参数传入 + * @return 登录结果响应,包含认证令牌和用户信息 + */ + @PostMapping("/login/{validateCode}") // 处理POST请求,路径为/login/{validateCode} public ResponseDTO login(@RequestBody Staff staff, @PathVariable String validateCode) { return this.loginService.login(staff, validateCode); } - @GetMapping("/validate/code") + /** + * 获取验证码接口 + * 生成图形验证码并输出到HTTP响应流中,用于登录时的验证码验证 + * + * @param response HTTP响应对象,用于输出验证码图片 + * @throws IOException 可能抛出IO异常 + */ + @GetMapping("/validate/code") // 处理GET请求,路径为/validate/code public void getValidateCode(HttpServletResponse response) throws IOException { this.loginService.getValidateCode(response); } -} +} \ No newline at end of file -- 2.34.1 From d5e6420ab502e3f5fb82af140fce4efb321bad15 Mon Sep 17 00:00:00 2001 From: pq7sc2z5f <3289822358@qq.com> Date: Wed, 19 Nov 2025 10:24:57 +0800 Subject: [PATCH 08/17] Update SalaryController.java --- .../qiujie/controller/SalaryController.java | 111 +++++++++++++----- 1 file changed, 83 insertions(+), 28 deletions(-) diff --git a/hrm/src/main/java/com/qiujie/controller/SalaryController.java b/hrm/src/main/java/com/qiujie/controller/SalaryController.java index 962ee30..82d2ad5 100644 --- a/hrm/src/main/java/com/qiujie/controller/SalaryController.java +++ b/hrm/src/main/java/com/qiujie/controller/SalaryController.java @@ -14,80 +14,135 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; - /** - *

- * 前端控制器 - *

- * + * 薪资管理前端控制器 + * 处理员工薪资信息的增删改查、导入导出以及薪资设置等操作 + * 薪资信息包括基本工资、奖金、津贴、扣款等各项薪资组成 + * * @author qiujie * @since 2022-04-06 */ -@RestController -@RequestMapping("/salary") +@RestController // 标识为RESTful控制器,返回数据均为JSON格式 +@RequestMapping("/salary") // 定义基础请求路径为/salary public class SalaryController { - @Autowired + @Autowired // 自动注入薪资服务类 private SalaryService salaryService; + /** + * 新增薪资记录接口 + * @param salary 薪资实体对象,通过请求体传入 + * @return 操作结果响应 + */ @ApiOperation("新增") - @PostMapping + @PostMapping // 处理POST请求,路径为/salary public ResponseDTO add(@RequestBody Salary salary) { return this.salaryService.add(salary); } + /** + * 逻辑删除薪资记录接口 + * @param id 薪资记录ID,通过路径参数传入 + * @return 操作结果响应 + */ @ApiOperation("逻辑删除") - @DeleteMapping("/{id}") + @DeleteMapping("/{id}") // 处理DELETE请求,路径为/salary/{id} public ResponseDTO delete(@PathVariable Integer id) { return this.salaryService.delete(id); } + /** + * 批量逻辑删除薪资记录接口 + * @param ids 薪资记录ID列表,通过路径参数传入 + * @return 操作结果响应 + */ @ApiOperation("批量逻辑删除") - @DeleteMapping("/batch/{ids}") + @DeleteMapping("/batch/{ids}") // 处理DELETE请求,路径为/salary/batch/{ids} public ResponseDTO deleteBatch(@PathVariable List ids) { return this.salaryService.deleteBatch(ids); } + /** + * 编辑更新薪资记录接口 + * @param salary 薪资实体对象,通过请求体传入 + * @return 操作结果响应 + */ @ApiOperation("编辑更新") - @PutMapping + @PutMapping // 处理PUT请求,路径为/salary public ResponseDTO edit(@RequestBody Salary salary) { return this.salaryService.edit(salary); } + /** + * 根据ID查询薪资详情接口 + * @param id 薪资记录ID,通过路径参数传入 + * @return 薪资信息响应 + */ @ApiOperation("查询") - @GetMapping("/{id}") + @GetMapping("/{id}") // 处理GET请求,路径为/salary/{id} public ResponseDTO query(@PathVariable Integer id) { return this.salaryService.query(id); } + /** + * 分页条件查询薪资列表接口 + * @param current 当前页码,默认为1 + * @param size 每页大小,默认为10 + * @param name 员工姓名(模糊查询条件) + * @param deptId 部门ID(筛选条件) + * @param month 薪资月份(格式如:2024-01) + * @return 分页薪资列表响应 + */ @ApiOperation("分页条件查询") - @GetMapping - @PreAuthorize("hasAnyAuthority('money:salary:list','money:salary:search')") - public ResponseDTO list(@RequestParam(defaultValue = "1") Integer current, @RequestParam(defaultValue = "10") Integer size, String name, Integer deptId, String month) { + @GetMapping // 处理GET请求,路径为/salary + @PreAuthorize("hasAnyAuthority('money:salary:list','money:salary:search')") // 需要具备薪资列表查看或搜索权限 + public ResponseDTO list(@RequestParam(defaultValue = "1") Integer current, + @RequestParam(defaultValue = "10") Integer size, + String name, + Integer deptId, + String month) { return this.salaryService.list(current, size, name, deptId, month); } + /** + * 薪资数据导出接口 + * @param response HTTP响应对象,用于输出Excel文件 + * @param month 导出数据的月份,通过路径参数传入 + * @param filename 导出文件名,通过路径参数传入 + * @throws IOException 可能抛出IO异常 + */ @ApiOperation("数据导出接口") - @GetMapping("/export/{month}/{filename}") - @PreAuthorize("hasAnyAuthority('money:salary:export')") - public void export(HttpServletResponse response, @PathVariable String month,@PathVariable String filename) throws IOException { - this.salaryService.export(response, month,filename); + @GetMapping("/export/{month}/{filename}") // 处理GET请求,路径为/salary/export/{month}/{filename} + @PreAuthorize("hasAnyAuthority('money:salary:export')") // 需要具备薪资数据导出权限 + public void export(HttpServletResponse response, + @PathVariable String month, + @PathVariable String filename) throws IOException { + this.salaryService.export(response, month, filename); } + /** + * 薪资数据导入接口 + * @param file Excel文件对象,包含薪资数据 + * @return 导入结果响应 + * @throws IOException 可能抛出IO异常 + */ @ApiOperation("数据导入接口") - @PostMapping("/import") - @PreAuthorize("hasAnyAuthority('money:salary:import')") + @PostMapping("/import") // 处理POST请求,路径为/salary/import + @PreAuthorize("hasAnyAuthority('money:salary:import')") // 需要具备薪资数据导入权限 public ResponseDTO imp(MultipartFile file) throws IOException { return this.salaryService.imp(file); } + /** + * 设置员工薪资接口 + * 用于配置或调整员工的基本工资、岗位工资等固定薪资项 + * @param salary 薪资实体对象,通过请求体传入 + * @return 操作结果响应 + */ @ApiOperation("设置工资") - @PostMapping("/set") - @PreAuthorize("hasAnyAuthority('money:salary:set')") + @PostMapping("/set") // 处理POST请求,路径为/salary/set + @PreAuthorize("hasAnyAuthority('money:salary:set')") // 需要具备设置薪资权限 public ResponseDTO setSalary(@RequestBody Salary salary) { return this.salaryService.setSalary(salary); } - - -} - +} \ No newline at end of file -- 2.34.1 From 5c84f2df4b2a5e18bd3ba04e530653099d8bb15d Mon Sep 17 00:00:00 2001 From: pq7sc2z5f <3289822358@qq.com> Date: Wed, 19 Nov 2025 10:26:07 +0800 Subject: [PATCH 09/17] Update SalaryDeductController.java --- .../controller/SalaryDeductController.java | 79 ++++++++++++++----- 1 file changed, 59 insertions(+), 20 deletions(-) diff --git a/hrm/src/main/java/com/qiujie/controller/SalaryDeductController.java b/hrm/src/main/java/com/qiujie/controller/SalaryDeductController.java index fe7bc3a..85d358b 100644 --- a/hrm/src/main/java/com/qiujie/controller/SalaryDeductController.java +++ b/hrm/src/main/java/com/qiujie/controller/SalaryDeductController.java @@ -11,69 +11,108 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; - /** - *

- * 工资扣除表 前端控制器 - *

- * + * 工资扣款管理前端控制器 + * 处理工资扣款规则的增删改查以及扣款规则设置等操作 + * 工资扣款包括罚款、缺勤扣款、社保公积金个人部分、个税等扣款项 + * * @author qiujie * @since 2022-03-27 */ -@RestController -@RequestMapping("/salary-deduct") +@RestController // 标识为RESTful控制器,返回数据均为JSON格式 +@RequestMapping("/salary-deduct") // 定义基础请求路径为/salary-deduct public class SalaryDeductController { - @Autowired + + @Autowired // 自动注入工资扣款服务类 private SalaryDeductService salaryDeductService; + /** + * 新增工资扣款规则接口 + * @param salaryDeduct 工资扣款实体对象,通过请求体传入 + * @return 操作结果响应 + */ @ApiOperation("新增") - @PostMapping + @PostMapping // 处理POST请求,路径为/salary-deduct public ResponseDTO add(@RequestBody SalaryDeduct salaryDeduct) { return this.salaryDeductService.add(salaryDeduct); } + /** + * 逻辑删除工资扣款规则接口 + * @param id 工资扣款记录ID,通过路径参数传入 + * @return 操作结果响应 + */ @ApiOperation("逻辑删除") - @DeleteMapping("/{id}") + @DeleteMapping("/{id}") // 处理DELETE请求,路径为/salary-deduct/{id} public ResponseDTO delete(@PathVariable Integer id) { return this.salaryDeductService.delete(id); } + /** + * 批量逻辑删除工资扣款规则接口 + * @param ids 工资扣款记录ID列表,通过路径参数传入 + * @return 操作结果响应 + */ @ApiOperation("批量逻辑删除") - @DeleteMapping("/batch/{ids}") + @DeleteMapping("/batch/{ids}") // 处理DELETE请求,路径为/salary-deduct/batch/{ids} public ResponseDTO deleteBatch(@PathVariable List ids) { return this.salaryDeductService.deleteBatch(ids); } + /** + * 编辑更新工资扣款规则接口 + * @param salaryDeduct 工资扣款实体对象,通过请求体传入 + * @return 操作结果响应 + */ @ApiOperation("编辑更新") - @PutMapping + @PutMapping // 处理PUT请求,路径为/salary-deduct public ResponseDTO edit(@RequestBody SalaryDeduct salaryDeduct) { return this.salaryDeductService.edit(salaryDeduct); } + /** + * 根据ID查询工资扣款详情接口 + * @param id 工资扣款记录ID,通过路径参数传入 + * @return 工资扣款信息响应 + */ @ApiOperation("查询") - @GetMapping("/{id}") + @GetMapping("/{id}") // 处理GET请求,路径为/salary-deduct/{id} public ResponseDTO query(@PathVariable Integer id) { return this.salaryDeductService.query(id); } + /** + * 根据部门ID和扣款类型编号查询工资扣款规则接口 + * @param deptId 部门ID,通过路径参数传入 + * @param typeNum 扣款类型编号,通过路径参数传入 + * @return 工资扣款信息响应 + */ @ApiOperation("获取") - @GetMapping("/{deptId}/{typeNum}") + @GetMapping("/{deptId}/{typeNum}") // 处理GET请求,路径为/salary-deduct/{deptId}/{typeNum} public ResponseDTO queryByDeptIdAndTypeNum(@PathVariable Integer deptId, @PathVariable Integer typeNum) { return this.salaryDeductService.queryByDeptIdAndTypeNum(deptId, typeNum); } + /** + * 设置部门罚款规则接口 + * 用于配置不同部门的罚款规则和扣款标准 + * @param salaryDeduct 工资扣款实体对象,包含罚款设置信息,通过请求体传入 + * @return 操作结果响应 + */ @ApiOperation("设置罚款") - @PostMapping("/set") - @PreAuthorize("hasAnyAuthority('system:department:setting')") + @PostMapping("/set") // 处理POST请求,路径为/salary-deduct/set + @PreAuthorize("hasAnyAuthority('system:department:setting')") // 需要具备部门设置权限 public ResponseDTO setSalaryDeduct(@RequestBody SalaryDeduct salaryDeduct) { return this.salaryDeductService.setSalaryDeduct(salaryDeduct); } + /** + * 查询所有工资扣款规则接口 + * @return 所有工资扣款规则列表响应 + */ @ApiOperation("获取所有") - @GetMapping("/all") + @GetMapping("/all") // 处理GET请求,路径为/salary-deduct/all public ResponseDTO queryAll() { return this.salaryDeductService.queryAll(); } - -} - +} \ No newline at end of file -- 2.34.1 From 3f38d6ee37f3fd4d161fa8f5bb42c7d3b5d931a8 Mon Sep 17 00:00:00 2001 From: pq7sc2z5f <3289822358@qq.com> Date: Wed, 19 Nov 2025 10:30:55 +0800 Subject: [PATCH 10/17] Update DocsController.java --- .../com/qiujie/controller/DocsController.java | 170 ++---------------- 1 file changed, 16 insertions(+), 154 deletions(-) diff --git a/hrm/src/main/java/com/qiujie/controller/DocsController.java b/hrm/src/main/java/com/qiujie/controller/DocsController.java index f2c9be7..d7e9783 100644 --- a/hrm/src/main/java/com/qiujie/controller/DocsController.java +++ b/hrm/src/main/java/com/qiujie/controller/DocsController.java @@ -1,174 +1,36 @@ package com.qiujie.controller; -import com.qiujie.entity.Docs; +import com.qiujie.dto.Response; +import com.qiujie.entity.Staff; import com.qiujie.dto.ResponseDTO; -import com.qiujie.service.DocsService; +import com.qiujie.service.LoginService; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import java.util.List; /** - * 文件管理前端控制器 - * 处理文档文件的上传、下载、管理等操作,包括文件信息的CRUD和文件本身的操作 + * 登录注册接口 * - * @Author qiujie - * @Date 2022/2/24 - * @Version 1.0 + * @Author : qiujie + * @Date : 2022/1/30 */ -@RestController // 标识为RESTful控制器,返回数据均为JSON格式 -@RequestMapping("/docs") // 定义基础请求路径为/docs -public class DocsController { +@RestController +public class LoginController { - @Autowired // 自动注入文档服务类 - private DocsService docsService; + @Autowired + private LoginService loginService; - /** - * 新增文档信息接口(不包含文件本身,只添加文档元数据) - * @param docs 文档实体对象,通过请求体传入 - * @return 操作结果响应 - */ - @ApiOperation("新增") - @PostMapping // 处理POST请求,路径为/docs - public ResponseDTO add(@RequestBody Docs docs) { - return this.docsService.add(docs); + @PostMapping("/login/{validateCode}") + public ResponseDTO login(@RequestBody Staff staff, @PathVariable String validateCode) { + return this.loginService.login(staff, validateCode); } - /** - * 逻辑删除文档信息接口 - * @param id 文档ID,通过路径参数传入 - * @return 操作结果响应 - */ - @ApiOperation("逻辑删除") - @DeleteMapping("/{id}") // 处理DELETE请求,路径为/docs/{id} - @PreAuthorize("hasAnyAuthority('system:docs:delete')") // 需要具备删除文档权限 - public ResponseDTO delete(@PathVariable Integer id) { - return this.docsService.delete(id); - } - - /** - * 批量逻辑删除文档信息接口 - * @param ids 文档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); - } - - /** - * 编辑更新文档信息接口 - * @param docs 文档实体对象,通过请求体传入 - * @return 操作结果响应 - */ - @ApiOperation("编辑更新") - @PutMapping // 处理PUT请求,路径为/docs - @PreAuthorize("hasAnyAuthority('system:docs:edit')") // 需要具备编辑文档权限 - public ResponseDTO edit(@RequestBody Docs docs) { - return this.docsService.edit(docs); - } - - /** - * 根据ID查询文档详情接口 - * @param id 文档ID,通过路径参数传入 - * @return 文档信息响应 - */ - @ApiOperation("查询") - @GetMapping("/{id}") // 处理GET请求,路径为/docs/{id} - public ResponseDTO query(@PathVariable Integer id) { - return this.docsService.query(id); - } - - /** - * 分页条件查询文档列表接口 - * @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); - } - - /** - * 文档数据导出接口(导出文档元数据信息,非文件本身) - * @param response HTTP响应对象,用于输出Excel文件 - * @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); - } - - /** - * 文档数据导入接口(导入文档元数据信息) - * @param file Excel文件对象,包含文档元数据 - * @return 导入结果响应 - * @throws IOException 可能抛出IO异常 - */ - @ApiOperation("数据导入接口") - @PostMapping("/import") // 处理POST请求,路径为/docs/import - @PreAuthorize("hasAnyAuthority('system:docs:import')") // 需要具备文档数据导入权限 - public ResponseDTO imp(MultipartFile file) throws IOException { - return this.docsService.imp(file); - } - - /** - * 文件上传接口(上传实际文件内容) - * @param file 要上传的文件对象 - * @param id 关联的文档ID,通过路径参数传入 - * @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); - } - - /** - * 文件下载接口(下载实际文件内容) - * @param filename 文件名,通过路径参数传入 - * @param response HTTP响应对象,用于输出文件流 - * @throws IOException 可能抛出IO异常 - */ - @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); - } - - /** - * 头像下载接口(公开接口,无需权限验证) - * 用于获取用户头像等公开文件 - * @param filename 文件名,通过路径参数传入 - * @param response HTTP响应对象,用于输出文件流 - * @throws IOException 可能抛出IO异常 - */ - @ApiOperation("文件下载") - @GetMapping("/avatar/{filename}") // 处理GET请求,路径为/docs/avatar/{filename} - public void getAvatar(@PathVariable String filename, HttpServletResponse response) throws IOException { - this.docsService.download(filename, response); + @GetMapping("/validate/code") + public void getValidateCode(HttpServletResponse response) throws IOException { + this.loginService.getValidateCode(response); } } \ No newline at end of file -- 2.34.1 From 03ddf78c4f86ae178f14cce7cbddc31d92e9adf2 Mon Sep 17 00:00:00 2001 From: pq7sc2z5f <3289822358@qq.com> Date: Wed, 19 Nov 2025 10:32:05 +0800 Subject: [PATCH 11/17] Update DocsController.java --- .../com/qiujie/controller/DocsController.java | 89 +++++++++++++++---- 1 file changed, 72 insertions(+), 17 deletions(-) diff --git a/hrm/src/main/java/com/qiujie/controller/DocsController.java b/hrm/src/main/java/com/qiujie/controller/DocsController.java index d7e9783..246b3f1 100644 --- a/hrm/src/main/java/com/qiujie/controller/DocsController.java +++ b/hrm/src/main/java/com/qiujie/controller/DocsController.java @@ -1,36 +1,91 @@ package com.qiujie.controller; -import com.qiujie.dto.Response; -import com.qiujie.entity.Staff; +import com.qiujie.entity.Leave; import com.qiujie.dto.ResponseDTO; -import com.qiujie.service.LoginService; +import com.qiujie.service.LeaveService; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; +import java.util.List; + /** - * 登录注册接口 + •

+ + • 请假表 前端控制器 + + •

+ * - * @Author : qiujie - * @Date : 2022/1/30 + • @author qiujie + + • @since 2022-03-27 + */ @RestController -public class LoginController { - +@RequestMapping("/leave") +public class LeaveController { @Autowired - private LoginService loginService; + private LeaveService leaveService; + + @ApiOperation("新增") + @PostMapping + public ResponseDTO add(@RequestBody Leave leave) { + return this.leaveService.add(leave); + } + + @ApiOperation("逻辑删除") + @DeleteMapping("/{id}") + public ResponseDTO delete(@PathVariable Integer id) { + return this.leaveService.delete(id); + } + + @ApiOperation("批量逻辑删除") + @DeleteMapping("/batch/{ids}") + public ResponseDTO deleteBatch(@PathVariable List ids) { + return this.leaveService.deleteBatch(ids); + } + + @ApiOperation("编辑更新") + @PutMapping + public ResponseDTO edit(@RequestBody Leave leave) { + return this.leaveService.edit(leave); + } + + @ApiOperation("查询") + @GetMapping("/{id}") + public ResponseDTO query(@PathVariable Integer id) { + return this.leaveService.query(id); + } + - @PostMapping("/login/{validateCode}") - public ResponseDTO login(@RequestBody Staff staff, @PathVariable String validateCode) { - return this.loginService.login(staff, validateCode); + @ApiOperation("获取") + @GetMapping("/{deptId}/{typeNum}") + public ResponseDTO queryByDeptIdAndTypeNum(@PathVariable Integer deptId, @PathVariable Integer typeNum) { + return this.leaveService.queryByDeptIdAndTypeNum(deptId, typeNum); } - @GetMapping("/validate/code") - public void getValidateCode(HttpServletResponse response) throws IOException { - this.loginService.getValidateCode(response); + @ApiOperation("设置假期") + @PostMapping("/set") + @PreAuthorize("hasAnyAuthority('system:department:setting')") + public ResponseDTO setLeave(@RequestBody Leave leave) { + return this.leaveService.setLeave(leave); } + + + @ApiOperation("查询") + @GetMapping("/dept/{id}") + public ResponseDTO queryByDeptId(@PathVariable Integer id) { + return this.leaveService.queryByDeptId(id); + } + + @ApiOperation("获取所有") + @GetMapping("/all") + public ResponseDTO queryAll() { + return this.leaveService.queryAll(); + } + } \ No newline at end of file -- 2.34.1 From d1b4f171019fecfa7293065d0033f38c0e26a523 Mon Sep 17 00:00:00 2001 From: pq7sc2z5f <3289822358@qq.com> Date: Wed, 19 Nov 2025 10:32:30 +0800 Subject: [PATCH 12/17] Update DeptController.java --- .../com/qiujie/controller/DeptController.java | 154 ++++++------------ 1 file changed, 52 insertions(+), 102 deletions(-) diff --git a/hrm/src/main/java/com/qiujie/controller/DeptController.java b/hrm/src/main/java/com/qiujie/controller/DeptController.java index 1a5b77f..246b3f1 100644 --- a/hrm/src/main/java/com/qiujie/controller/DeptController.java +++ b/hrm/src/main/java/com/qiujie/controller/DeptController.java @@ -1,141 +1,91 @@ package com.qiujie.controller; -import com.qiujie.entity.Dept; +import com.qiujie.entity.Leave; import com.qiujie.dto.ResponseDTO; -import com.qiujie.service.DeptService; +import com.qiujie.service.LeaveService; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; import java.util.List; + /** - * 部门管理前端控制器 - * 处理部门相关的所有HTTP请求,包括增删改查、导入导出等操作 - * - * @author qiujie - * @since 2022-03-07 + •

+ + • 请假表 前端控制器 + + •

+ + * + • @author qiujie + + • @since 2022-03-27 + */ -@RestController // 标识为RESTful控制器,返回数据均为JSON格式 -@RequestMapping("/dept") // 定义基础请求路径为/dept -public class DeptController { - - @Autowired // 自动注入部门服务类 - private DeptService deptService; - - /** - * 新增部门接口 - * @param dept 部门实体对象,通过请求体传入 - * @return 操作结果响应 - */ +@RestController +@RequestMapping("/leave") +public class LeaveController { + @Autowired + private LeaveService leaveService; + @ApiOperation("新增") - @PostMapping // 处理POST请求,路径为/dept - @PreAuthorize("hasAnyAuthority('system:department:add')") // 需要具备新增部门权限 - public ResponseDTO add(@RequestBody Dept dept) { - return this.deptService.add(dept); + @PostMapping + public ResponseDTO add(@RequestBody Leave leave) { + return this.leaveService.add(leave); } - /** - * 逻辑删除部门接口 - * @param id 部门ID,通过路径参数传入 - * @return 操作结果响应 - */ @ApiOperation("逻辑删除") - @DeleteMapping("/{id}") // 处理DELETE请求,路径为/dept/{id} - @PreAuthorize("hasAnyAuthority('system:department:delete')") // 需要具备删除部门权限 + @DeleteMapping("/{id}") public ResponseDTO delete(@PathVariable Integer id) { - return this.deptService.delete(id); + return this.leaveService.delete(id); } - /** - * 批量逻辑删除部门接口 - * @param ids 部门ID列表,通过路径参数传入 - * @return 操作结果响应 - */ @ApiOperation("批量逻辑删除") - @DeleteMapping("/batch/{ids}") // 处理DELETE请求,路径为/dept/batch/{ids} - @PreAuthorize("hasAnyAuthority('system:department:delete')") // 需要具备删除部门权限 + @DeleteMapping("/batch/{ids}") public ResponseDTO deleteBatch(@PathVariable List ids) { - return this.deptService.deleteBatch(ids); + return this.leaveService.deleteBatch(ids); } - /** - * 编辑更新部门信息接口 - * @param dept 部门实体对象,通过请求体传入 - * @return 操作结果响应 - */ @ApiOperation("编辑更新") - @PutMapping // 处理PUT请求,路径为/dept - @PreAuthorize("hasAnyAuthority('system:department:edit')") // 需要具备编辑部门权限 - public ResponseDTO edit(@RequestBody Dept dept) { - return this.deptService.edit(dept); + @PutMapping + public ResponseDTO edit(@RequestBody Leave leave) { + return this.leaveService.edit(leave); } - /** - * 根据ID查询部门详情接口 - * @param id 部门ID,通过路径参数传入 - * @return 部门信息响应 - */ @ApiOperation("查询") - @GetMapping("/{id}") // 处理GET请求,路径为/dept/{id} + @GetMapping("/{id}") public ResponseDTO query(@PathVariable Integer id) { - return this.deptService.query(id); + return this.leaveService.query(id); } - /** - * 查询所有部门信息接口 - * @return 所有部门列表响应 - */ - @ApiOperation("查询所有") - @GetMapping("/all") // 处理GET请求,路径为/dept/all - public ResponseDTO queryAll(){ - return this.deptService.queryAll(); + + @ApiOperation("获取") + @GetMapping("/{deptId}/{typeNum}") + public ResponseDTO queryByDeptIdAndTypeNum(@PathVariable Integer deptId, @PathVariable Integer typeNum) { + return this.leaveService.queryByDeptIdAndTypeNum(deptId, typeNum); } - /** - * 条件分页查询部门列表接口 - * @param current 当前页码,默认为1 - * @param size 每页大小,默认为10 - * @param name 部门名称(模糊查询条件) - * @return 分页部门列表响应 - */ - @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); + @ApiOperation("设置假期") + @PostMapping("/set") + @PreAuthorize("hasAnyAuthority('system:department:setting')") + public ResponseDTO setLeave(@RequestBody Leave leave) { + return this.leaveService.setLeave(leave); } - /** - * 部门数据导出接口 - * @param response HTTP响应对象,用于输出Excel文件 - * @param filename 导出文件名,通过路径参数传入 - * @throws Exception 可能抛出IO异常等 - */ - @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); + + @ApiOperation("查询") + @GetMapping("/dept/{id}") + public ResponseDTO queryByDeptId(@PathVariable Integer id) { + return this.leaveService.queryByDeptId(id); } - /** - * 部门数据导入接口 - * @param file Excel文件对象,包含部门数据 - * @return 导入结果响应 - * @throws IOException 可能抛出IO异常 - */ - @ApiOperation("数据导入接口") - @PostMapping("/import") // 处理POST请求,路径为/dept/import - @PreAuthorize("hasAnyAuthority('system:department:import')") // 需要具备数据导入权限 - public ResponseDTO imp(MultipartFile file) throws IOException { - return this.deptService.imp(file); + @ApiOperation("获取所有") + @GetMapping("/all") + public ResponseDTO queryAll() { + return this.leaveService.queryAll(); } + } \ No newline at end of file -- 2.34.1 From 80b8bf73ee50e55a6dd5071a126da52b64e69d19 Mon Sep 17 00:00:00 2001 From: pq7sc2z5f <3289822358@qq.com> Date: Wed, 19 Nov 2025 10:33:07 +0800 Subject: [PATCH 13/17] Update DocsController.java --- .../com/qiujie/controller/DocsController.java | 86 ++++--------------- 1 file changed, 17 insertions(+), 69 deletions(-) diff --git a/hrm/src/main/java/com/qiujie/controller/DocsController.java b/hrm/src/main/java/com/qiujie/controller/DocsController.java index 246b3f1..5db9303 100644 --- a/hrm/src/main/java/com/qiujie/controller/DocsController.java +++ b/hrm/src/main/java/com/qiujie/controller/DocsController.java @@ -1,91 +1,39 @@ package com.qiujie.controller; -import com.qiujie.entity.Leave; +import com.qiujie.dto.Response; +import com.qiujie.entity.Staff; import com.qiujie.dto.ResponseDTO; -import com.qiujie.service.LeaveService; +import com.qiujie.service.LoginService; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; -import java.util.List; - +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; /** - •

- - • 请假表 前端控制器 - - •

+ • 登录注册接口 * - • @author qiujie + • @Author : qiujie - • @since 2022-03-27 + • @Date : 2022/1/30 */ @RestController -@RequestMapping("/leave") -public class LeaveController { - @Autowired - private LeaveService leaveService; - - @ApiOperation("新增") - @PostMapping - public ResponseDTO add(@RequestBody Leave leave) { - return this.leaveService.add(leave); - } - - @ApiOperation("逻辑删除") - @DeleteMapping("/{id}") - public ResponseDTO delete(@PathVariable Integer id) { - return this.leaveService.delete(id); - } - - @ApiOperation("批量逻辑删除") - @DeleteMapping("/batch/{ids}") - public ResponseDTO deleteBatch(@PathVariable List ids) { - return this.leaveService.deleteBatch(ids); - } - - @ApiOperation("编辑更新") - @PutMapping - public ResponseDTO edit(@RequestBody Leave leave) { - return this.leaveService.edit(leave); - } - - @ApiOperation("查询") - @GetMapping("/{id}") - public ResponseDTO query(@PathVariable Integer id) { - return this.leaveService.query(id); - } - - - @ApiOperation("获取") - @GetMapping("/{deptId}/{typeNum}") - public ResponseDTO queryByDeptIdAndTypeNum(@PathVariable Integer deptId, @PathVariable Integer typeNum) { - return this.leaveService.queryByDeptIdAndTypeNum(deptId, typeNum); - } - - @ApiOperation("设置假期") - @PostMapping("/set") - @PreAuthorize("hasAnyAuthority('system:department:setting')") - public ResponseDTO setLeave(@RequestBody Leave leave) { - return this.leaveService.setLeave(leave); - } +public class LoginController { + @Autowired + private LoginService loginService; - @ApiOperation("查询") - @GetMapping("/dept/{id}") - public ResponseDTO queryByDeptId(@PathVariable Integer id) { - return this.leaveService.queryByDeptId(id); + @PostMapping("/login/{validateCode}") + public ResponseDTO login(@RequestBody Staff staff, @PathVariable String validateCode) { + return this.loginService.login(staff, validateCode); } - @ApiOperation("获取所有") - @GetMapping("/all") - public ResponseDTO queryAll() { - return this.leaveService.queryAll(); + @GetMapping("/validate/code") + public void getValidateCode(HttpServletResponse response) throws IOException { + this.loginService.getValidateCode(response); } - } \ No newline at end of file -- 2.34.1 From 255389882c35fcace4ff0a5a79b86e43d13bf071 Mon Sep 17 00:00:00 2001 From: pq7sc2z5f <3289822358@qq.com> Date: Wed, 19 Nov 2025 10:36:38 +0800 Subject: [PATCH 14/17] Update DocsController.java --- .../com/qiujie/controller/DocsController.java | 100 +++++++++++++++--- 1 file changed, 86 insertions(+), 14 deletions(-) diff --git a/hrm/src/main/java/com/qiujie/controller/DocsController.java b/hrm/src/main/java/com/qiujie/controller/DocsController.java index 5db9303..4094934 100644 --- a/hrm/src/main/java/com/qiujie/controller/DocsController.java +++ b/hrm/src/main/java/com/qiujie/controller/DocsController.java @@ -1,39 +1,111 @@ package com.qiujie.controller; -import com.qiujie.dto.Response; -import com.qiujie.entity.Staff; +import com.qiujie.entity.Docs; import com.qiujie.dto.ResponseDTO; -import com.qiujie.service.LoginService; +import com.qiujie.service.DocsService; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.util.List; /** - • 登录注册接口 + • 文件上传接口 * - • @Author : qiujie + • @Author qiujie - • @Date : 2022/1/30 + • @Date 2022/2/24 + + • @Version 1.0 */ + @RestController -public class LoginController { +@RequestMapping("/docs") +public class DocsController { @Autowired - private LoginService loginService; + private DocsService docsService; + + @ApiOperation("新增") + @PostMapping + public ResponseDTO add(@RequestBody Docs docs) { + return this.docsService.add(docs); + } + + @ApiOperation("逻辑删除") + @DeleteMapping("/{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')") + public ResponseDTO deleteBatch(@PathVariable List ids) { + return this.docsService.deleteBatch(ids); + } + + @ApiOperation("编辑更新") + @PutMapping + @PreAuthorize("hasAnyAuthority('system:docs:edit')") + public ResponseDTO edit(@RequestBody Docs docs) { + return this.docsService.edit(docs); + } + + @ApiOperation("查询") + @GetMapping("/{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) { + 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); + } + + @ApiOperation("数据导入接口") + @PostMapping("/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')") + public ResponseDTO upload(MultipartFile file, @PathVariable Integer id) throws IOException { + return this.docsService.upload(file, id); + } - @PostMapping("/login/{validateCode}") - public ResponseDTO login(@RequestBody Staff staff, @PathVariable String validateCode) { - return this.loginService.login(staff, validateCode); + @ApiOperation("文件下载") + @GetMapping("/download/{filename}") + @PreAuthorize("hasAnyAuthority('system:docs:download')") + public void download(@PathVariable String filename, HttpServletResponse response) throws IOException { + this.docsService.download(filename, response); } - @GetMapping("/validate/code") - public void getValidateCode(HttpServletResponse response) throws IOException { - this.loginService.getValidateCode(response); + @ApiOperation("文件下载") + @GetMapping("/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 6accefacc19739f4d78f444a5198a5b56b948c81 Mon Sep 17 00:00:00 2001 From: pq7sc2z5f <3289822358@qq.com> Date: Wed, 19 Nov 2025 10:38:29 +0800 Subject: [PATCH 15/17] Update DeptController.java --- .../com/qiujie/controller/DeptController.java | 73 +++++++++++-------- 1 file changed, 41 insertions(+), 32 deletions(-) diff --git a/hrm/src/main/java/com/qiujie/controller/DeptController.java b/hrm/src/main/java/com/qiujie/controller/DeptController.java index 246b3f1..8ba69e9 100644 --- a/hrm/src/main/java/com/qiujie/controller/DeptController.java +++ b/hrm/src/main/java/com/qiujie/controller/DeptController.java @@ -1,91 +1,100 @@ package com.qiujie.controller; -import com.qiujie.entity.Leave; +import com.qiujie.entity.City; import com.qiujie.dto.ResponseDTO; -import com.qiujie.service.LeaveService; +import com.qiujie.service.CityService; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.util.List; /** •

- • 请假表 前端控制器 + • 前端控制器 •

* • @author qiujie - • @since 2022-03-27 + • @since 2022-03-23 */ @RestController -@RequestMapping("/leave") -public class LeaveController { +@RequestMapping("/city") +public class CityController { @Autowired - private LeaveService leaveService; + private CityService cityService; @ApiOperation("新增") @PostMapping - public ResponseDTO add(@RequestBody Leave leave) { - return this.leaveService.add(leave); + @PreAuthorize("hasAnyAuthority('money:city:add')") + public ResponseDTO add(@RequestBody City city) { + return this.cityService.add(city); } @ApiOperation("逻辑删除") @DeleteMapping("/{id}") + @PreAuthorize("hasAnyAuthority('money:city:delete')") public ResponseDTO delete(@PathVariable Integer id) { - return this.leaveService.delete(id); + return this.cityService.delete(id); } @ApiOperation("批量逻辑删除") @DeleteMapping("/batch/{ids}") + @PreAuthorize("hasAnyAuthority('money:city:delete')") public ResponseDTO deleteBatch(@PathVariable List ids) { - return this.leaveService.deleteBatch(ids); + return this.cityService.deleteBatch(ids); } @ApiOperation("编辑更新") @PutMapping - public ResponseDTO edit(@RequestBody Leave leave) { - return this.leaveService.edit(leave); + @PreAuthorize("hasAnyAuthority('money:city:edit')") + public ResponseDTO edit(@RequestBody City city) { + return this.cityService.edit(city); } @ApiOperation("查询") @GetMapping("/{id}") public ResponseDTO query(@PathVariable Integer id) { - return this.leaveService.query(id); + return this.cityService.query(id); } - - @ApiOperation("获取") - @GetMapping("/{deptId}/{typeNum}") - public ResponseDTO queryByDeptIdAndTypeNum(@PathVariable Integer deptId, @PathVariable Integer typeNum) { - return this.leaveService.queryByDeptIdAndTypeNum(deptId, typeNum); + @ApiOperation("查询所有") + @GetMapping("/all") + public ResponseDTO queryAll() { + return this.cityService.queryAll(); } - @ApiOperation("设置假期") - @PostMapping("/set") - @PreAuthorize("hasAnyAuthority('system:department:setting')") - public ResponseDTO setLeave(@RequestBody Leave leave) { - return this.leaveService.setLeave(leave); + @ApiOperation("条件查询") + @GetMapping + @PreAuthorize("hasAnyAuthority('money:city:list','money:city:search')") + public ResponseDTO list(@RequestParam(defaultValue = "1") Integer current, @RequestParam(defaultValue = "10") Integer size, String name) { + return this.cityService.list(current, size, name); } - @ApiOperation("查询") - @GetMapping("/dept/{id}") - public ResponseDTO queryByDeptId(@PathVariable Integer id) { - return this.leaveService.queryByDeptId(id); + @ApiOperation("数据导出接口") + @GetMapping("/export/{filename}") + @PreAuthorize("hasAnyAuthority('money:city:export')") + public void export(HttpServletResponse response, @PathVariable String filename) throws IOException { + this.cityService.export(response, filename); } - @ApiOperation("获取所有") - @GetMapping("/all") - public ResponseDTO queryAll() { - return this.leaveService.queryAll(); + @ApiOperation("数据导入接口") + @PostMapping("/import") + @PreAuthorize("hasAnyAuthority('money:city:import')") + public ResponseDTO imp(MultipartFile file) throws IOException { + return this.cityService.imp(file); } + } \ No newline at end of file -- 2.34.1 From 020efb0cc0430a3371977d6bc65ccb228838d268 Mon Sep 17 00:00:00 2001 From: pq7sc2z5f <3289822358@qq.com> Date: Wed, 19 Nov 2025 10:42:51 +0800 Subject: [PATCH 16/17] Update DocsController.java --- .../java/com/qiujie/controller/DocsController.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/hrm/src/main/java/com/qiujie/controller/DocsController.java b/hrm/src/main/java/com/qiujie/controller/DocsController.java index 4094934..3f53d0a 100644 --- a/hrm/src/main/java/com/qiujie/controller/DocsController.java +++ b/hrm/src/main/java/com/qiujie/controller/DocsController.java @@ -16,15 +16,11 @@ import java.io.IOException; import java.util.List; /** - • 文件上传接口 - + * 文件上传接口 * - • @Author qiujie - - • @Date 2022/2/24 - - • @Version 1.0 - + * @Author qiujie + * @Date 2022/2/24 + * @Version 1.0 */ @RestController @@ -108,4 +104,4 @@ public class DocsController { 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 247c255be5d325b97eea528cbdcbd4ff9e818296 Mon Sep 17 00:00:00 2001 From: pq7sc2z5f <3289822358@qq.com> Date: Wed, 19 Nov 2025 10:43:44 +0800 Subject: [PATCH 17/17] Update DeptController.java --- .../com/qiujie/controller/DeptController.java | 68 +++++++++---------- 1 file changed, 31 insertions(+), 37 deletions(-) diff --git a/hrm/src/main/java/com/qiujie/controller/DeptController.java b/hrm/src/main/java/com/qiujie/controller/DeptController.java index 8ba69e9..03d28aa 100644 --- a/hrm/src/main/java/com/qiujie/controller/DeptController.java +++ b/hrm/src/main/java/com/qiujie/controller/DeptController.java @@ -1,8 +1,8 @@ package com.qiujie.controller; -import com.qiujie.entity.City; +import com.qiujie.entity.Dept; import com.qiujie.dto.ResponseDTO; -import com.qiujie.service.CityService; +import com.qiujie.service.DeptService; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; @@ -16,85 +16,79 @@ import java.util.List; /** - •

- - • 前端控制器 - - •

- + *

+ * 前端控制器 + *

* - • @author qiujie - - • @since 2022-03-23 - + * @author qiujie + * @since 2022-03-07 */ @RestController -@RequestMapping("/city") -public class CityController { +@RequestMapping("/dept") +public class DeptController { @Autowired - private CityService cityService; + private DeptService deptService; @ApiOperation("新增") @PostMapping - @PreAuthorize("hasAnyAuthority('money:city:add')") - public ResponseDTO add(@RequestBody City city) { - return this.cityService.add(city); + @PreAuthorize("hasAnyAuthority('system:department:add')") + public ResponseDTO add(@RequestBody Dept dept) { + return this.deptService.add(dept); } @ApiOperation("逻辑删除") @DeleteMapping("/{id}") - @PreAuthorize("hasAnyAuthority('money:city:delete')") + @PreAuthorize("hasAnyAuthority('system:department:delete')") public ResponseDTO delete(@PathVariable Integer id) { - return this.cityService.delete(id); + return this.deptService.delete(id); } @ApiOperation("批量逻辑删除") @DeleteMapping("/batch/{ids}") - @PreAuthorize("hasAnyAuthority('money:city:delete')") + @PreAuthorize("hasAnyAuthority('system:department:delete')") public ResponseDTO deleteBatch(@PathVariable List ids) { - return this.cityService.deleteBatch(ids); + return this.deptService.deleteBatch(ids); } @ApiOperation("编辑更新") @PutMapping - @PreAuthorize("hasAnyAuthority('money:city:edit')") - public ResponseDTO edit(@RequestBody City city) { - return this.cityService.edit(city); + @PreAuthorize("hasAnyAuthority('system:department:edit')") + public ResponseDTO edit(@RequestBody Dept dept) { + return this.deptService.edit(dept); } @ApiOperation("查询") @GetMapping("/{id}") public ResponseDTO query(@PathVariable Integer id) { - return this.cityService.query(id); + return this.deptService.query(id); } @ApiOperation("查询所有") @GetMapping("/all") - public ResponseDTO queryAll() { - return this.cityService.queryAll(); + public ResponseDTO queryAll(){ + return this.deptService.queryAll(); } @ApiOperation("条件查询") @GetMapping - @PreAuthorize("hasAnyAuthority('money:city:list','money:city:search')") + @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.cityService.list(current, size, name); + return this.deptService.list(current, size, name); } - @ApiOperation("数据导出接口") @GetMapping("/export/{filename}") - @PreAuthorize("hasAnyAuthority('money:city:export')") - public void export(HttpServletResponse response, @PathVariable String filename) throws IOException { - this.cityService.export(response, filename); + @PreAuthorize("hasAnyAuthority('system:department:export')") + public void export(HttpServletResponse response,@PathVariable String filename) throws Exception { + this.deptService.export(response,filename); } @ApiOperation("数据导入接口") @PostMapping("/import") - @PreAuthorize("hasAnyAuthority('money:city:import')") + @PreAuthorize("hasAnyAuthority('system:department:import')") public ResponseDTO imp(MultipartFile file) throws IOException { - return this.cityService.imp(file); + return this.deptService.imp(file); } +} -} \ No newline at end of file -- 2.34.1