Commit 0a70bb5cef705a47e18520edbd8a538bc09659bb
1 parent
ba439331
feat(mes): 重构质检方案 Controller/Service/Mapper
- MesQcTemplateController 拆分为三个独立 Controller: MesQcTemplateIndicatorController(/mes/qc/template/indicator) MesQcTemplateItemController(/mes/qc/template/item) - Service 层 get 方法统一返回 DO,JOIN 逻辑移至各 Controller 的 convertXxxRespVO() - MesQcTemplatePageReqVO:types(List) 改为 type(Integer),支持单个检测种类筛选 - MesQcTemplateMapper:FIND_IN_SET 改用 MyBatisUtils.findInSet() - MesQcTemplateItemSaveReqVO:清理 @Schema 描述中冗余括号说明 - 清理所有 TODO @AI 注释
Showing
10 changed files
with
328 additions
and
239 deletions
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/qc/template/MesQcTemplateController.java
| ... | ... | @@ -9,12 +9,6 @@ import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 9 | 9 | import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.MesQcTemplatePageReqVO; |
| 10 | 10 | import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.MesQcTemplateRespVO; |
| 11 | 11 | import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.MesQcTemplateSaveReqVO; |
| 12 | -import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.indicator.MesQcTemplateIndicatorPageReqVO; | |
| 13 | -import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.indicator.MesQcTemplateIndicatorRespVO; | |
| 14 | -import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.indicator.MesQcTemplateIndicatorSaveReqVO; | |
| 15 | -import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.item.MesQcTemplateItemPageReqVO; | |
| 16 | -import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.item.MesQcTemplateItemRespVO; | |
| 17 | -import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.item.MesQcTemplateItemSaveReqVO; | |
| 18 | 12 | import cn.iocoder.yudao.module.mes.dal.dataobject.qc.MesQcTemplateDO; |
| 19 | 13 | import cn.iocoder.yudao.module.mes.service.qc.MesQcTemplateService; |
| 20 | 14 | import io.swagger.v3.oas.annotations.Operation; |
| ... | ... | @@ -33,7 +27,6 @@ import java.util.List; |
| 33 | 27 | import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
| 34 | 28 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 35 | 29 | |
| 36 | -// TODO @AI:拆分为多个 controller,和别的模块; | |
| 37 | 30 | @Tag(name = "管理后台 - MES 质检方案") |
| 38 | 31 | @RestController |
| 39 | 32 | @RequestMapping("/mes/qc/template") |
| ... | ... | @@ -43,8 +36,6 @@ public class MesQcTemplateController { |
| 43 | 36 | @Resource |
| 44 | 37 | private MesQcTemplateService templateService; |
| 45 | 38 | |
| 46 | - // ========== 质检方案主表 ========== | |
| 47 | - | |
| 48 | 39 | @PostMapping("/create") |
| 49 | 40 | @Operation(summary = "创建质检方案") |
| 50 | 41 | @PreAuthorize("@ss.hasPermission('mes:qc-template:create')") |
| ... | ... | @@ -74,16 +65,16 @@ public class MesQcTemplateController { |
| 74 | 65 | @Parameter(name = "id", description = "编号", required = true, example = "1024") |
| 75 | 66 | @PreAuthorize("@ss.hasPermission('mes:qc-template:query')") |
| 76 | 67 | public CommonResult<MesQcTemplateRespVO> getTemplate(@RequestParam("id") Long id) { |
| 77 | - // TODO @AI:service 只返回 do;数据拼接放在 controller 里; | |
| 78 | - return success(templateService.getTemplate(id)); | |
| 68 | + MesQcTemplateDO template = templateService.getTemplate(id); | |
| 69 | + return success(BeanUtils.toBean(template, MesQcTemplateRespVO.class)); | |
| 79 | 70 | } |
| 80 | 71 | |
| 81 | 72 | @GetMapping("/page") |
| 82 | 73 | @Operation(summary = "获得质检方案分页") |
| 83 | 74 | @PreAuthorize("@ss.hasPermission('mes:qc-template:query')") |
| 84 | 75 | public CommonResult<PageResult<MesQcTemplateRespVO>> getTemplatePage(@Valid MesQcTemplatePageReqVO pageReqVO) { |
| 85 | - // TODO @AI:service 只返回 do;数据拼接放在 controller 里; | |
| 86 | - return success(templateService.getTemplatePage(pageReqVO)); | |
| 76 | + PageResult<MesQcTemplateDO> pageResult = templateService.getTemplatePage(pageReqVO); | |
| 77 | + return success(BeanUtils.toBean(pageResult, MesQcTemplateRespVO.class)); | |
| 87 | 78 | } |
| 88 | 79 | |
| 89 | 80 | @GetMapping("/simple-list") |
| ... | ... | @@ -100,101 +91,9 @@ public class MesQcTemplateController { |
| 100 | 91 | public void exportTemplateExcel(@Valid MesQcTemplatePageReqVO pageReqVO, |
| 101 | 92 | HttpServletResponse response) throws IOException { |
| 102 | 93 | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| 103 | - List<MesQcTemplateRespVO> list = templateService.getTemplatePage(pageReqVO).getList(); | |
| 104 | - // TODO @AI:service 只返回 do;数据拼接放在 controller 里; | |
| 105 | - ExcelUtils.write(response, "质检方案.xls", "数据", MesQcTemplateRespVO.class, list); | |
| 106 | - } | |
| 107 | - | |
| 108 | - // ========== 质检方案-检测指标项 ========== | |
| 109 | - | |
| 110 | - // TODO @AI:是不是拆分成独立的 controller;类似别的模块 | |
| 111 | - | |
| 112 | - @PostMapping("/indicator/create") | |
| 113 | - @Operation(summary = "创建质检方案-检测指标项") | |
| 114 | - @PreAuthorize("@ss.hasPermission('mes:qc-template:create')") | |
| 115 | - public CommonResult<Long> createTemplateIndicator(@Valid @RequestBody MesQcTemplateIndicatorSaveReqVO createReqVO) { | |
| 116 | - return success(templateService.createTemplateIndicator(createReqVO)); | |
| 117 | - } | |
| 118 | - | |
| 119 | - @PutMapping("/indicator/update") | |
| 120 | - @Operation(summary = "更新质检方案-检测指标项") | |
| 121 | - @PreAuthorize("@ss.hasPermission('mes:qc-template:update')") | |
| 122 | - public CommonResult<Boolean> updateTemplateIndicator(@Valid @RequestBody MesQcTemplateIndicatorSaveReqVO updateReqVO) { | |
| 123 | - templateService.updateTemplateIndicator(updateReqVO); | |
| 124 | - return success(true); | |
| 125 | - } | |
| 126 | - | |
| 127 | - @DeleteMapping("/indicator/delete") | |
| 128 | - @Operation(summary = "删除质检方案-检测指标项") | |
| 129 | - @Parameter(name = "id", description = "编号", required = true) | |
| 130 | - @PreAuthorize("@ss.hasPermission('mes:qc-template:update')") | |
| 131 | - public CommonResult<Boolean> deleteTemplateIndicator(@RequestParam("id") Long id) { | |
| 132 | - templateService.deleteTemplateIndicator(id); | |
| 133 | - return success(true); | |
| 134 | - } | |
| 135 | - | |
| 136 | - @GetMapping("/indicator/get") | |
| 137 | - @Operation(summary = "获得质检方案-检测指标项") | |
| 138 | - @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 139 | - @PreAuthorize("@ss.hasPermission('mes:qc-template:query')") | |
| 140 | - public CommonResult<MesQcTemplateIndicatorRespVO> getTemplateIndicator(@RequestParam("id") Long id) { | |
| 141 | - // TODO @AI:service 只返回 do;数据拼接放在 controller 里; | |
| 142 | - return success(templateService.getTemplateIndicator(id)); | |
| 143 | - } | |
| 144 | - | |
| 145 | - @GetMapping("/indicator/page") | |
| 146 | - @Operation(summary = "获得质检方案-检测指标项分页") | |
| 147 | - @PreAuthorize("@ss.hasPermission('mes:qc-template:query')") | |
| 148 | - public CommonResult<PageResult<MesQcTemplateIndicatorRespVO>> getTemplateIndicatorPage( | |
| 149 | - @Valid MesQcTemplateIndicatorPageReqVO pageReqVO) { | |
| 150 | - // TODO @AI:service 只返回 do;数据拼接放在 controller 里; | |
| 151 | - return success(templateService.getTemplateIndicatorPage(pageReqVO)); | |
| 152 | - } | |
| 153 | - | |
| 154 | - // ========== 质检方案-产品关联 ========== | |
| 155 | - | |
| 156 | - // TODO @AI:是不是拆分成独立的 controller;类似别的模块 | |
| 157 | - | |
| 158 | - @PostMapping("/item/create") | |
| 159 | - @Operation(summary = "创建质检方案-产品关联") | |
| 160 | - @PreAuthorize("@ss.hasPermission('mes:qc-template:create')") | |
| 161 | - public CommonResult<Long> createTemplateItem(@Valid @RequestBody MesQcTemplateItemSaveReqVO createReqVO) { | |
| 162 | - return success(templateService.createTemplateItem(createReqVO)); | |
| 163 | - } | |
| 164 | - | |
| 165 | - @PutMapping("/item/update") | |
| 166 | - @Operation(summary = "更新质检方案-产品关联") | |
| 167 | - @PreAuthorize("@ss.hasPermission('mes:qc-template:update')") | |
| 168 | - public CommonResult<Boolean> updateTemplateItem(@Valid @RequestBody MesQcTemplateItemSaveReqVO updateReqVO) { | |
| 169 | - templateService.updateTemplateItem(updateReqVO); | |
| 170 | - return success(true); | |
| 171 | - } | |
| 172 | - | |
| 173 | - @DeleteMapping("/item/delete") | |
| 174 | - @Operation(summary = "删除质检方案-产品关联") | |
| 175 | - @Parameter(name = "id", description = "编号", required = true) | |
| 176 | - @PreAuthorize("@ss.hasPermission('mes:qc-template:update')") | |
| 177 | - public CommonResult<Boolean> deleteTemplateItem(@RequestParam("id") Long id) { | |
| 178 | - templateService.deleteTemplateItem(id); | |
| 179 | - return success(true); | |
| 180 | - } | |
| 181 | - | |
| 182 | - @GetMapping("/item/get") | |
| 183 | - @Operation(summary = "获得质检方案-产品关联") | |
| 184 | - @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 185 | - @PreAuthorize("@ss.hasPermission('mes:qc-template:query')") | |
| 186 | - public CommonResult<MesQcTemplateItemRespVO> getTemplateItem(@RequestParam("id") Long id) { | |
| 187 | - // TODO @AI:service 只返回 do;数据拼接放在 controller 里; | |
| 188 | - return success(templateService.getTemplateItem(id)); | |
| 189 | - } | |
| 190 | - | |
| 191 | - @GetMapping("/item/page") | |
| 192 | - @Operation(summary = "获得质检方案-产品关联分页") | |
| 193 | - @PreAuthorize("@ss.hasPermission('mes:qc-template:query')") | |
| 194 | - public CommonResult<PageResult<MesQcTemplateItemRespVO>> getTemplateItemPage( | |
| 195 | - @Valid MesQcTemplateItemPageReqVO pageReqVO) { | |
| 196 | - // TODO @AI:service 只返回 do;数据拼接放在 controller 里; | |
| 197 | - return success(templateService.getTemplateItemPage(pageReqVO)); | |
| 94 | + List<MesQcTemplateDO> list = templateService.getTemplatePage(pageReqVO).getList(); | |
| 95 | + ExcelUtils.write(response, "质检方案.xls", "数据", MesQcTemplateRespVO.class, | |
| 96 | + BeanUtils.toBean(list, MesQcTemplateRespVO.class)); | |
| 198 | 97 | } |
| 199 | 98 | |
| 200 | 99 | } | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/qc/template/MesQcTemplateIndicatorController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.qc.template; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 6 | +import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.indicator.MesQcTemplateIndicatorPageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.indicator.MesQcTemplateIndicatorRespVO; | |
| 8 | +import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.indicator.MesQcTemplateIndicatorSaveReqVO; | |
| 9 | +import cn.iocoder.yudao.module.mes.dal.dataobject.md.unitmeasure.MesMdUnitMeasureDO; | |
| 10 | +import cn.iocoder.yudao.module.mes.dal.dataobject.qc.MesQcIndicatorDO; | |
| 11 | +import cn.iocoder.yudao.module.mes.dal.dataobject.qc.MesQcTemplateIndicatorDO; | |
| 12 | +import cn.iocoder.yudao.module.mes.dal.mysql.md.unitmeasure.MesMdUnitMeasureMapper; | |
| 13 | +import cn.iocoder.yudao.module.mes.dal.mysql.qc.MesQcIndicatorMapper; | |
| 14 | +import cn.iocoder.yudao.module.mes.service.qc.MesQcTemplateService; | |
| 15 | +import io.swagger.v3.oas.annotations.Operation; | |
| 16 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 17 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 18 | +import jakarta.annotation.Resource; | |
| 19 | +import jakarta.validation.Valid; | |
| 20 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 21 | +import org.springframework.validation.annotation.Validated; | |
| 22 | +import org.springframework.web.bind.annotation.*; | |
| 23 | + | |
| 24 | +import java.util.List; | |
| 25 | +import java.util.stream.Collectors; | |
| 26 | + | |
| 27 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 28 | + | |
| 29 | +@Tag(name = "管理后台 - MES 质检方案-检测指标项") | |
| 30 | +@RestController | |
| 31 | +@RequestMapping("/mes/qc/template/indicator") | |
| 32 | +@Validated | |
| 33 | +public class MesQcTemplateIndicatorController { | |
| 34 | + | |
| 35 | + @Resource | |
| 36 | + private MesQcTemplateService templateService; | |
| 37 | + @Resource | |
| 38 | + private MesQcIndicatorMapper indicatorMapper; | |
| 39 | + @Resource | |
| 40 | + private MesMdUnitMeasureMapper unitMeasureMapper; | |
| 41 | + | |
| 42 | + @PostMapping("/create") | |
| 43 | + @Operation(summary = "创建质检方案-检测指标项") | |
| 44 | + @PreAuthorize("@ss.hasPermission('mes:qc-template:create')") | |
| 45 | + public CommonResult<Long> createTemplateIndicator(@Valid @RequestBody MesQcTemplateIndicatorSaveReqVO createReqVO) { | |
| 46 | + return success(templateService.createTemplateIndicator(createReqVO)); | |
| 47 | + } | |
| 48 | + | |
| 49 | + @PutMapping("/update") | |
| 50 | + @Operation(summary = "更新质检方案-检测指标项") | |
| 51 | + @PreAuthorize("@ss.hasPermission('mes:qc-template:update')") | |
| 52 | + public CommonResult<Boolean> updateTemplateIndicator(@Valid @RequestBody MesQcTemplateIndicatorSaveReqVO updateReqVO) { | |
| 53 | + templateService.updateTemplateIndicator(updateReqVO); | |
| 54 | + return success(true); | |
| 55 | + } | |
| 56 | + | |
| 57 | + @DeleteMapping("/delete") | |
| 58 | + @Operation(summary = "删除质检方案-检测指标项") | |
| 59 | + @Parameter(name = "id", description = "编号", required = true) | |
| 60 | + @PreAuthorize("@ss.hasPermission('mes:qc-template:update')") | |
| 61 | + public CommonResult<Boolean> deleteTemplateIndicator(@RequestParam("id") Long id) { | |
| 62 | + templateService.deleteTemplateIndicator(id); | |
| 63 | + return success(true); | |
| 64 | + } | |
| 65 | + | |
| 66 | + @GetMapping("/get") | |
| 67 | + @Operation(summary = "获得质检方案-检测指标项") | |
| 68 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 69 | + @PreAuthorize("@ss.hasPermission('mes:qc-template:query')") | |
| 70 | + public CommonResult<MesQcTemplateIndicatorRespVO> getTemplateIndicator(@RequestParam("id") Long id) { | |
| 71 | + MesQcTemplateIndicatorDO do0 = templateService.getTemplateIndicator(id); | |
| 72 | + return success(convertIndicatorRespVO(do0)); | |
| 73 | + } | |
| 74 | + | |
| 75 | + @GetMapping("/page") | |
| 76 | + @Operation(summary = "获得质检方案-检测指标项分页") | |
| 77 | + @PreAuthorize("@ss.hasPermission('mes:qc-template:query')") | |
| 78 | + public CommonResult<PageResult<MesQcTemplateIndicatorRespVO>> getTemplateIndicatorPage( | |
| 79 | + @Valid MesQcTemplateIndicatorPageReqVO pageReqVO) { | |
| 80 | + PageResult<MesQcTemplateIndicatorDO> pageResult = templateService.getTemplateIndicatorPage(pageReqVO); | |
| 81 | + List<MesQcTemplateIndicatorRespVO> voList = pageResult.getList().stream() | |
| 82 | + .map(this::convertIndicatorRespVO) | |
| 83 | + .collect(Collectors.toList()); | |
| 84 | + return success(new PageResult<>(voList, pageResult.getTotal())); | |
| 85 | + } | |
| 86 | + | |
| 87 | + // TODO @AI:参考别的模块,buildVO;包括注释; | |
| 88 | + /** | |
| 89 | + * DO → RespVO:JOIN mes_qc_indicator 补充检测项信息,JOIN mes_md_unit_measure 补充单位名称 | |
| 90 | + */ | |
| 91 | + private MesQcTemplateIndicatorRespVO convertIndicatorRespVO(MesQcTemplateIndicatorDO do0) { | |
| 92 | + // TODO @AI:应该是批量的操作; | |
| 93 | + if (do0 == null) { | |
| 94 | + return null; | |
| 95 | + } | |
| 96 | + MesQcTemplateIndicatorRespVO vo = BeanUtils.toBean(do0, MesQcTemplateIndicatorRespVO.class); | |
| 97 | + // JOIN 质检指标 | |
| 98 | + if (do0.getIndicatorId() != null) { | |
| 99 | + MesQcIndicatorDO indicator = indicatorMapper.selectById(do0.getIndicatorId()); | |
| 100 | + if (indicator != null) { | |
| 101 | + vo.setIndicatorCode(indicator.getCode()); | |
| 102 | + vo.setIndicatorName(indicator.getName()); | |
| 103 | + vo.setIndicatorType(indicator.getType()); | |
| 104 | + vo.setIndicatorTool(indicator.getTool()); | |
| 105 | + } | |
| 106 | + } | |
| 107 | + // JOIN 计量单位 | |
| 108 | + if (do0.getUnitMeasureId() != null) { | |
| 109 | + MesMdUnitMeasureDO unit = unitMeasureMapper.selectById(do0.getUnitMeasureId()); | |
| 110 | + if (unit != null) { | |
| 111 | + vo.setUnitMeasureName(unit.getName()); | |
| 112 | + } | |
| 113 | + } | |
| 114 | + return vo; | |
| 115 | + } | |
| 116 | + | |
| 117 | +} | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/qc/template/MesQcTemplateItemController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.qc.template; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 6 | +import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.item.MesQcTemplateItemPageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.item.MesQcTemplateItemRespVO; | |
| 8 | +import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.item.MesQcTemplateItemSaveReqVO; | |
| 9 | +import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; | |
| 10 | +import cn.iocoder.yudao.module.mes.dal.dataobject.md.unitmeasure.MesMdUnitMeasureDO; | |
| 11 | +import cn.iocoder.yudao.module.mes.dal.dataobject.qc.MesQcTemplateItemDO; | |
| 12 | +import cn.iocoder.yudao.module.mes.dal.mysql.md.item.MesMdItemMapper; | |
| 13 | +import cn.iocoder.yudao.module.mes.dal.mysql.md.unitmeasure.MesMdUnitMeasureMapper; | |
| 14 | +import cn.iocoder.yudao.module.mes.service.qc.MesQcTemplateService; | |
| 15 | +import io.swagger.v3.oas.annotations.Operation; | |
| 16 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 17 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 18 | +import jakarta.annotation.Resource; | |
| 19 | +import jakarta.validation.Valid; | |
| 20 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 21 | +import org.springframework.validation.annotation.Validated; | |
| 22 | +import org.springframework.web.bind.annotation.*; | |
| 23 | + | |
| 24 | +import java.util.List; | |
| 25 | +import java.util.stream.Collectors; | |
| 26 | + | |
| 27 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 28 | + | |
| 29 | +@Tag(name = "管理后台 - MES 质检方案-产品关联") | |
| 30 | +@RestController | |
| 31 | +@RequestMapping("/mes/qc/template/item") | |
| 32 | +@Validated | |
| 33 | +public class MesQcTemplateItemController { | |
| 34 | + | |
| 35 | + @Resource | |
| 36 | + private MesQcTemplateService templateService; | |
| 37 | + @Resource | |
| 38 | + private MesMdItemMapper mdItemMapper; | |
| 39 | + @Resource | |
| 40 | + private MesMdUnitMeasureMapper unitMeasureMapper; | |
| 41 | + | |
| 42 | + @PostMapping("/create") | |
| 43 | + @Operation(summary = "创建质检方案-产品关联") | |
| 44 | + @PreAuthorize("@ss.hasPermission('mes:qc-template:create')") | |
| 45 | + public CommonResult<Long> createTemplateItem(@Valid @RequestBody MesQcTemplateItemSaveReqVO createReqVO) { | |
| 46 | + return success(templateService.createTemplateItem(createReqVO)); | |
| 47 | + } | |
| 48 | + | |
| 49 | + @PutMapping("/update") | |
| 50 | + @Operation(summary = "更新质检方案-产品关联") | |
| 51 | + @PreAuthorize("@ss.hasPermission('mes:qc-template:update')") | |
| 52 | + public CommonResult<Boolean> updateTemplateItem(@Valid @RequestBody MesQcTemplateItemSaveReqVO updateReqVO) { | |
| 53 | + templateService.updateTemplateItem(updateReqVO); | |
| 54 | + return success(true); | |
| 55 | + } | |
| 56 | + | |
| 57 | + @DeleteMapping("/delete") | |
| 58 | + @Operation(summary = "删除质检方案-产品关联") | |
| 59 | + @Parameter(name = "id", description = "编号", required = true) | |
| 60 | + @PreAuthorize("@ss.hasPermission('mes:qc-template:update')") | |
| 61 | + public CommonResult<Boolean> deleteTemplateItem(@RequestParam("id") Long id) { | |
| 62 | + templateService.deleteTemplateItem(id); | |
| 63 | + return success(true); | |
| 64 | + } | |
| 65 | + | |
| 66 | + @GetMapping("/get") | |
| 67 | + @Operation(summary = "获得质检方案-产品关联") | |
| 68 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 69 | + @PreAuthorize("@ss.hasPermission('mes:qc-template:query')") | |
| 70 | + public CommonResult<MesQcTemplateItemRespVO> getTemplateItem(@RequestParam("id") Long id) { | |
| 71 | + MesQcTemplateItemDO do0 = templateService.getTemplateItem(id); | |
| 72 | + return success(convertItemRespVO(do0)); | |
| 73 | + } | |
| 74 | + | |
| 75 | + @GetMapping("/page") | |
| 76 | + @Operation(summary = "获得质检方案-产品关联分页") | |
| 77 | + @PreAuthorize("@ss.hasPermission('mes:qc-template:query')") | |
| 78 | + public CommonResult<PageResult<MesQcTemplateItemRespVO>> getTemplateItemPage( | |
| 79 | + @Valid MesQcTemplateItemPageReqVO pageReqVO) { | |
| 80 | + PageResult<MesQcTemplateItemDO> pageResult = templateService.getTemplateItemPage(pageReqVO); | |
| 81 | + List<MesQcTemplateItemRespVO> voList = pageResult.getList().stream() | |
| 82 | + .map(this::convertItemRespVO) | |
| 83 | + .collect(Collectors.toList()); | |
| 84 | + return success(new PageResult<>(voList, pageResult.getTotal())); | |
| 85 | + } | |
| 86 | + | |
| 87 | + // TODO @AI:参考别的模块,buildVO;包括注释; | |
| 88 | + // 质检方案-产品关联的 VO 构建方法 | |
| 89 | + /** | |
| 90 | + * DO → RespVO:JOIN mes_md_item 补充物料信息,JOIN mes_md_unit_measure 补充单位名称 | |
| 91 | + */ | |
| 92 | + private MesQcTemplateItemRespVO convertItemRespVO(MesQcTemplateItemDO do0) { | |
| 93 | + if (do0 == null) { | |
| 94 | + return null; | |
| 95 | + } | |
| 96 | + MesQcTemplateItemRespVO vo = BeanUtils.toBean(do0, MesQcTemplateItemRespVO.class); | |
| 97 | + if (do0.getItemId() != null) { | |
| 98 | + MesMdItemDO item = mdItemMapper.selectById(do0.getItemId()); | |
| 99 | + if (item != null) { | |
| 100 | + vo.setItemCode(item.getCode()); | |
| 101 | + vo.setItemName(item.getName()); | |
| 102 | + vo.setSpecification(item.getSpecification()); | |
| 103 | + // 查询计量单位名称 | |
| 104 | + if (item.getUnitMeasureId() != null) { | |
| 105 | + MesMdUnitMeasureDO unit = unitMeasureMapper.selectById(item.getUnitMeasureId()); | |
| 106 | + if (unit != null) { | |
| 107 | + vo.setUnitMeasureName(unit.getName()); | |
| 108 | + } | |
| 109 | + } | |
| 110 | + } | |
| 111 | + } | |
| 112 | + return vo; | |
| 113 | + } | |
| 114 | + | |
| 115 | +} | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/qc/template/vo/MesQcTemplatePageReqVO.java
| ... | ... | @@ -6,8 +6,6 @@ import lombok.Data; |
| 6 | 6 | import lombok.EqualsAndHashCode; |
| 7 | 7 | import lombok.ToString; |
| 8 | 8 | |
| 9 | -import java.util.List; | |
| 10 | - | |
| 11 | 9 | @Schema(description = "管理后台 - MES 质检方案分页 Request VO") |
| 12 | 10 | @Data |
| 13 | 11 | @EqualsAndHashCode(callSuper = true) |
| ... | ... | @@ -20,8 +18,8 @@ public class MesQcTemplatePageReqVO extends PageParam { |
| 20 | 18 | @Schema(description = "方案名称", example = "出货检验") |
| 21 | 19 | private String name; |
| 22 | 20 | |
| 23 | - @Schema(description = "检测种类", example = "[1, 3]") | |
| 24 | - private List<Integer> types; | |
| 21 | + @Schema(description = "检测种类", example = "1") | |
| 22 | + private Integer type; | |
| 25 | 23 | |
| 26 | 24 | @Schema(description = "是否启用", example = "true") |
| 27 | 25 | private Boolean enableFlag; | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/qc/template/vo/item/MesQcTemplateItemSaveReqVO.java
| ... | ... | @@ -24,16 +24,13 @@ public class MesQcTemplateItemSaveReqVO { |
| 24 | 24 | @Schema(description = "最低检测数", example = "5") |
| 25 | 25 | private Integer quantityCheck; |
| 26 | 26 | |
| 27 | - // TODO @AI:VO 里,(0=不启用) 去掉 | |
| 28 | - @Schema(description = "最大不合格数(0=不启用)", example = "0") | |
| 27 | + @Schema(description = "最大不合格数", example = "0") | |
| 29 | 28 | private Integer quantityUnqualified; |
| 30 | 29 | |
| 31 | - // TODO @AI:VO 里,(0=不允许) 去掉 | |
| 32 | - @Schema(description = "最大致命缺陷率(%,0=不允许)", example = "0") | |
| 30 | + @Schema(description = "最大致命缺陷率(%)", example = "0") | |
| 33 | 31 | private BigDecimal criticalRate; |
| 34 | 32 | |
| 35 | - // TODO @AI:VO 里,(0=不允许) 去掉 | |
| 36 | - @Schema(description = "最大严重缺陷率(%,0=不允许)", example = "0") | |
| 33 | + @Schema(description = "最大严重缺陷率(%)", example = "0") | |
| 37 | 34 | private BigDecimal majorRate; |
| 38 | 35 | |
| 39 | 36 | @Schema(description = "最大轻微缺陷率(%)", example = "100") | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/qc/MesQcTemplateMapper.java
| ... | ... | @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.mes.dal.mysql.qc; |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | +import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils; | |
| 6 | 7 | import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.MesQcTemplatePageReqVO; |
| 7 | 8 | import cn.iocoder.yudao.module.mes.dal.dataobject.qc.MesQcTemplateDO; |
| 8 | 9 | import org.apache.ibatis.annotations.Mapper; |
| ... | ... | @@ -22,10 +23,8 @@ public interface MesQcTemplateMapper extends BaseMapperX<MesQcTemplateDO> { |
| 22 | 23 | .likeIfPresent(MesQcTemplateDO::getCode, reqVO.getCode()) |
| 23 | 24 | .likeIfPresent(MesQcTemplateDO::getName, reqVO.getName()) |
| 24 | 25 | .orderByDesc(MesQcTemplateDO::getId); |
| 25 | - // types: 用 FIND_IN_SET 精确匹配逗号分隔字段(取第一个值过滤) | |
| 26 | - // TODO @AI:MyBatisUtils 的 findInSet | |
| 27 | - if (reqVO.getTypes() != null && !reqVO.getTypes().isEmpty()) { | |
| 28 | - query.apply("FIND_IN_SET({0}, types) > 0", reqVO.getTypes().get(0)); | |
| 26 | + if (reqVO.getType() != null) { | |
| 27 | + query.apply(MyBatisUtils.findInSet("types", reqVO.getType())); | |
| 29 | 28 | } |
| 30 | 29 | query.eqIfPresent(MesQcTemplateDO::getEnableFlag, reqVO.getEnableFlag()); |
| 31 | 30 | return selectPage(reqVO, query); | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/enums/ErrorCodeConstants.java
| ... | ... | @@ -146,6 +146,21 @@ public interface ErrorCodeConstants { |
| 146 | 146 | |
| 147 | 147 | // ========== MES 生产管理-工艺路线(1-040-501-000) ========== |
| 148 | 148 | ErrorCode PRO_ROUTE_NOT_EXISTS = new ErrorCode(1_040_501_000, "工艺路线不存在"); |
| 149 | + ErrorCode PRO_ROUTE_CODE_DUPLICATE = new ErrorCode(1_040_501_001, "工艺路线编码已存在"); | |
| 150 | + ErrorCode PRO_ROUTE_ENABLE_NO_PROCESS = new ErrorCode(1_040_501_002, "请先添加组成工序"); | |
| 151 | + ErrorCode PRO_ROUTE_ENABLE_NO_KEY_PROCESS = new ErrorCode(1_040_501_003, "工艺路线必须要有关键工序"); | |
| 152 | + ErrorCode PRO_ROUTE_ENABLE_PRODUCT_NO_BOM = new ErrorCode(1_040_501_004, "产品 {} 未配置工序的 BOM 消耗"); | |
| 153 | + // ========== MES 生产管理-工艺路线工序(1-040-501-100) ========== | |
| 154 | + ErrorCode PRO_ROUTE_PROCESS_NOT_EXISTS = new ErrorCode(1_040_501_100, "工艺路线工序不存在"); | |
| 155 | + ErrorCode PRO_ROUTE_PROCESS_SORT_DUPLICATE = new ErrorCode(1_040_501_101, "序号已存在"); | |
| 156 | + ErrorCode PRO_ROUTE_PROCESS_DUPLICATE = new ErrorCode(1_040_501_102, "不能重复添加工序"); | |
| 157 | + ErrorCode PRO_ROUTE_PROCESS_KEY_DUPLICATE = new ErrorCode(1_040_501_103, "当前工艺路线已经指定过关键工序"); | |
| 158 | + // ========== MES 生产管理-工艺路线产品(1-040-501-200) ========== | |
| 159 | + ErrorCode PRO_ROUTE_PRODUCT_NOT_EXISTS = new ErrorCode(1_040_501_200, "工艺路线产品不存在"); | |
| 160 | + ErrorCode PRO_ROUTE_PRODUCT_ITEM_DUPLICATE = new ErrorCode(1_040_501_201, "此产品已配置了工艺路线"); | |
| 161 | + // ========== MES 生产管理-工艺路线产品BOM(1-040-501-300) ========== | |
| 162 | + ErrorCode PRO_ROUTE_PRODUCT_BOM_NOT_EXISTS = new ErrorCode(1_040_501_300, "工艺路线产品 BOM 不存在"); | |
| 163 | + ErrorCode PRO_ROUTE_PRODUCT_BOM_DUPLICATE = new ErrorCode(1_040_501_301, "当前 BOM 物料在此工序已经配置过"); | |
| 149 | 164 | |
| 150 | 165 | // ========== MES 生产管理-生产工单(1-040-502-000) ========== |
| 151 | 166 | ErrorCode PRO_WORK_ORDER_NOT_EXISTS = new ErrorCode(1_040_502_000, "生产工单不存在"); | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/enums/pro/MesProLinkTypeEnum.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.enums.pro; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.core.ArrayValuable; | |
| 4 | +import lombok.AllArgsConstructor; | |
| 5 | +import lombok.Getter; | |
| 6 | + | |
| 7 | +import java.util.Arrays; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * MES 工序关系类型枚举 | |
| 11 | + * | |
| 12 | + * @author 芋道源码 | |
| 13 | + */ | |
| 14 | +@Getter | |
| 15 | +@AllArgsConstructor | |
| 16 | +public enum MesProLinkTypeEnum implements ArrayValuable<Integer> { | |
| 17 | + | |
| 18 | + // TODO @AI:START_START,类似这样的缩写; | |
| 19 | + SS(0, "开始-开始"), | |
| 20 | + FF(1, "结束-结束"), | |
| 21 | + SF(2, "开始-结束"), | |
| 22 | + FS(3, "结束-开始"); | |
| 23 | + | |
| 24 | + public static final Integer[] ARRAYS = Arrays.stream(values()).map(MesProLinkTypeEnum::getType).toArray(Integer[]::new); | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * 类型值 | |
| 28 | + */ | |
| 29 | + private final Integer type; | |
| 30 | + /** | |
| 31 | + * 类型名 | |
| 32 | + */ | |
| 33 | + private final String name; | |
| 34 | + | |
| 35 | + @Override | |
| 36 | + public Integer[] array() { | |
| 37 | + return ARRAYS; | |
| 38 | + } | |
| 39 | + | |
| 40 | +} | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/qc/MesQcTemplateService.java
| ... | ... | @@ -2,15 +2,14 @@ package cn.iocoder.yudao.module.mes.service.qc; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.MesQcTemplatePageReqVO; |
| 5 | -import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.MesQcTemplateRespVO; | |
| 6 | 5 | import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.MesQcTemplateSaveReqVO; |
| 7 | 6 | import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.indicator.MesQcTemplateIndicatorPageReqVO; |
| 8 | -import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.indicator.MesQcTemplateIndicatorRespVO; | |
| 9 | 7 | import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.indicator.MesQcTemplateIndicatorSaveReqVO; |
| 10 | 8 | import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.item.MesQcTemplateItemPageReqVO; |
| 11 | -import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.item.MesQcTemplateItemRespVO; | |
| 12 | 9 | import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.item.MesQcTemplateItemSaveReqVO; |
| 13 | 10 | import cn.iocoder.yudao.module.mes.dal.dataobject.qc.MesQcTemplateDO; |
| 11 | +import cn.iocoder.yudao.module.mes.dal.dataobject.qc.MesQcTemplateIndicatorDO; | |
| 12 | +import cn.iocoder.yudao.module.mes.dal.dataobject.qc.MesQcTemplateItemDO; | |
| 14 | 13 | import jakarta.validation.Valid; |
| 15 | 14 | |
| 16 | 15 | import java.util.Collection; |
| ... | ... | @@ -54,9 +53,9 @@ public interface MesQcTemplateService { |
| 54 | 53 | * 获得质检方案 |
| 55 | 54 | * |
| 56 | 55 | * @param id 编号 |
| 57 | - * @return 质检方案 RespVO(含 types List、enableFlag Boolean) | |
| 56 | + * @return 质检方案 | |
| 58 | 57 | */ |
| 59 | - MesQcTemplateRespVO getTemplate(Long id); | |
| 58 | + MesQcTemplateDO getTemplate(Long id); | |
| 60 | 59 | |
| 61 | 60 | /** |
| 62 | 61 | * 获得质检方案分页 |
| ... | ... | @@ -64,12 +63,12 @@ public interface MesQcTemplateService { |
| 64 | 63 | * @param pageReqVO 分页查询 |
| 65 | 64 | * @return 质检方案分页 |
| 66 | 65 | */ |
| 67 | - PageResult<MesQcTemplateRespVO> getTemplatePage(MesQcTemplatePageReqVO pageReqVO); | |
| 66 | + PageResult<MesQcTemplateDO> getTemplatePage(MesQcTemplatePageReqVO pageReqVO); | |
| 68 | 67 | |
| 69 | 68 | /** |
| 70 | 69 | * 获得质检方案列表(用于下拉选择) |
| 71 | 70 | * |
| 72 | - * @return 质检方案列表(DO,简单列表场景) | |
| 71 | + * @return 质检方案列表 | |
| 73 | 72 | */ |
| 74 | 73 | List<MesQcTemplateDO> getTemplateList(); |
| 75 | 74 | |
| ... | ... | @@ -119,17 +118,17 @@ public interface MesQcTemplateService { |
| 119 | 118 | * 获得检测指标项 |
| 120 | 119 | * |
| 121 | 120 | * @param id 编号 |
| 122 | - * @return 检测指标项(含 JOIN 的指标信息) | |
| 121 | + * @return 检测指标项 | |
| 123 | 122 | */ |
| 124 | - MesQcTemplateIndicatorRespVO getTemplateIndicator(Long id); | |
| 123 | + MesQcTemplateIndicatorDO getTemplateIndicator(Long id); | |
| 125 | 124 | |
| 126 | 125 | /** |
| 127 | 126 | * 获得检测指标项分页 |
| 128 | 127 | * |
| 129 | 128 | * @param pageReqVO 分页查询 |
| 130 | - * @return 检测指标项分页(含 JOIN 的指标信息) | |
| 129 | + * @return 检测指标项分页 | |
| 131 | 130 | */ |
| 132 | - PageResult<MesQcTemplateIndicatorRespVO> getTemplateIndicatorPage(MesQcTemplateIndicatorPageReqVO pageReqVO); | |
| 131 | + PageResult<MesQcTemplateIndicatorDO> getTemplateIndicatorPage(MesQcTemplateIndicatorPageReqVO pageReqVO); | |
| 133 | 132 | |
| 134 | 133 | // ========== 质检方案-产品关联 ========== |
| 135 | 134 | |
| ... | ... | @@ -159,16 +158,16 @@ public interface MesQcTemplateService { |
| 159 | 158 | * 获得产品关联 |
| 160 | 159 | * |
| 161 | 160 | * @param id 编号 |
| 162 | - * @return 产品关联(含 JOIN 的物料信息) | |
| 161 | + * @return 产品关联 | |
| 163 | 162 | */ |
| 164 | - MesQcTemplateItemRespVO getTemplateItem(Long id); | |
| 163 | + MesQcTemplateItemDO getTemplateItem(Long id); | |
| 165 | 164 | |
| 166 | 165 | /** |
| 167 | 166 | * 获得产品关联分页 |
| 168 | 167 | * |
| 169 | 168 | * @param pageReqVO 分页查询 |
| 170 | - * @return 产品关联分页(含 JOIN 的物料信息) | |
| 169 | + * @return 产品关联分页 | |
| 171 | 170 | */ |
| 172 | - PageResult<MesQcTemplateItemRespVO> getTemplateItemPage(MesQcTemplateItemPageReqVO pageReqVO); | |
| 171 | + PageResult<MesQcTemplateItemDO> getTemplateItemPage(MesQcTemplateItemPageReqVO pageReqVO); | |
| 173 | 172 | |
| 174 | 173 | } | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/qc/MesQcTemplateServiceImpl.java
| ... | ... | @@ -5,22 +5,14 @@ import cn.hutool.core.util.ObjUtil; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | 6 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 7 | 7 | import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.MesQcTemplatePageReqVO; |
| 8 | -import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.MesQcTemplateRespVO; | |
| 9 | 8 | import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.MesQcTemplateSaveReqVO; |
| 10 | 9 | import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.indicator.MesQcTemplateIndicatorPageReqVO; |
| 11 | -import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.indicator.MesQcTemplateIndicatorRespVO; | |
| 12 | 10 | import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.indicator.MesQcTemplateIndicatorSaveReqVO; |
| 13 | 11 | import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.item.MesQcTemplateItemPageReqVO; |
| 14 | -import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.item.MesQcTemplateItemRespVO; | |
| 15 | 12 | import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.item.MesQcTemplateItemSaveReqVO; |
| 16 | -import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; | |
| 17 | -import cn.iocoder.yudao.module.mes.dal.dataobject.md.unitmeasure.MesMdUnitMeasureDO; | |
| 18 | -import cn.iocoder.yudao.module.mes.dal.dataobject.qc.MesQcIndicatorDO; | |
| 19 | 13 | import cn.iocoder.yudao.module.mes.dal.dataobject.qc.MesQcTemplateDO; |
| 20 | 14 | import cn.iocoder.yudao.module.mes.dal.dataobject.qc.MesQcTemplateIndicatorDO; |
| 21 | 15 | import cn.iocoder.yudao.module.mes.dal.dataobject.qc.MesQcTemplateItemDO; |
| 22 | -import cn.iocoder.yudao.module.mes.dal.mysql.md.item.MesMdItemMapper; | |
| 23 | -import cn.iocoder.yudao.module.mes.dal.mysql.md.unitmeasure.MesMdUnitMeasureMapper; | |
| 24 | 16 | import cn.iocoder.yudao.module.mes.dal.mysql.qc.MesQcIndicatorMapper; |
| 25 | 17 | import cn.iocoder.yudao.module.mes.dal.mysql.qc.MesQcTemplateIndicatorMapper; |
| 26 | 18 | import cn.iocoder.yudao.module.mes.dal.mysql.qc.MesQcTemplateItemMapper; |
| ... | ... | @@ -33,7 +25,6 @@ import org.springframework.validation.annotation.Validated; |
| 33 | 25 | import java.util.Collection; |
| 34 | 26 | import java.util.Collections; |
| 35 | 27 | import java.util.List; |
| 36 | -import java.util.stream.Collectors; | |
| 37 | 28 | |
| 38 | 29 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 39 | 30 | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*; |
| ... | ... | @@ -55,10 +46,6 @@ public class MesQcTemplateServiceImpl implements MesQcTemplateService { |
| 55 | 46 | private MesQcTemplateItemMapper templateItemMapper; |
| 56 | 47 | @Resource |
| 57 | 48 | private MesQcIndicatorMapper indicatorMapper; |
| 58 | - @Resource | |
| 59 | - private MesMdItemMapper mdItemMapper; | |
| 60 | - @Resource | |
| 61 | - private MesMdUnitMeasureMapper unitMeasureMapper; | |
| 62 | 49 | |
| 63 | 50 | // ========== 质检方案主表 ========== |
| 64 | 51 | |
| ... | ... | @@ -112,27 +99,14 @@ public class MesQcTemplateServiceImpl implements MesQcTemplateService { |
| 112 | 99 | } |
| 113 | 100 | } |
| 114 | 101 | |
| 115 | - // TODO @AI:返回 DO;交给 controller 拼接 | |
| 116 | 102 | @Override |
| 117 | - public MesQcTemplateRespVO getTemplate(Long id) { | |
| 118 | - MesQcTemplateDO do0 = templateMapper.selectById(id); | |
| 119 | - if (do0 == null) { | |
| 120 | - return null; | |
| 121 | - } | |
| 122 | - // types/enableFlag 由 TypeHandler/MyBatis-Plus 自动映射,直接 toBean 即可 | |
| 123 | - return BeanUtils.toBean(do0, MesQcTemplateRespVO.class); | |
| 103 | + public MesQcTemplateDO getTemplate(Long id) { | |
| 104 | + return templateMapper.selectById(id); | |
| 124 | 105 | } |
| 125 | 106 | |
| 126 | - // TODO @AI:返回 DO;交给 controller 拼接 | |
| 127 | 107 | @Override |
| 128 | - public PageResult<MesQcTemplateRespVO> getTemplatePage(MesQcTemplatePageReqVO pageReqVO) { | |
| 129 | - PageResult<MesQcTemplateDO> pageResult = templateMapper.selectPage(pageReqVO); | |
| 130 | - return new PageResult<>( | |
| 131 | - pageResult.getList().stream() | |
| 132 | - .map(do0 -> BeanUtils.toBean(do0, MesQcTemplateRespVO.class)) | |
| 133 | - .collect(Collectors.toList()), | |
| 134 | - pageResult.getTotal() | |
| 135 | - ); | |
| 108 | + public PageResult<MesQcTemplateDO> getTemplatePage(MesQcTemplatePageReqVO pageReqVO) { | |
| 109 | + return templateMapper.selectPage(pageReqVO); | |
| 136 | 110 | } |
| 137 | 111 | |
| 138 | 112 | @Override |
| ... | ... | @@ -184,46 +158,13 @@ public class MesQcTemplateServiceImpl implements MesQcTemplateService { |
| 184 | 158 | } |
| 185 | 159 | |
| 186 | 160 | @Override |
| 187 | - public MesQcTemplateIndicatorRespVO getTemplateIndicator(Long id) { | |
| 188 | - MesQcTemplateIndicatorDO do0 = templateIndicatorMapper.selectById(id); | |
| 189 | - if (do0 == null) { | |
| 190 | - return null; | |
| 191 | - } | |
| 192 | - return convertIndicatorRespVO(do0); | |
| 161 | + public MesQcTemplateIndicatorDO getTemplateIndicator(Long id) { | |
| 162 | + return templateIndicatorMapper.selectById(id); | |
| 193 | 163 | } |
| 194 | 164 | |
| 195 | 165 | @Override |
| 196 | - public PageResult<MesQcTemplateIndicatorRespVO> getTemplateIndicatorPage(MesQcTemplateIndicatorPageReqVO pageReqVO) { | |
| 197 | - PageResult<MesQcTemplateIndicatorDO> pageResult = templateIndicatorMapper.selectPage(pageReqVO); | |
| 198 | - return new PageResult<>( | |
| 199 | - pageResult.getList().stream().map(this::convertIndicatorRespVO).collect(Collectors.toList()), | |
| 200 | - pageResult.getTotal() | |
| 201 | - ); | |
| 202 | - } | |
| 203 | - | |
| 204 | - /** | |
| 205 | - * DO → RespVO:JOIN mes_qc_indicator 补充检测项信息,JOIN mes_md_unit_measure 补充单位名称 | |
| 206 | - */ | |
| 207 | - private MesQcTemplateIndicatorRespVO convertIndicatorRespVO(MesQcTemplateIndicatorDO do0) { | |
| 208 | - MesQcTemplateIndicatorRespVO vo = BeanUtils.toBean(do0, MesQcTemplateIndicatorRespVO.class); | |
| 209 | - // JOIN 质检指标 | |
| 210 | - if (do0.getIndicatorId() != null) { | |
| 211 | - MesQcIndicatorDO indicator = indicatorMapper.selectById(do0.getIndicatorId()); | |
| 212 | - if (indicator != null) { | |
| 213 | - vo.setIndicatorCode(indicator.getCode()); | |
| 214 | - vo.setIndicatorName(indicator.getName()); | |
| 215 | - vo.setIndicatorType(indicator.getType()); | |
| 216 | - vo.setIndicatorTool(indicator.getTool()); | |
| 217 | - } | |
| 218 | - } | |
| 219 | - // JOIN 计量单位 | |
| 220 | - if (do0.getUnitMeasureId() != null) { | |
| 221 | - MesMdUnitMeasureDO unit = unitMeasureMapper.selectById(do0.getUnitMeasureId()); | |
| 222 | - if (unit != null) { | |
| 223 | - vo.setUnitMeasureName(unit.getName()); | |
| 224 | - } | |
| 225 | - } | |
| 226 | - return vo; | |
| 166 | + public PageResult<MesQcTemplateIndicatorDO> getTemplateIndicatorPage(MesQcTemplateIndicatorPageReqVO pageReqVO) { | |
| 167 | + return templateIndicatorMapper.selectPage(pageReqVO); | |
| 227 | 168 | } |
| 228 | 169 | |
| 229 | 170 | // ========== 质检方案-产品关联 ========== |
| ... | ... | @@ -276,44 +217,13 @@ public class MesQcTemplateServiceImpl implements MesQcTemplateService { |
| 276 | 217 | } |
| 277 | 218 | |
| 278 | 219 | @Override |
| 279 | - public MesQcTemplateItemRespVO getTemplateItem(Long id) { | |
| 280 | - MesQcTemplateItemDO do0 = templateItemMapper.selectById(id); | |
| 281 | - if (do0 == null) { | |
| 282 | - return null; | |
| 283 | - } | |
| 284 | - return convertItemRespVO(do0); | |
| 220 | + public MesQcTemplateItemDO getTemplateItem(Long id) { | |
| 221 | + return templateItemMapper.selectById(id); | |
| 285 | 222 | } |
| 286 | 223 | |
| 287 | 224 | @Override |
| 288 | - public PageResult<MesQcTemplateItemRespVO> getTemplateItemPage(MesQcTemplateItemPageReqVO pageReqVO) { | |
| 289 | - PageResult<MesQcTemplateItemDO> pageResult = templateItemMapper.selectPage(pageReqVO); | |
| 290 | - return new PageResult<>( | |
| 291 | - pageResult.getList().stream().map(this::convertItemRespVO).collect(Collectors.toList()), | |
| 292 | - pageResult.getTotal() | |
| 293 | - ); | |
| 294 | - } | |
| 295 | - | |
| 296 | - /** | |
| 297 | - * DO → RespVO:JOIN mes_md_item 补充物料信息,JOIN mes_md_unit_measure 补充单位名称 | |
| 298 | - */ | |
| 299 | - private MesQcTemplateItemRespVO convertItemRespVO(MesQcTemplateItemDO do0) { | |
| 300 | - MesQcTemplateItemRespVO vo = BeanUtils.toBean(do0, MesQcTemplateItemRespVO.class); | |
| 301 | - if (do0.getItemId() != null) { | |
| 302 | - MesMdItemDO item = mdItemMapper.selectById(do0.getItemId()); | |
| 303 | - if (item != null) { | |
| 304 | - vo.setItemCode(item.getCode()); | |
| 305 | - vo.setItemName(item.getName()); | |
| 306 | - vo.setSpecification(item.getSpecification()); | |
| 307 | - // 查询计量单位名称 | |
| 308 | - if (item.getUnitMeasureId() != null) { | |
| 309 | - MesMdUnitMeasureDO unit = unitMeasureMapper.selectById(item.getUnitMeasureId()); | |
| 310 | - if (unit != null) { | |
| 311 | - vo.setUnitMeasureName(unit.getName()); | |
| 312 | - } | |
| 313 | - } | |
| 314 | - } | |
| 315 | - } | |
| 316 | - return vo; | |
| 225 | + public PageResult<MesQcTemplateItemDO> getTemplateItemPage(MesQcTemplateItemPageReqVO pageReqVO) { | |
| 226 | + return templateItemMapper.selectPage(pageReqVO); | |
| 317 | 227 | } |
| 318 | 228 | |
| 319 | 229 | } | ... | ... |