zss
2025-01-13 8d85246f061e3da623c7b9eb4e323ee724b4de0b
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
package com.yuanchu.mom.controller;
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuanchu.mom.annotation.ValueAuth;
import com.yuanchu.mom.annotation.ValueClassify;
import com.yuanchu.mom.numgen.NumberGenerator;
import com.yuanchu.mom.pojo.DeviceRecord;
import com.yuanchu.mom.service.DeviceRecordService;
import com.yuanchu.mom.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpServletResponse;
 
/**
 * <p>
 * cnas设备使用记录表 前端控制器
 * </p>
 *
 * @author 江苏鵷雏网络科技有限公司
 * @since 2024-09-21 11:06:47
 */
@Api(tags = "设备使用记录")
@RestController
@RequestMapping("/deviceRecord")
public class DeviceRecordController {
    @Autowired
    private DeviceRecordService deviceRecordService;
 
    @Autowired
    private NumberGenerator<DeviceRecord> numberGenerator;
 
    @ValueClassify("设备使用记录")
    @ApiOperation(value = "备使用记录查询")
    @GetMapping("/deviceRecordPage")
    public Result deviceRecordPage(Integer deviceId, Page page, String sampleCode, String managementNumber) {
        return Result.success(deviceRecordService.deviceRecordPage(deviceId, page, sampleCode, managementNumber));
    }
 
    @ApiOperation(value = "新增")
    @PostMapping("/saveDeviceRecord")
    public Result saveDeviceRecords(@RequestBody DeviceRecord deviceRecord) {
        return Result.success(deviceRecordService.save(deviceRecord));
    }
 
    /**
     * 编辑设备使用记录
     * @param deviceRecord
     * @return
     */
    @ApiOperation(value = "修改")
    @PostMapping("/updateDeviceRecord")
    public Result updateDeviceRecord(@RequestBody DeviceRecord deviceRecord) {
        return Result.success(deviceRecordService.updateById(deviceRecord));
    }
 
    @DeleteMapping("/deleteDeviceRecord")
    public Result deleteDeviceRecords(@RequestParam("id") Integer id) {
        return Result.success(deviceRecordService.removeById(id));
    }
 
    @ApiOperation(value = "设备使用记录导出")
    @GetMapping("/exportUseRecord")
    @ValueAuth
    public void exportUseRecord(Integer deviceId, String exportDate, HttpServletResponse response) throws Exception {
        deviceRecordService.exportUseRecord(deviceId, exportDate, response);
    }
}