Forráskód Böngészése

pms功能优化 保养计划

zhangcl 4 hónapja
szülő
commit
fe43c0b96e
19 módosított fájl, 1298 hozzáadás és 2 törlés
  1. 2 0
      yudao-module-pms/yudao-module-pms-api/src/main/java/cn/iocoder/yudao/module/pms/enums/ErrorCodeConstant.java
  2. 93 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotmainplanbommaterial/IotMainPlanBomMaterialController.java
  3. 79 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotmainplanbommaterial/vo/IotMainPlanBomMaterialPageReqVO.java
  4. 96 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotmainplanbommaterial/vo/IotMainPlanBomMaterialRespVO.java
  5. 69 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotmainplanbommaterial/vo/IotMainPlanBomMaterialSaveReqVO.java
  6. 93 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotmaintenancebom/IotMaintenanceBomController.java
  7. 95 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotmaintenancebom/vo/IotMaintenanceBomPageReqVO.java
  8. 112 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotmaintenancebom/vo/IotMaintenanceBomRespVO.java
  9. 81 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotmaintenancebom/vo/IotMaintenanceBomSaveReqVO.java
  10. 104 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/iotmainplanbommaterial/IotMainPlanBomMaterialDO.java
  11. 120 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/iotmaintenancebom/IotMaintenanceBomDO.java
  12. 4 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/iotbom/IotBomMapper.java
  13. 42 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/iotmainplanbommaterial/IotMainPlanBomMaterialMapper.java
  14. 46 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/iotmaintenancebom/IotMaintenanceBomMapper.java
  15. 10 2
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotbom/IotBomServiceImpl.java
  16. 55 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotmainplanbommaterial/IotMainPlanBomMaterialService.java
  17. 71 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotmainplanbommaterial/IotMainPlanBomMaterialServiceImpl.java
  18. 55 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotmaintenancebom/IotMaintenanceBomService.java
  19. 71 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotmaintenancebom/IotMaintenanceBomServiceImpl.java

+ 2 - 0
yudao-module-pms/yudao-module-pms-api/src/main/java/cn/iocoder/yudao/module/pms/enums/ErrorCodeConstant.java

@@ -37,4 +37,6 @@ public interface ErrorCodeConstant{
     ErrorCode IOT_SHELVES_NOT_EXISTS = new ErrorCode(132, "PMS 货架不存在");
     ErrorCode IOT_CARGO_LOCATION_NOT_EXISTS = new ErrorCode(133, "PMS 货位不存在");
     ErrorCode IOT_INSPECT_ITEM_NOT_EXISTS = new ErrorCode(134, "巡检项不存在");
+    ErrorCode IOT_MAINTENANCE_BOM_NOT_EXISTS = new ErrorCode(135, "PMS 保养计划明细BOM不存在");
+    ErrorCode IOT_MAIN_PLAN_BOM_MATERIAL_NOT_EXISTS = new ErrorCode(136, "PMS 保养计划明细设备BOM挂载物料关联不存在");
 }

+ 93 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotmainplanbommaterial/IotMainPlanBomMaterialController.java

@@ -0,0 +1,93 @@
+package cn.iocoder.yudao.module.pms.controller.admin.iotmainplanbommaterial;
+
+import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
+import cn.iocoder.yudao.module.pms.controller.admin.iotmainplanbommaterial.vo.IotMainPlanBomMaterialPageReqVO;
+import cn.iocoder.yudao.module.pms.controller.admin.iotmainplanbommaterial.vo.IotMainPlanBomMaterialRespVO;
+import cn.iocoder.yudao.module.pms.controller.admin.iotmainplanbommaterial.vo.IotMainPlanBomMaterialSaveReqVO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotmainplanbommaterial.IotMainPlanBomMaterialDO;
+import cn.iocoder.yudao.module.pms.service.iotmainplanbommaterial.IotMainPlanBomMaterialService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+import java.io.IOException;
+import java.util.List;
+
+import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+
+@Tag(name = "管理后台 - PMS 保养计划明细设备BOM挂载物料关联")
+@RestController
+@RequestMapping("/pms/iot-main-plan-bom-material")
+@Validated
+public class IotMainPlanBomMaterialController {
+
+    @Resource
+    private IotMainPlanBomMaterialService iotMainPlanBomMaterialService;
+
+    @PostMapping("/create")
+    @Operation(summary = "创建PMS 保养计划明细设备BOM挂载物料关联")
+    @PreAuthorize("@ss.hasPermission('pms:iot-main-plan-bom-material:create')")
+    public CommonResult<Long> createIotMainPlanBomMaterial(@Valid @RequestBody IotMainPlanBomMaterialSaveReqVO createReqVO) {
+        return success(iotMainPlanBomMaterialService.createIotMainPlanBomMaterial(createReqVO));
+    }
+
+    @PutMapping("/update")
+    @Operation(summary = "更新PMS 保养计划明细设备BOM挂载物料关联")
+    @PreAuthorize("@ss.hasPermission('pms:iot-main-plan-bom-material:update')")
+    public CommonResult<Boolean> updateIotMainPlanBomMaterial(@Valid @RequestBody IotMainPlanBomMaterialSaveReqVO updateReqVO) {
+        iotMainPlanBomMaterialService.updateIotMainPlanBomMaterial(updateReqVO);
+        return success(true);
+    }
+
+    @DeleteMapping("/delete")
+    @Operation(summary = "删除PMS 保养计划明细设备BOM挂载物料关联")
+    @Parameter(name = "id", description = "编号", required = true)
+    @PreAuthorize("@ss.hasPermission('pms:iot-main-plan-bom-material:delete')")
+    public CommonResult<Boolean> deleteIotMainPlanBomMaterial(@RequestParam("id") Long id) {
+        iotMainPlanBomMaterialService.deleteIotMainPlanBomMaterial(id);
+        return success(true);
+    }
+
+    @GetMapping("/get")
+    @Operation(summary = "获得PMS 保养计划明细设备BOM挂载物料关联")
+    @Parameter(name = "id", description = "编号", required = true, example = "1024")
+    @PreAuthorize("@ss.hasPermission('pms:iot-main-plan-bom-material:query')")
+    public CommonResult<IotMainPlanBomMaterialRespVO> getIotMainPlanBomMaterial(@RequestParam("id") Long id) {
+        IotMainPlanBomMaterialDO iotMainPlanBomMaterial = iotMainPlanBomMaterialService.getIotMainPlanBomMaterial(id);
+        return success(BeanUtils.toBean(iotMainPlanBomMaterial, IotMainPlanBomMaterialRespVO.class));
+    }
+
+    @GetMapping("/page")
+    @Operation(summary = "获得PMS 保养计划明细设备BOM挂载物料关联分页")
+    @PreAuthorize("@ss.hasPermission('pms:iot-main-plan-bom-material:query')")
+    public CommonResult<PageResult<IotMainPlanBomMaterialRespVO>> getIotMainPlanBomMaterialPage(@Valid IotMainPlanBomMaterialPageReqVO pageReqVO) {
+        PageResult<IotMainPlanBomMaterialDO> pageResult = iotMainPlanBomMaterialService.getIotMainPlanBomMaterialPage(pageReqVO);
+        return success(BeanUtils.toBean(pageResult, IotMainPlanBomMaterialRespVO.class));
+    }
+
+    @GetMapping("/export-excel")
+    @Operation(summary = "导出PMS 保养计划明细设备BOM挂载物料关联 Excel")
+    @PreAuthorize("@ss.hasPermission('pms:iot-main-plan-bom-material:export')")
+    @ApiAccessLog(operateType = EXPORT)
+    public void exportIotMainPlanBomMaterialExcel(@Valid IotMainPlanBomMaterialPageReqVO pageReqVO,
+              HttpServletResponse response) throws IOException {
+        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+        List<IotMainPlanBomMaterialDO> list = iotMainPlanBomMaterialService.getIotMainPlanBomMaterialPage(pageReqVO).getList();
+        // 导出 Excel
+        ExcelUtils.write(response, "PMS 保养计划明细设备BOM挂载物料关联.xls", "数据", IotMainPlanBomMaterialRespVO.class,
+                        BeanUtils.toBean(list, IotMainPlanBomMaterialRespVO.class));
+    }
+
+}

