hsy
2026-08-28 36fa58c0de255ad56f50a565cbe7a5d93604dd88
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
package com.ruoyi.project.quality.report.controller;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.project.quality.report.domain.InspectionReport;
import com.ruoyi.project.quality.report.service.IInspectionReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.util.Arrays;
 
/**
 * 检测报告 Controller
 */
@RestController
@RequestMapping("/quality/inspectionReport")
public class InspectionReportController {
 
    @Autowired
    private IInspectionReportService inspectionReportService;
 
    /**
     * 查询检测报告列表
     */
    @GetMapping("/listPage")
    public AjaxResult listPage(Page<InspectionReport> page, InspectionReport report) {
        IPage<InspectionReport> iPage = inspectionReportService.listPage(page, report);
        return AjaxResult.success(iPage);
    }
 
    /**
     * 获取检测报告详细信息
     */
    @GetMapping("/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return AjaxResult.success(inspectionReportService.getById(id));
    }
 
    /**
     * 新增检测报告
     */
    @PostMapping
    public AjaxResult add(@RequestBody InspectionReport report) {
        // 默认状态为正常
        if (report.getStatus() == null) {
            report.setStatus("NORMAL");
        }
        return AjaxResult.success(inspectionReportService.save(report));
    }
 
    /**
     * 修改检测报告
     */
    @PutMapping
    public AjaxResult edit(@RequestBody InspectionReport report) {
        return AjaxResult.success(inspectionReportService.updateById(report));
    }
 
    /**
     * 注销(软删除)检测报告
     */
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        for (Long id : ids) {
            InspectionReport report = new InspectionReport();
            report.setId(id);
            report.setStatus("CANCELLED");
            inspectionReportService.updateById(report);
        }
        return AjaxResult.success();
    }
}