TWW
2025-08-08 81aa0cb2a8f563075eef1d4101024c3fd9cb2205
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
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<Attendance> 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<Attendance> list = attendanceService.selectAttendanceList(attendance);
        ExcelUtil<Attendance> util = new ExcelUtil<Attendance>(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));
    }
}