+ 79 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotmainplanbommaterial/vo/IotMainPlanBomMaterialPageReqVO.java

@@ -0,0 +1,79 @@
+package cn.iocoder.yudao.module.pms.controller.admin.iotmainplanbommaterial.vo;
+
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+
+@Schema(description = "管理后台 - PMS 保养计划明细设备BOM挂载物料关联分页 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class IotMainPlanBomMaterialPageReqVO extends PageParam {
+
+    @Schema(description = "保养计划id", example = "25103")
+    private Long mainPlanId;
+
+    @Schema(description = "保养计划明细id", example = "32706")
+    private Long mainPlanDetailId;
+
+    @Schema(description = "所属设备分类", example = "24380")
+    private Long deviceCategoryId;
+
+    @Schema(description = "保养计划明细设备BOM节点id", example = "25557")
+    private Long bomNodeId;
+
+    @Schema(description = "设备分类公共BOM节点名称", example = "李四")
+    private String name;
+
+    @Schema(description = "设备分类公共BOM节点编码")
+    private String code;
+
+    @Schema(description = "物料id", example = "23091")
+    private Long materialId;
+
+    @Schema(description = "数量")
+    private BigDecimal quantity;
+
+    @Schema(description = "单价(元)", example = "5487")
+    private BigDecimal unitPrice;
+
+    @Schema(description = "公里数周期(千米)")
+    private BigDecimal kilometerCycle;
+
+    @Schema(description = "公里数周期-提前量(千米)")
+    private BigDecimal kiloCycleLead;
+
+    @Schema(description = "时间周期(小时)")
+    private BigDecimal timePeriod;
+
+    @Schema(description = "时间周期-提前量(小时)")
+    private BigDecimal timePeriodLead;
+
+    @Schema(description = "自然日周期(天)")
+    private BigDecimal naturalDatePeriod;
+
+    @Schema(description = "自然日周期-提前量(天)")
+    private BigDecimal naturalDatePeroidLead;
+
+    @Schema(description = "排序")
+    private Integer sort;
+
+    @Schema(description = "状态 0启用  1停用", example = "1")
+    private Integer status;
+
+    @Schema(description = "备注", example = "随便")
+    private String remark;
+
+    @Schema(description = "创建时间")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private LocalDateTime[] createTime;
+
+}

+ 96 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotmainplanbommaterial/vo/IotMainPlanBomMaterialRespVO.java

@@ -0,0 +1,96 @@
+package cn.iocoder.yudao.module.pms.controller.admin.iotmainplanbommaterial.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+@Schema(description = "管理后台 - PMS 保养计划明细设备BOM挂载物料关联 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class IotMainPlanBomMaterialRespVO {
+
+    @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1649")
+    @ExcelProperty("主键")
+    private Long id;
+
+    @Schema(description = "保养计划id", example = "25103")
+    @ExcelProperty("保养计划id")
+    private Long mainPlanId;
+
+    @Schema(description = "保养计划明细id", example = "32706")
+    @ExcelProperty("保养计划明细id")
+    private Long mainPlanDetailId;
+
+    @Schema(description = "所属设备分类", example = "24380")
+    @ExcelProperty("所属设备分类")
+    private Long deviceCategoryId;
+
+    @Schema(description = "保养计划明细设备BOM节点id", example = "25557")
+    @ExcelProperty("保养计划明细设备BOM节点id")
+    private Long bomNodeId;
+
+    @Schema(description = "设备分类公共BOM节点名称", example = "李四")
+    @ExcelProperty("设备分类公共BOM节点名称")
+    private String name;
+
+    @Schema(description = "设备分类公共BOM节点编码")
+    @ExcelProperty("设备分类公共BOM节点编码")
+    private String code;
+
+    @Schema(description = "物料id", example = "23091")
+    @ExcelProperty("物料id")
+    private Long materialId;
+
+    @Schema(description = "数量")
+    @ExcelProperty("数量")
+    private BigDecimal quantity;
+
+    @Schema(description = "单价(元)", example = "5487")
+    @ExcelProperty("单价(元)")
+    private BigDecimal unitPrice;
+
+    @Schema(description = "公里数周期(千米)")
+    @ExcelProperty("公里数周期(千米)")
+    private BigDecimal kilometerCycle;
+
+    @Schema(description = "公里数周期-提前量(千米)")
+    @ExcelProperty("公里数周期-提前量(千米)")
+    private BigDecimal kiloCycleLead;
+
+    @Schema(description = "时间周期(小时)")
+    @ExcelProperty("时间周期(小时)")
+    private BigDecimal timePeriod;
+
+    @Schema(description = "时间周期-提前量(小时)")
+    @ExcelProperty("时间周期-提前量(小时)")
+    private BigDecimal timePeriodLead;
+
+    @Schema(description = "自然日周期(天)")
+    @ExcelProperty("自然日周期(天)")
+    private BigDecimal naturalDatePeriod;
+
+    @Schema(description = "自然日周期-提前量(天)")
+    @ExcelProperty("自然日周期-提前量(天)")
+    private BigDecimal naturalDatePeroidLead;
+
+    @Schema(description = "排序")
+    @ExcelProperty("排序")
+    private Integer sort;
+
+    @Schema(description = "状态 0启用  1停用", example = "1")
+    @ExcelProperty("状态 0启用  1停用")
+    private Integer status;
+
+    @Schema(description = "备注", example = "随便")
+    @ExcelProperty("备注")
+    private String remark;
+
+    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("创建时间")
+    private LocalDateTime createTime;
+
+}

