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> page(PlanMonthPageReqVO planMonthPageReqVO){ planMonthPageReqVO.setPlanType(PLAN_TYPE); PageResult page = qualityPlanService.page(planMonthPageReqVO); return success(page); } @GetMapping("/get") @Operation(summary = "信息") public CommonResult get(String id){ QualityPlanDTO data = qualityPlanService.get(id); return success(data); } @PostMapping("/create") @Operation(summary = "保存") public CommonResult 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 update(@RequestBody QualityPlanDTO dto){ if (qualityPlanService.cheack(dto) > 0) { return error(406, "编号重复"); } qualityPlanService.update(dto); return success(true); } @DeleteMapping("/delete") @Operation(summary = "删除") public CommonResult delete(@RequestBody String[] ids){ qualityPlanService.delete(ids); return success(true); } }