选煤厂生产管理平台后台代码
Jay
6 天以前 8d3ff63ab144ad6b48015b01196bc901944a48f9
提交 | 用户 | 时间
8d3ff6 1 package com.iailab.module.pms.coalquality.modules.plan.controller;
J 2
3
4 import com.iailab.framework.common.pojo.CommonResult;
5 import com.iailab.framework.common.pojo.PageResult;
6 import com.iailab.module.pms.coalquality.modules.plan.dto.QualityPlanDTO;
7 import com.iailab.module.pms.coalquality.modules.plan.service.QualityPlanService;
8 import com.iailab.module.pms.coalquality.modules.plan.vo.PlanMonthPageReqVO;
9 import io.swagger.v3.oas.annotations.Operation;
10 import io.swagger.v3.oas.annotations.tags.Tag;
11 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.web.bind.annotation.*;
13
14 import static com.iailab.framework.common.pojo.CommonResult.error;
15 import static com.iailab.framework.common.pojo.CommonResult.success;
16
17 /**
18  * @author PanZhibao
19  * @Description
20  * @createTime 2023年02月04日 14:49:00
21  */
22 @RestController
23 @RequestMapping("/plan/month")
24 @Tag(name ="质量月计划")
25 public class QualityPlanMonthController {
26     @Autowired
27     private QualityPlanService qualityPlanService;
28
29     private final String PLAN_TYPE = "month";
30
31     @GetMapping("/page")
32     public CommonResult<PageResult<QualityPlanDTO>> page(PlanMonthPageReqVO planMonthPageReqVO){
33         planMonthPageReqVO.setPlanType(PLAN_TYPE);
34         PageResult<QualityPlanDTO> page = qualityPlanService.page(planMonthPageReqVO);
35
36         return success(page);
37     }
38
39     @GetMapping("/get")
40     @Operation(summary = "信息")
41     public CommonResult<QualityPlanDTO> get(String id){
42         QualityPlanDTO data = qualityPlanService.get(id);
43         return success(data);
44     }
45
46     @PostMapping("/create")
47     @Operation(summary = "保存")
48     public CommonResult<Boolean> create(@RequestBody QualityPlanDTO dto){
49         if (qualityPlanService.cheack(dto) > 0) {
50             return error(406, "编号重复");
51         }
52         dto.setPlanType(PLAN_TYPE);
53         qualityPlanService.save(dto);
54
55         return success(true);
56     }
57
58     @PutMapping("/update")
59     @Operation(summary = "修改")
60     public CommonResult<Boolean> update(@RequestBody QualityPlanDTO dto){
61         if (qualityPlanService.cheack(dto) > 0) {
62             return error(406, "编号重复");
63         }
64
65         qualityPlanService.update(dto);
66
67         return success(true);
68     }
69
70     @DeleteMapping("/delete")
71     @Operation(summary = "删除")
72     public CommonResult<Boolean> delete(@RequestBody String[] ids){
73
74         qualityPlanService.delete(ids);
75
76         return success(true);
77     }
78 }