+ 69 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotmainplanbommaterial/vo/IotMainPlanBomMaterialSaveReqVO.java

@@ -0,0 +1,69 @@
+package cn.iocoder.yudao.module.pms.controller.admin.iotmainplanbommaterial.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Schema(description = "管理后台 - PMS 保养计划明细设备BOM挂载物料关联新增/修改 Request VO")
+@Data
+public class IotMainPlanBomMaterialSaveReqVO {
+
+    @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1649")
+    private Long id;
+
+    @Schema(description = "保养计划id", example = "25103")
+    private Long mainPlanId;
+
+    @Schema(description = "保养计划明细id", example = "32706")
+    private Long mainPlanDetailId;
+
+    @Schema(description = "所属设备分类", example = "24380")
+    private Long deviceCategoryId;
+
+    @Schema(description = "保养计划明细设备BOM节点id", example = "25557")
+    private Long bomNodeId;
+
+    @Schema(description = "设备分类公共BOM节点名称", example = "李四")
+    private String name;
+
+    @Schema(description = "设备分类公共BOM节点编码")
+    private String code;
+
+    @Schema(description = "物料id", example = "23091")
+    private Long materialId;
+
+    @Schema(description = "数量")
+    private BigDecimal quantity;
+
+    @Schema(description = "单价(元)", example = "5487")
+    private BigDecimal unitPrice;
+
+    @Schema(description = "公里数周期(千米)")
+    private BigDecimal kilometerCycle;
+
+    @Schema(description = "公里数周期-提前量(千米)")
+    private BigDecimal kiloCycleLead;
+
+    @Schema(description = "时间周期(小时)")
+    private BigDecimal timePeriod;
+
+    @Schema(description = "时间周期-提前量(小时)")
+    private BigDecimal timePeriodLead;
+
+    @Schema(description = "自然日周期(天)")
+    private BigDecimal naturalDatePeriod;
+
+    @Schema(description = "自然日周期-提前量(天)")
+    private BigDecimal naturalDatePeroidLead;
+
+    @Schema(description = "排序")
+    private Integer sort;
+
+    @Schema(description = "状态 0启用  1停用", example = "1")
+    private Integer status;
+
+    @Schema(description = "备注", example = "随便")
+    private String remark;
+
+}

+ 93 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotmaintenancebom/IotMaintenanceBomController.java

@@ -0,0 +1,93 @@
+package cn.iocoder.yudao.module.pms.controller.admin.iotmaintenancebom;
+
+import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
+import cn.iocoder.yudao.module.pms.controller.admin.iotmaintenancebom.vo.IotMaintenanceBomPageReqVO;
+import cn.iocoder.yudao.module.pms.controller.admin.iotmaintenancebom.vo.IotMaintenanceBomRespVO;
+import cn.iocoder.yudao.module.pms.controller.admin.iotmaintenancebom.vo.IotMaintenanceBomSaveReqVO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotmaintenancebom.IotMaintenanceBomDO;
+import cn.iocoder.yudao.module.pms.service.iotmaintenancebom.IotMaintenanceBomService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+import java.io.IOException;
+import java.util.List;
+
+import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+
+@Tag(name = "管理后台 - PMS 保养计划明细BOM")
+@RestController
+@RequestMapping("/pms/iot-maintenance-bom")
+@Validated
+public class IotMaintenanceBomController {
+
+    @Resource
+    private IotMaintenanceBomService iotMaintenanceBomService;
+
+    @PostMapping("/create")
+    @Operation(summary = "创建PMS 保养计划明细BOM")
+    @PreAuthorize("@ss.hasPermission('pms:iot-maintenance-bom:create')")
+    public CommonResult<Long> createIotMaintenanceBom(@Valid @RequestBody IotMaintenanceBomSaveReqVO createReqVO) {
+        return success(iotMaintenanceBomService.createIotMaintenanceBom(createReqVO));
+    }
+
+    @PutMapping("/update")
+    @Operation(summary = "更新PMS 保养计划明细BOM")
+    @PreAuthorize("@ss.hasPermission('pms:iot-maintenance-bom:update')")
+    public CommonResult<Boolean> updateIotMaintenanceBom(@Valid @RequestBody IotMaintenanceBomSaveReqVO updateReqVO) {
+        iotMaintenanceBomService.updateIotMaintenanceBom(updateReqVO);
+        return success(true);
+    }
+
+    @DeleteMapping("/delete")
+    @Operation(summary = "删除PMS 保养计划明细BOM")
+    @Parameter(name = "id", description = "编号", required = true)
+    @PreAuthorize("@ss.hasPermission('pms:iot-maintenance-bom:delete')")
+    public CommonResult<Boolean> deleteIotMaintenanceBom(@RequestParam("id") Long id) {
+        iotMaintenanceBomService.deleteIotMaintenanceBom(id);
+        return success(true);
+    }
+
+    @GetMapping("/get")
+    @Operation(summary = "获得PMS 保养计划明细BOM")
+    @Parameter(name = "id", description = "编号", required = true, example = "1024")
+    @PreAuthorize("@ss.hasPermission('pms:iot-maintenance-bom:query')")
+    public CommonResult<IotMaintenanceBomRespVO> getIotMaintenanceBom(@RequestParam("id") Long id) {
+        IotMaintenanceBomDO iotMaintenanceBom = iotMaintenanceBomService.getIotMaintenanceBom(id);
+        return success(BeanUtils.toBean(iotMaintenanceBom, IotMaintenanceBomRespVO.class));
+    }
+
+    @GetMapping("/page")
+    @Operation(summary = "获得PMS 保养计划明细BOM分页")
+    @PreAuthorize("@ss.hasPermission('pms:iot-maintenance-bom:query')")
+    public CommonResult<PageResult<IotMaintenanceBomRespVO>> getIotMaintenanceBomPage(@Valid IotMaintenanceBomPageReqVO pageReqVO) {
+        PageResult<IotMaintenanceBomDO> pageResult = iotMaintenanceBomService.getIotMaintenanceBomPage(pageReqVO);
+        return success(BeanUtils.toBean(pageResult, IotMaintenanceBomRespVO.class));
+    }
+
+    @GetMapping("/export-excel")
+    @Operation(summary = "导出PMS 保养计划明细BOM Excel")
+    @PreAuthorize("@ss.hasPermission('pms:iot-maintenance-bom:export')")
+    @ApiAccessLog(operateType = EXPORT)
+    public void exportIotMaintenanceBomExcel(@Valid IotMaintenanceBomPageReqVO pageReqVO,
+              HttpServletResponse response) throws IOException {
+        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+        List<IotMaintenanceBomDO> list = iotMaintenanceBomService.getIotMaintenanceBomPage(pageReqVO).getList();
+        // 导出 Excel
+        ExcelUtils.write(response, "PMS 保养计划明细BOM.xls", "数据", IotMaintenanceBomRespVO.class,
+                        BeanUtils.toBean(list, IotMaintenanceBomRespVO.class));
+    }
+
+}

