选煤厂生产管理平台后台代码
Jay
6 天以前 8d3ff63ab144ad6b48015b01196bc901944a48f9
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
74
75
76
77
78
package com.iailab.module.pms.coalquality.modules.plan.controller;
 
 
import com.iailab.framework.common.pojo.CommonResult;
import com.iailab.framework.common.pojo.PageResult;
import com.iailab.module.pms.coalquality.modules.plan.dto.QualityPlanDTO;
import com.iailab.module.pms.coalquality.modules.plan.service.QualityPlanService;
import com.iailab.module.pms.coalquality.modules.plan.vo.PlanMonthPageReqVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import static com.iailab.framework.common.pojo.CommonResult.error;
import static com.iailab.framework.common.pojo.CommonResult.success;
 
/**
 * @author PanZhibao
 * @Description
 * @createTime 2023年02月04日 14:49:00
 */
@RestController
@RequestMapping("/plan/month")
@Tag(name ="质量月计划")
public class QualityPlanMonthController {
    @Autowired
    private QualityPlanService qualityPlanService;
 
    private final String PLAN_TYPE = "month";
 
    @GetMapping("/page")
    public CommonResult<PageResult<QualityPlanDTO>> page(PlanMonthPageReqVO planMonthPageReqVO){
        planMonthPageReqVO.setPlanType(PLAN_TYPE);
        PageResult<QualityPlanDTO> page = qualityPlanService.page(planMonthPageReqVO);
 
        return success(page);
    }
 
    @GetMapping("/get")
    @Operation(summary = "信息")
    public CommonResult<QualityPlanDTO> get(String id){
        QualityPlanDTO data = qualityPlanService.get(id);
        return success(data);
    }
 
    @PostMapping("/create")
    @Operation(summary = "保存")
    public CommonResult<Boolean> create(@RequestBody QualityPlanDTO dto){
        if (qualityPlanService.cheack(dto) > 0) {
            return error(406, "编号重复");
        }
        dto.setPlanType(PLAN_TYPE);
        qualityPlanService.save(dto);
 
        return success(true);
    }
 
    @PutMapping("/update")
    @Operation(summary = "修改")
    public CommonResult<Boolean> update(@RequestBody QualityPlanDTO dto){
        if (qualityPlanService.cheack(dto) > 0) {
            return error(406, "编号重复");
        }
 
        qualityPlanService.update(dto);
 
        return success(true);
    }
 
    @DeleteMapping("/delete")
    @Operation(summary = "删除")
    public CommonResult<Boolean> delete(@RequestBody String[] ids){
 
        qualityPlanService.delete(ids);
 
        return success(true);
    }
}