选煤厂生产管理平台后台代码
dongyukun
2024-12-11 e16f4e463a6a090798c189a78a4a8f08295d31a6
提交 | 用户 | 时间
7e21bc 1 package com.iailab.module.pms.coalquality.modules.detection.controller.admin;
J 2
3
4 import com.iailab.framework.common.pojo.CommonResult;
5 import com.iailab.framework.common.pojo.PageResult;
6 import com.iailab.iems.common.validator.AssertUtils;
7 import com.iailab.module.pms.coalquality.modules.detection.dto.QualityDetectionDTO;
8 import com.iailab.module.pms.coalquality.modules.detection.service.QualityDetectionService;
9 import com.iailab.module.pms.coalquality.modules.detection.vo.DetectionPageReqVO;
10 import io.swagger.v3.oas.annotations.Operation;
11 import io.swagger.v3.oas.annotations.tags.Tag;
12 import lombok.extern.slf4j.Slf4j;
13 import org.springframework.beans.factory.annotation.Autowired;
14 import org.springframework.web.bind.annotation.*;
15
16 import static com.iailab.framework.common.pojo.CommonResult.success;
17
18
19 /**
20  * 煤质检测
21  *
22  * @author PanZhibao
23  * @Description
24  * @createTime 2023年02月07日 13:15:00
25  */
26 @Slf4j
27 @RestController
e16f4e 28 @RequestMapping("/xmcpms/quality/detection")
7e21bc 29 @Tag(name = "煤质检测")
J 30 public class QualityDetectionController {
31     @Autowired
32     private QualityDetectionService qualityDetectionService;
33
34     private String DICT_CODE = "mzzb";
35
36     @GetMapping("page")
37     @Operation(summary = "分页")
38     public CommonResult<PageResult<QualityDetectionDTO>> page(DetectionPageReqVO reqVO) {
39         PageResult<QualityDetectionDTO> page = qualityDetectionService.page(reqVO);
40
41         return success(page);
42     }
43
44     @GetMapping("{id}")
45     @Operation(summary ="信息")
46     public CommonResult<QualityDetectionDTO> get(@PathVariable("id") String id) {
47         QualityDetectionDTO data = qualityDetectionService.get(id);
48         return success(data);
49     }
50
51     @PostMapping
52     @Operation(summary ="保存")
53     public CommonResult<Boolean> save(@RequestBody QualityDetectionDTO dto) {
54 //        if (qualityDetectionService.cheack(dto) > 0) {
55 //            return new CommonResult().error("编号重复");
56 //        }
57
58         qualityDetectionService.save(dto);
59
60         return success(true);
61     }
62
63     @PutMapping
64     @Operation(summary ="修改")
65     public CommonResult<Boolean> update(@RequestBody QualityDetectionDTO dto) {
66
67 //        if (qualityDetectionService.cheack(dto) > 0) {
68 //            return new CommonResult().error("编号重复");
69 //        }
70         qualityDetectionService.update(dto);
71
72         return success(true);
73     }
74
75     @DeleteMapping
76     @Operation(summary ="删除")
77     public CommonResult<Boolean> delete(@RequestBody String[] ids) {
78         //效验数据
79         AssertUtils.isArrayEmpty(ids, "id");
80
81         qualityDetectionService.delete(ids);
82
83         return success(true);
84     }
85 }