+ 95 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotmaintenancebom/vo/IotMaintenanceBomPageReqVO.java

@@ -0,0 +1,95 @@
+package cn.iocoder.yudao.module.pms.controller.admin.iotmaintenancebom.vo;
+
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+
+@Schema(description = "管理后台 - PMS 保养计划明细BOM分页 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class IotMaintenanceBomPageReqVO extends PageParam {
+
+    @Schema(description = "保养计划id", example = "11371")
+    private Long planId;
+
+    @Schema(description = "保养计划明细id", example = "17738")
+    private Long planDetailId;
+
+    @Schema(description = "所属设备分类", example = "21283")
+    private Long deviceCategoryId;
+
+    @Schema(description = "设备id", example = "19729")
+    private Long deviceId;
+
+    @Schema(description = "保养规则(量程 运行时间 自然日期) 可多选")
+    private String rule;
+
+    @Schema(description = "上次保养运行时长(小时)")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private BigDecimal[] lastRunningTime;
+
+    @Schema(description = "下次保养运行时长(小时)")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private BigDecimal[] nextRunningTime;
+
+    @Schema(description = "上次保养运行公里数(千米)")
+    private BigDecimal lastRunningKilometers;
+
+    @Schema(description = "下次保养运行公里数(千米)")
+    private BigDecimal nextRunningKilometers;
+
+    @Schema(description = "上次保养自然日期(天)")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private BigDecimal[] lastNaturalDate;
+
+    @Schema(description = "下次保养自然日期(天)")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private BigDecimal[] nextNaturalDate;
+
+    @Schema(description = "BOM名称", example = "张三")
+    private String name;
+
+    @Schema(description = "BOM编码")
+    private String code;
+
+    @Schema(description = "父BOM id 顶级为0", example = "18063")
+    private Long parentId;
+
+    @Schema(description = "子节点id 逗号分隔")
+    private String childIds;
+
+    @Schema(description = "层级")
+    private Integer level;
+
+    @Schema(description = "是否叶子节点 0是 1否")
+    private Integer leafFlag;
+
+    @Schema(description = "显示顺序")
+    private Integer sort;
+
+    @Schema(description = "M维修 S保养 维修+保养", example = "2")
+    private String type;
+
+    @Schema(description = "状态 0启用  1停用", example = "2")
+    private Integer status;
+
+    @Schema(description = "备注", example = "你说的对")
+    private String remark;
+
+    @Schema(description = "版本")
+    private Integer version;
+
+    @Schema(description = "创建时间")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private LocalDateTime[] createTime;
+
+}

+ 112 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotmaintenancebom/vo/IotMaintenanceBomRespVO.java

@@ -0,0 +1,112 @@
+package cn.iocoder.yudao.module.pms.controller.admin.iotmaintenancebom.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+@Schema(description = "管理后台 - PMS 保养计划明细BOM Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class IotMaintenanceBomRespVO {
+
+    @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "27423")
+    @ExcelProperty("主键")
+    private Long id;
+
+    @Schema(description = "保养计划id", example = "11371")
+    @ExcelProperty("保养计划id")
+    private Long planId;
+
+    @Schema(description = "保养计划明细id", example = "17738")
+    @ExcelProperty("保养计划明细id")
+    private Long planDetailId;
+
+    @Schema(description = "所属设备分类", example = "21283")
+    @ExcelProperty("所属设备分类")
+    private Long deviceCategoryId;
+
+    @Schema(description = "设备id", example = "19729")
+    @ExcelProperty("设备id")
+    private Long deviceId;
+
+    @Schema(description = "保养规则(量程 运行时间 自然日期) 可多选")
+    @ExcelProperty("保养规则(量程 运行时间 自然日期) 可多选")
+    private String rule;
+
+    @Schema(description = "上次保养运行时长(小时)")
+    @ExcelProperty("上次保养运行时长(小时)")
+    private BigDecimal lastRunningTime;
+
+    @Schema(description = "下次保养运行时长(小时)")
+    @ExcelProperty("下次保养运行时长(小时)")
+    private BigDecimal nextRunningTime;
+
+    @Schema(description = "上次保养运行公里数(千米)")
+    @ExcelProperty("上次保养运行公里数(千米)")
+    private BigDecimal lastRunningKilometers;
+
+    @Schema(description = "下次保养运行公里数(千米)")
+    @ExcelProperty("下次保养运行公里数(千米)")
+    private BigDecimal nextRunningKilometers;
+
+    @Schema(description = "上次保养自然日期(天)")
+    @ExcelProperty("上次保养自然日期(天)")
+    private BigDecimal lastNaturalDate;
+
+    @Schema(description = "下次保养自然日期(天)")
+    @ExcelProperty("下次保养自然日期(天)")
+    private BigDecimal nextNaturalDate;
+
+    @Schema(description = "BOM名称", example = "张三")
+    @ExcelProperty("BOM名称")
+    private String name;
+
+    @Schema(description = "BOM编码")
+    @ExcelProperty("BOM编码")
+    private String code;
+
+    @Schema(description = "父BOM id 顶级为0", example = "18063")
+    @ExcelProperty("父BOM id 顶级为0")
+    private Long parentId;
+
+    @Schema(description = "子节点id 逗号分隔")
+    @ExcelProperty("子节点id 逗号分隔")
+    private String childIds;
+
+    @Schema(description = "层级")
+    @ExcelProperty("层级")
+    private Integer level;
+
+    @Schema(description = "是否叶子节点 0是 1否")
+    @ExcelProperty("是否叶子节点 0是 1否")
+    private Integer leafFlag;
+
+    @Schema(description = "显示顺序")
+    @ExcelProperty("显示顺序")
+    private Integer sort;
+
+    @Schema(description = "M维修 S保养 维修+保养", example = "2")
+    @ExcelProperty("M维修 S保养 维修+保养")
+    private String type;
+
+    @Schema(description = "状态 0启用  1停用", example = "2")
+    @ExcelProperty("状态 0启用  1停用")
+    private Integer status;
+
+    @Schema(description = "备注", example = "你说的对")
+    @ExcelProperty("备注")
+    private String remark;
+
+    @Schema(description = "版本")
+    @ExcelProperty("版本")
+    private Integer version;
+
+    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("创建时间")
+    private LocalDateTime createTime;
+
+}

+ 81 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotmaintenancebom/vo/IotMaintenanceBomSaveReqVO.java

