package com.ruoyi.personnelManagement.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.aspectj.lang.annotation.Log; import com.ruoyi.framework.aspectj.lang.enums.BusinessType; import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.framework.web.page.TableDataInfo; import com.ruoyi.personnelManagement.pojo.Attendance; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.ruoyi.personnelManagement.service.IAttendanceService; /** * 考勤记录Controller * * @author ruoyi * @date 2025-08-08 */ @RestController @RequestMapping("/attendanceManagement/attendance") @Api(tags = "考勤记录的接口") public class AttendanceController extends BaseController { @Autowired private IAttendanceService attendanceService; /** * 查询考勤记录列表 */ @ApiOperation("查询考勤记录列表") @PreAuthorize("@ss.hasPermi('attendanceManagement:attendance:list')") @GetMapping("/list") public TableDataInfo list(Attendance attendance) { startPage(); List list = attendanceService.selectAttendanceList(attendance); return getDataTable(list); } /** * 导出考勤记录列表 */ @ApiOperation("导出考勤记录列表") @PreAuthorize("@ss.hasPermi('attendanceManagement:attendance:export')") @Log(title = "考勤记录", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, Attendance attendance) { List list = attendanceService.selectAttendanceList(attendance); ExcelUtil util = new ExcelUtil(Attendance.class); util.exportExcel(response, list, "考勤记录数据"); } /** * 获取考勤记录详细信息 */ @ApiOperation("获取考勤记录详细信息") @PreAuthorize("@ss.hasPermi('attendanceManagement:attendance:query')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@ApiParam(value = "考勤记录ID", required = true) @PathVariable("id") Long id) { return success(attendanceService.selectAttendanceById(id)); } /** * 新增考勤记录 */ @ApiOperation("新增考勤记录") @PreAuthorize("@ss.hasPermi('attendanceManagement:attendance:add')") @Log(title = "考勤记录", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@ApiParam(value = "考勤记录实体") @RequestBody Attendance attendance) { return toAjax(attendanceService.insertAttendance(attendance)); } /** * 修改考勤记录 */ @ApiOperation("修改考勤记录") @PreAuthorize("@ss.hasPermi('attendanceManagement:attendance:edit')") @Log(title = "考勤记录", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@ApiParam(value = "考勤记录实体") @RequestBody Attendance attendance) { return toAjax(attendanceService.updateAttendance(attendance)); } /** * 删除考勤记录 */ @ApiOperation("删除考勤记录") @PreAuthorize("@ss.hasPermi('attendanceManagement:attendance:remove')") @Log(title = "考勤记录", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(attendanceService.deleteAttendanceByIds(ids)); } }