6 天以前 0c23c1e9b9e06ffc570edac28ee45555b772b99c
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
package com.ruoyi.safety.controller;
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.safety.pojo.SafetyInspectionRecord;
import com.ruoyi.safety.service.SafetyInspectionRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
/**
 * Safety inspection record APIs.
 */
@RestController
@Api(tags = "safety-inspection-record")
@RequestMapping("/safety/inspection/record")
public class SafetyInspectionRecordController extends SafetyControllerSupport {
 
    @Autowired
    private SafetyInspectionRecordService recordService;
 
    @Log(title = "safety-inspection-record-list", businessType = BusinessType.OTHER)
    @ApiOperation("query safety inspection records by page")
    @GetMapping("/list")
    public AjaxResult list(Page<SafetyInspectionRecord> page,
                           SafetyInspectionRecord query,
                           @RequestParam(value = "startDate", required = false) String startDate,
                           @RequestParam(value = "endDate", required = false) String endDate,
                           @RequestParam(value = "pageNum", required = false) Long pageNum,
                           @RequestParam(value = "pageSize", required = false) Long pageSize) {
        return AjaxResult.success(recordService.queryPage(buildPage(page, pageNum, pageSize), query, startDate, endDate));
    }
 
    @Log(title = "safety-inspection-record-add", businessType = BusinessType.INSERT)
    @ApiOperation("add safety inspection record")
    @PostMapping("/add")
    public AjaxResult add(@RequestBody SafetyInspectionRecord record) {
        return toAjax(recordService.saveSafety(record));
    }
 
    @Log(title = "safety-inspection-record-update", businessType = BusinessType.UPDATE)
    @ApiOperation("update safety inspection record")
    @PutMapping("/update")
    public AjaxResult update(@RequestBody SafetyInspectionRecord record) {
        return toAjax(recordService.updateSafety(record));
    }
 
    @Log(title = "safety-inspection-record-delete", businessType = BusinessType.DELETE)
    @ApiOperation("delete safety inspection record")
    @DeleteMapping("/delete/{id}")
    public AjaxResult delete(@PathVariable Long id) {
        return toAjax(recordService.deleteSafetyById(id));
    }
 
    @Log(title = "safety-inspection-record-sync", businessType = BusinessType.IMPORT)
    @ApiOperation("sync mock subsystem inspection data")
    @PostMapping("/sync")
    public AjaxResult sync() {
        List<SafetyInspectionRecord> records = recordService.syncMockSubsystemData();
        Map<String, Object> data = new HashMap<String, Object>(2);
        data.put("count", records.size());
        data.put("records", records);
        return AjaxResult.success(data);
    }
}