@@ -0,0 +1,81 @@
+package cn.iocoder.yudao.module.pms.controller.admin.iotmaintenancebom.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Schema(description = "管理后台 - PMS 保养计划明细BOM新增/修改 Request VO")
+@Data
+public class IotMaintenanceBomSaveReqVO {
+
+    @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "27423")
+    private Long id;
+
+    @Schema(description = "保养计划id", example = "11371")
+    private Long planId;
+
+    @Schema(description = "保养计划明细id", example = "17738")
+    private Long planDetailId;
+
+    @Schema(description = "所属设备分类", example = "21283")
+    private Long deviceCategoryId;
+
+    @Schema(description = "设备id", example = "19729")
+    private Long deviceId;
+
+    @Schema(description = "保养规则(量程 运行时间 自然日期) 可多选")
+    private String rule;
+
+    @Schema(description = "上次保养运行时长(小时)")
+    private BigDecimal lastRunningTime;
+
+    @Schema(description = "下次保养运行时长(小时)")
+    private BigDecimal nextRunningTime;
+
+    @Schema(description = "上次保养运行公里数(千米)")
+    private BigDecimal lastRunningKilometers;
+
+    @Schema(description = "下次保养运行公里数(千米)")
+    private BigDecimal nextRunningKilometers;
+
+    @Schema(description = "上次保养自然日期(天)")
+    private BigDecimal lastNaturalDate;
+
+    @Schema(description = "下次保养自然日期(天)")
+    private BigDecimal nextNaturalDate;
+
+    @Schema(description = "BOM名称", example = "张三")
+    private String name;
+
+    @Schema(description = "BOM编码")
+    private String code;
+
+    @Schema(description = "父BOM id 顶级为0", example = "18063")
+    private Long parentId;
+
+    @Schema(description = "子节点id 逗号分隔")
+    private String childIds;
+
+    @Schema(description = "层级")
+    private Integer level;
+
+    @Schema(description = "是否叶子节点 0是 1否")
+    private Integer leafFlag;
+
+    @Schema(description = "显示顺序")
+    private Integer sort;
+
+    @Schema(description = "M维修 S保养 维修+保养", example = "2")
+    private String type;
+
+    @Schema(description = "状态 0启用  1停用", example = "2")
+    private Integer status;
+
+    @Schema(description = "备注", example = "你说的对")
+    private String remark;
+
+    @Schema(description = "版本")
+    private Integer version;
+
+}

+ 104 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/iotmainplanbommaterial/IotMainPlanBomMaterialDO.java

@@ -0,0 +1,104 @@
+package cn.iocoder.yudao.module.pms.dal.dataobject.iotmainplanbommaterial;
+
+import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
+import com.baomidou.mybatisplus.annotation.KeySequence;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.*;
+
+import java.math.BigDecimal;
+
+/**
+ * PMS 保养计划明细设备BOM挂载物料关联 DO
+ *
+ * @author ruiqi
+ */
+@TableName("rq_iot_main_plan_bom_material")
+@KeySequence("rq_iot_main_plan_bom_material_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class IotMainPlanBomMaterialDO extends BaseDO {
+
+    /**
+     * 主键
+     */
+    @TableId
+    private Long id;
+    /**
+     * 保养计划id
+     */
+    private Long mainPlanId;
+    /**
+     * 保养计划明细id
+     */
+    private Long mainPlanDetailId;
+    /**
+     * 所属设备分类
+     */
+    private Long deviceCategoryId;
+    /**
+     * 保养计划明细设备BOM节点id
+     */
+    private Long bomNodeId;
+    /**
+     * 设备分类公共BOM节点名称
+     */
+    private String name;
+    /**
+     * 设备分类公共BOM节点编码
+     */
+    private String code;
+    /**
+     * 物料id
+     */
+    private Long materialId;
+    /**
+     * 数量
+     */
+    private BigDecimal quantity;
+    /**
+     * 单价(元)
+     */
+    private BigDecimal unitPrice;
+    /**
+     * 公里数周期(千米)
+     */
+    private BigDecimal kilometerCycle;
+    /**
+     * 公里数周期-提前量(千米)
+     */
+    private BigDecimal kiloCycleLead;
+    /**
+     * 时间周期(小时)
+     */
+    private BigDecimal timePeriod;
+    /**
+     * 时间周期-提前量(小时)
+     */
+    private BigDecimal timePeriodLead;
+    /**
+     * 自然日周期(天)
+     */
+    private BigDecimal naturalDatePeriod;
+    /**
+     * 自然日周期-提前量(天)
+     */
+    private BigDecimal naturalDatePeroidLead;
+    /**
+     * 排序
+     */
+    private Integer sort;
+    /**
+     * 状态 0启用  1停用
+     */
+    private Integer status;
+    /**
+     * 备注
+     */
+    private String remark;
+
+}

+ 120 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/iotmaintenancebom/IotMaintenanceBomDO.java

@@ -0,0 +1,120 @@
+package cn.iocoder.yudao.module.pms.dal.dataobject.iotmaintenancebom;
+
+import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
+import com.baomidou.mybatisplus.annotation.KeySequence;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.*;
+
+import java.math.BigDecimal;
+
+/**
+ * PMS 保养计划明细BOM DO
+ *
+ * @author ruiqi
+ */
+@TableName("rq_iot_maintenance_bom")
+@KeySequence("rq_iot_maintenance_bom_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class IotMaintenanceBomDO extends BaseDO {
+
+    /**
+     * 主键
+     */
+    @TableId
+    private Long id;
+    /**
+     * 保养计划id
+     */
+    private Long planId;
+    /**
+     * 保养计划明细id
+     */
+    private Long planDetailId;
+    /**
+     * 所属设备分类
+     */
+    private Long deviceCategoryId;
+    /**
+     * 设备id
+     */
+    private Long deviceId;
+    /**
+     * 保养规则(量程 运行时间 自然日期) 可多选
+     */
+    private String rule;
+    /**
+     * 上次保养运行时长(小时)
+     */
+    private BigDecimal lastRunningTime;
+    /**
+     * 下次保养运行时长(小时)
+     */
+    private BigDecimal nextRunningTime;
+    /**
+     * 上次保养运行公里数(千米)
+     */
+    private BigDecimal lastRunningKilometers;
+    /**
+     * 下次保养运行公里数(千米)
+     */
+    private BigDecimal nextRunningKilometers;
+    /**
+     * 上次保养自然日期(天)
+     */
+    private BigDecimal lastNaturalDate;
+    /**
+     * 下次保养自然日期(天)
+     */
+    private BigDecimal nextNaturalDate;
+    /**
+     * BOM名称
+     */
+    private String name;
+    /**
+     * BOM编码
+     */
+    private String code;
+    /**
+     * 父BOM id 顶级为0
+     */
+    private Long parentId;
+    /**
+     * 子节点id 逗号分隔
+     */
+    private String childIds;
+    /**
+     * 层级
+     */
+    private Integer level;
+    /**
+     * 是否叶子节点 0是 1否
+     */
+    private Integer leafFlag;
+    /**
+     * 显示顺序
+     */
+    private Integer sort;
+    /**
+     * M维修 S保养 维修+保养
+     */
+    private String type;
+    /**
+     * 状态 0启用  1停用
+     */
+    private Integer status;
+    /**
+     * 备注
+     */
+    private String remark;
+    /**
+     * 版本
+     */
+    private Integer version;
+
+}

