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
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
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
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
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
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
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