+ 4 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/iotbom/IotBomMapper.java

@@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
 import cn.iocoder.yudao.module.pms.controller.admin.iotbom.vo.IotBomListReqVO;
 import cn.iocoder.yudao.module.pms.controller.admin.iotbom.vo.IotBomPageReqVO;
+import cn.iocoder.yudao.module.pms.controller.admin.iotbom.vo.IotBomSaveReqVO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.iotbom.IotBomDO;
 import org.apache.ibatis.annotations.Mapper;
 
@@ -43,4 +44,7 @@ public interface IotBomMapper extends BaseMapperX<IotBomDO> {
                 .eqIfPresent(IotBomDO::getStatus, reqVO.getStatus()));
     }
 
+    default IotBomDO selectParentNode(IotBomSaveReqVO reqVO) {
+        return selectOne(IotBomDO::getId, reqVO.getParentId());
+    }
 }

+ 42 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/iotmainplanbommaterial/IotMainPlanBomMaterialMapper.java

@@ -0,0 +1,42 @@
+package cn.iocoder.yudao.module.pms.dal.mysql.iotmainplanbommaterial;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.iocoder.yudao.module.pms.controller.admin.iotmainplanbommaterial.vo.IotMainPlanBomMaterialPageReqVO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotmainplanbommaterial.IotMainPlanBomMaterialDO;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * PMS 保养计划明细设备BOM挂载物料关联 Mapper
+ *
+ * @author ruiqi
+ */
+@Mapper
+public interface IotMainPlanBomMaterialMapper extends BaseMapperX<IotMainPlanBomMaterialDO> {
+
+    default PageResult<IotMainPlanBomMaterialDO> selectPage(IotMainPlanBomMaterialPageReqVO reqVO) {
+        return selectPage(reqVO, new LambdaQueryWrapperX<IotMainPlanBomMaterialDO>()
+                .eqIfPresent(IotMainPlanBomMaterialDO::getMainPlanId, reqVO.getMainPlanId())
+                .eqIfPresent(IotMainPlanBomMaterialDO::getMainPlanDetailId, reqVO.getMainPlanDetailId())
+                .eqIfPresent(IotMainPlanBomMaterialDO::getDeviceCategoryId, reqVO.getDeviceCategoryId())
+                .eqIfPresent(IotMainPlanBomMaterialDO::getBomNodeId, reqVO.getBomNodeId())
+                .likeIfPresent(IotMainPlanBomMaterialDO::getName, reqVO.getName())
+                .eqIfPresent(IotMainPlanBomMaterialDO::getCode, reqVO.getCode())
+                .eqIfPresent(IotMainPlanBomMaterialDO::getMaterialId, reqVO.getMaterialId())
+                .eqIfPresent(IotMainPlanBomMaterialDO::getQuantity, reqVO.getQuantity())
+                .eqIfPresent(IotMainPlanBomMaterialDO::getUnitPrice, reqVO.getUnitPrice())
+                .eqIfPresent(IotMainPlanBomMaterialDO::getKilometerCycle, reqVO.getKilometerCycle())
+                .eqIfPresent(IotMainPlanBomMaterialDO::getKiloCycleLead, reqVO.getKiloCycleLead())
+                .eqIfPresent(IotMainPlanBomMaterialDO::getTimePeriod, reqVO.getTimePeriod())
+                .eqIfPresent(IotMainPlanBomMaterialDO::getTimePeriodLead, reqVO.getTimePeriodLead())
+                .eqIfPresent(IotMainPlanBomMaterialDO::getNaturalDatePeriod, reqVO.getNaturalDatePeriod())
+                .eqIfPresent(IotMainPlanBomMaterialDO::getNaturalDatePeroidLead, reqVO.getNaturalDatePeroidLead())
+                .eqIfPresent(IotMainPlanBomMaterialDO::getSort, reqVO.getSort())
+                .eqIfPresent(IotMainPlanBomMaterialDO::getStatus, reqVO.getStatus())
+                .eqIfPresent(IotMainPlanBomMaterialDO::getRemark, reqVO.getRemark())
+                .betweenIfPresent(IotMainPlanBomMaterialDO::getCreateTime, reqVO.getCreateTime())
+                .orderByDesc(IotMainPlanBomMaterialDO::getId));
+    }
+
+}

+ 46 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/iotmaintenancebom/IotMaintenanceBomMapper.java

@@ -0,0 +1,46 @@
+package cn.iocoder.yudao.module.pms.dal.mysql.iotmaintenancebom;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.iocoder.yudao.module.pms.controller.admin.iotmaintenancebom.vo.IotMaintenanceBomPageReqVO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotmaintenancebom.IotMaintenanceBomDO;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * PMS 保养计划明细BOM Mapper
+ *
+ * @author ruiqi
+ */
+@Mapper
+public interface IotMaintenanceBomMapper extends BaseMapperX<IotMaintenanceBomDO> {
+
+    default PageResult<IotMaintenanceBomDO> selectPage(IotMaintenanceBomPageReqVO reqVO) {
+        return selectPage(reqVO, new LambdaQueryWrapperX<IotMaintenanceBomDO>()
+                .eqIfPresent(IotMaintenanceBomDO::getPlanId, reqVO.getPlanId())
+                .eqIfPresent(IotMaintenanceBomDO::getPlanDetailId, reqVO.getPlanDetailId())
+                .eqIfPresent(IotMaintenanceBomDO::getDeviceCategoryId, reqVO.getDeviceCategoryId())
+                .eqIfPresent(IotMaintenanceBomDO::getDeviceId, reqVO.getDeviceId())
+                .eqIfPresent(IotMaintenanceBomDO::getRule, reqVO.getRule())
+                .betweenIfPresent(IotMaintenanceBomDO::getLastRunningTime, reqVO.getLastRunningTime())
+                .betweenIfPresent(IotMaintenanceBomDO::getNextRunningTime, reqVO.getNextRunningTime())
+                .eqIfPresent(IotMaintenanceBomDO::getLastRunningKilometers, reqVO.getLastRunningKilometers())
+                .eqIfPresent(IotMaintenanceBomDO::getNextRunningKilometers, reqVO.getNextRunningKilometers())
+                .betweenIfPresent(IotMaintenanceBomDO::getLastNaturalDate, reqVO.getLastNaturalDate())
+                .betweenIfPresent(IotMaintenanceBomDO::getNextNaturalDate, reqVO.getNextNaturalDate())
+                .likeIfPresent(IotMaintenanceBomDO::getName, reqVO.getName())
+                .eqIfPresent(IotMaintenanceBomDO::getCode, reqVO.getCode())
+                .eqIfPresent(IotMaintenanceBomDO::getParentId, reqVO.getParentId())
+                .eqIfPresent(IotMaintenanceBomDO::getChildIds, reqVO.getChildIds())
+                .eqIfPresent(IotMaintenanceBomDO::getLevel, reqVO.getLevel())
+                .eqIfPresent(IotMaintenanceBomDO::getLeafFlag, reqVO.getLeafFlag())
+                .eqIfPresent(IotMaintenanceBomDO::getSort, reqVO.getSort())
+                .eqIfPresent(IotMaintenanceBomDO::getType, reqVO.getType())
+                .eqIfPresent(IotMaintenanceBomDO::getStatus, reqVO.getStatus())
+                .eqIfPresent(IotMaintenanceBomDO::getRemark, reqVO.getRemark())
+                .eqIfPresent(IotMaintenanceBomDO::getVersion, reqVO.getVersion())
+                .betweenIfPresent(IotMaintenanceBomDO::getCreateTime, reqVO.getCreateTime())
+                .orderByDesc(IotMaintenanceBomDO::getId));
+    }
+
+}

+ 10 - 2
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotbom/IotBomServiceImpl.java

@@ -7,12 +7,11 @@ import cn.iocoder.yudao.module.pms.controller.admin.iotbom.vo.IotBomPageReqVO;
 import cn.iocoder.yudao.module.pms.controller.admin.iotbom.vo.IotBomSaveReqVO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.iotbom.IotBomDO;
 import cn.iocoder.yudao.module.pms.dal.mysql.iotbom.IotBomMapper;
-import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.annotation.Validated;
 
 import javax.annotation.Resource;
-
 import java.util.Comparator;
 import java.util.List;
 
@@ -32,9 +31,18 @@ public class IotBomServiceImpl implements IotBomService {
     private IotBomMapper iotBomMapper;
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public Long createIotBom(IotBomSaveReqVO createReqVO) {
         // 插入
         IotBomDO iotBom = BeanUtils.toBean(createReqVO, IotBomDO.class);
+        // 设置当前节点为 叶子
+        iotBom.setLeafFlag(1);
+        // 设置父节点为 非叶子节点
+        if (!createReqVO.getParentId().equals(0L)) {
+            IotBomDO parentBomNode = iotBomMapper.selectParentNode(createReqVO);
+            parentBomNode.setLeafFlag(2);
+            iotBomMapper.updateById(parentBomNode);
+        }
         iotBomMapper.insert(iotBom);
         // 返回
         return iotBom.getId();

+ 55 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotmainplanbommaterial/IotMainPlanBomMaterialService.java

@@ -0,0 +1,55 @@
+package cn.iocoder.yudao.module.pms.service.iotmainplanbommaterial;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.module.pms.controller.admin.iotmainplanbommaterial.vo.IotMainPlanBomMaterialPageReqVO;
+import cn.iocoder.yudao.module.pms.controller.admin.iotmainplanbommaterial.vo.IotMainPlanBomMaterialSaveReqVO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotmainplanbommaterial.IotMainPlanBomMaterialDO;
+
+import javax.validation.Valid;
+
+/**
+ * PMS 保养计划明细设备BOM挂载物料关联 Service 接口
+ *
+ * @author ruiqi
+ */
+public interface IotMainPlanBomMaterialService {
+
+    /**
+     * 创建PMS 保养计划明细设备BOM挂载物料关联
+     *
+     * @param createReqVO 创建信息
+     * @return 编号
+     */
+    Long createIotMainPlanBomMaterial(@Valid IotMainPlanBomMaterialSaveReqVO createReqVO);
+
+    /**
+     * 更新PMS 保养计划明细设备BOM挂载物料关联
+     *
+     * @param updateReqVO 更新信息
+     */
+    void updateIotMainPlanBomMaterial(@Valid IotMainPlanBomMaterialSaveReqVO updateReqVO);
+
+    /**
+     * 删除PMS 保养计划明细设备BOM挂载物料关联
+     *
+     * @param id 编号
+     */
+    void deleteIotMainPlanBomMaterial(Long id);
+
+    /**
+     * 获得PMS 保养计划明细设备BOM挂载物料关联
+     *
+     * @param id 编号
+     * @return PMS 保养计划明细设备BOM挂载物料关联
+     */
+    IotMainPlanBomMaterialDO getIotMainPlanBomMaterial(Long id);
+
+    /**
+     * 获得PMS 保养计划明细设备BOM挂载物料关联分页
+     *
+     * @param pageReqVO 分页查询
+     * @return PMS 保养计划明细设备BOM挂载物料关联分页
+     */
+    PageResult<IotMainPlanBomMaterialDO> getIotMainPlanBomMaterialPage(IotMainPlanBomMaterialPageReqVO pageReqVO);
+
+}

+ 71 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotmainplanbommaterial/IotMainPlanBomMaterialServiceImpl.java

@@ -0,0 +1,71 @@
+package cn.iocoder.yudao.module.pms.service.iotmainplanbommaterial;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.module.pms.controller.admin.iotmainplanbommaterial.vo.IotMainPlanBomMaterialPageReqVO;
+import cn.iocoder.yudao.module.pms.controller.admin.iotmainplanbommaterial.vo.IotMainPlanBomMaterialSaveReqVO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotmainplanbommaterial.IotMainPlanBomMaterialDO;
+import cn.iocoder.yudao.module.pms.dal.mysql.iotmainplanbommaterial.IotMainPlanBomMaterialMapper;
+import org.springframework.stereotype.Service;
+import org.springframework.validation.annotation.Validated;
+
+import javax.annotation.Resource;
+
+import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstant.IOT_MAIN_PLAN_BOM_MATERIAL_NOT_EXISTS;
+
+/**
+ * PMS 保养计划明细设备BOM挂载物料关联 Service 实现类
+ *
+ * @author ruiqi
+ */
+@Service
+@Validated
+public class IotMainPlanBomMaterialServiceImpl implements IotMainPlanBomMaterialService {
+
+    @Resource
+    private IotMainPlanBomMaterialMapper iotMainPlanBomMaterialMapper;
+
+    @Override
+    public Long createIotMainPlanBomMaterial(IotMainPlanBomMaterialSaveReqVO createReqVO) {
+        // 插入
+        IotMainPlanBomMaterialDO iotMainPlanBomMaterial = BeanUtils.toBean(createReqVO, IotMainPlanBomMaterialDO.class);
+        iotMainPlanBomMaterialMapper.insert(iotMainPlanBomMaterial);
+        // 返回
+        return iotMainPlanBomMaterial.getId();
+    }
+
+    @Override
+    public void updateIotMainPlanBomMaterial(IotMainPlanBomMaterialSaveReqVO updateReqVO) {
+        // 校验存在
+        validateIotMainPlanBomMaterialExists(updateReqVO.getId());
+        // 更新
+        IotMainPlanBomMaterialDO updateObj = BeanUtils.toBean(updateReqVO, IotMainPlanBomMaterialDO.class);
+        iotMainPlanBomMaterialMapper.updateById(updateObj);
+    }
+
+    @Override
+    public void deleteIotMainPlanBomMaterial(Long id) {
+        // 校验存在
+        validateIotMainPlanBomMaterialExists(id);
+        // 删除
+        iotMainPlanBomMaterialMapper.deleteById(id);
+    }
+
+    private void validateIotMainPlanBomMaterialExists(Long id) {
+        if (iotMainPlanBomMaterialMapper.selectById(id) == null) {
+            throw exception(IOT_MAIN_PLAN_BOM_MATERIAL_NOT_EXISTS);
+        }
+    }
+
+    @Override
+    public IotMainPlanBomMaterialDO getIotMainPlanBomMaterial(Long id) {
+        return iotMainPlanBomMaterialMapper.selectById(id);
+    }
+
+    @Override
+    public PageResult<IotMainPlanBomMaterialDO> getIotMainPlanBomMaterialPage(IotMainPlanBomMaterialPageReqVO pageReqVO) {
+        return iotMainPlanBomMaterialMapper.selectPage(pageReqVO);
+    }
+
+}

+ 55 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotmaintenancebom/IotMaintenanceBomService.java

@@ -0,0 +1,55 @@
+package cn.iocoder.yudao.module.pms.service.iotmaintenancebom;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.module.pms.controller.admin.iotmaintenancebom.vo.IotMaintenanceBomPageReqVO;
+import cn.iocoder.yudao.module.pms.controller.admin.iotmaintenancebom.vo.IotMaintenanceBomSaveReqVO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotmaintenancebom.IotMaintenanceBomDO;
+
+import javax.validation.Valid;
+
+/**
+ * PMS 保养计划明细BOM Service 接口
+ *
+ * @author ruiqi
+ */
+public interface IotMaintenanceBomService {
+
+    /**
+     * 创建PMS 保养计划明细BOM
+     *
+     * @param createReqVO 创建信息
+     * @return 编号
+     */
+    Long createIotMaintenanceBom(@Valid IotMaintenanceBomSaveReqVO createReqVO);
+
+    /**
+     * 更新PMS 保养计划明细BOM
+     *
+     * @param updateReqVO 更新信息
+     */
+    void updateIotMaintenanceBom(@Valid IotMaintenanceBomSaveReqVO updateReqVO);
+
+    /**
+     * 删除PMS 保养计划明细BOM
+     *
+     * @param id 编号
+     */
+    void deleteIotMaintenanceBom(Long id);
+
+    /**
+     * 获得PMS 保养计划明细BOM
+     *
+     * @param id 编号
+     * @return PMS 保养计划明细BOM
+     */
+    IotMaintenanceBomDO getIotMaintenanceBom(Long id);
+
+    /**
+     * 获得PMS 保养计划明细BOM分页
+     *
+     * @param pageReqVO 分页查询
+     * @return PMS 保养计划明细BOM分页
+     */
+    PageResult<IotMaintenanceBomDO> getIotMaintenanceBomPage(IotMaintenanceBomPageReqVO pageReqVO);
+
+}

+ 71 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotmaintenancebom/IotMaintenanceBomServiceImpl.java

@@ -0,0 +1,71 @@
+package cn.iocoder.yudao.module.pms.service.iotmaintenancebom;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.module.pms.controller.admin.iotmaintenancebom.vo.IotMaintenanceBomPageReqVO;
+import cn.iocoder.yudao.module.pms.controller.admin.iotmaintenancebom.vo.IotMaintenanceBomSaveReqVO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotmaintenancebom.IotMaintenanceBomDO;
+import cn.iocoder.yudao.module.pms.dal.mysql.iotmaintenancebom.IotMaintenanceBomMapper;
+import org.springframework.stereotype.Service;
+import org.springframework.validation.annotation.Validated;
+
+import javax.annotation.Resource;
+
+import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstant.IOT_MAINTENANCE_BOM_NOT_EXISTS;
+
+/**
+ * PMS 保养计划明细BOM Service 实现类
+ *
+ * @author ruiqi
+ */
+@Service
+@Validated
+public class IotMaintenanceBomServiceImpl implements IotMaintenanceBomService {
+
+    @Resource
+    private IotMaintenanceBomMapper iotMaintenanceBomMapper;
+
+    @Override
+    public Long createIotMaintenanceBom(IotMaintenanceBomSaveReqVO createReqVO) {
+        // 插入
+        IotMaintenanceBomDO iotMaintenanceBom = BeanUtils.toBean(createReqVO, IotMaintenanceBomDO.class);
+        iotMaintenanceBomMapper.insert(iotMaintenanceBom);
+        // 返回
+        return iotMaintenanceBom.getId();
+    }
+
+    @Override
+    public void updateIotMaintenanceBom(IotMaintenanceBomSaveReqVO updateReqVO) {
+        // 校验存在
+        validateIotMaintenanceBomExists(updateReqVO.getId());
+        // 更新
+        IotMaintenanceBomDO updateObj = BeanUtils.toBean(updateReqVO, IotMaintenanceBomDO.class);
+        iotMaintenanceBomMapper.updateById(updateObj);
+    }
+
+    @Override
+    public void deleteIotMaintenanceBom(Long id) {
+        // 校验存在
+        validateIotMaintenanceBomExists(id);
+        // 删除
+        iotMaintenanceBomMapper.deleteById(id);
+    }
+
+    private void validateIotMaintenanceBomExists(Long id) {
+        if (iotMaintenanceBomMapper.selectById(id) == null) {
+            throw exception(IOT_MAINTENANCE_BOM_NOT_EXISTS);
+        }
+    }
+
+    @Override
+    public IotMaintenanceBomDO getIotMaintenanceBom(Long id) {
+        return iotMaintenanceBomMapper.selectById(id);
+    }
+
+    @Override
+    public PageResult<IotMaintenanceBomDO> getIotMaintenanceBomPage(IotMaintenanceBomPageReqVO pageReqVO) {
+        return iotMaintenanceBomMapper.selectPage(pageReqVO);
+    }
+
+}