瀏覽代碼

pms功能优化 设备分类属性模板功能优化

zhangcl 4 月之前
父節點
當前提交
edd10cfa02
共有 29 個文件被更改,包括 1131 次插入18 次删除
  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/iotdevicecategorytemplate/IotDeviceCategoryTemplateController.java
  3. 51 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotdevicecategorytemplate/vo/IotDeviceCategoryTemplatePageReqVO.java
  4. 62 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotdevicecategorytemplate/vo/IotDeviceCategoryTemplateRespVO.java
  5. 43 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotdevicecategorytemplate/vo/IotDeviceCategoryTemplateSaveReqVO.java
  6. 102 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotdevicecategorytemplateattrs/IotDeviceCategoryTemplateAttrsController.java
  7. 66 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotdevicecategorytemplateattrs/vo/IotDeviceCategoryTemplateAttrsPageReqVO.java
  8. 79 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotdevicecategorytemplateattrs/vo/IotDeviceCategoryTemplateAttrsRespVO.java
  9. 55 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotdevicecategorytemplateattrs/vo/IotDeviceCategoryTemplateAttrsSaveReqVO.java
  10. 0 3
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotdevicetemplate/IotDeviceTemplateController.java
  11. 3 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotdevicetemplate/vo/IotDeviceTemplatePageReqVO.java
  12. 4 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotdevicetemplate/vo/IotDeviceTemplateRespVO.java
  13. 3 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotdevicetemplate/vo/IotDeviceTemplateSaveReqVO.java
  14. 6 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotdevicetemplateattrs/vo/IotDeviceTemplateAttrsPageReqVO.java
  15. 10 1
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotdevicetemplateattrs/vo/IotDeviceTemplateAttrsRespVO.java
  16. 6 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotdevicetemplateattrs/vo/IotDeviceTemplateAttrsSaveReqVO.java
  17. 31 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/convert/iotdevicecategorytemplate/IotDeviceCategoryTemplateConvert.java
  18. 0 12
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/convert/iotdevicetemplate/IotDeviceTemplateConvert.java
  19. 66 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/iotdevicecategorytemplate/IotDeviceCategoryTemplateDO.java
  20. 94 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/iotdevicecategorytemplateattrs/IotDeviceCategoryTemplateAttrsDO.java
  21. 4 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/iotdevicetemplate/IotDeviceTemplateDO.java
  22. 6 2
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/iotdevicetemplateattrs/IotDeviceTemplateAttrsDO.java
  23. 33 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/iotdevicecategorytemplate/IotDeviceCategoryTemplateMapper.java
  24. 44 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/iotdevicecategorytemplateattrs/IotDeviceCategoryTemplateAttrsMapper.java
  25. 1 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/iotdevicetemplate/IotDeviceTemplateMapper.java
  26. 55 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotdevicecategorytemplate/IotDeviceCategoryTemplateService.java
  27. 71 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotdevicecategorytemplate/IotDeviceCategoryTemplateServiceImpl.java
  28. 63 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotdevicecategorytemplateattrs/IotDeviceCategoryTemplateAttrsService.java
  29. 78 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotdevicecategorytemplateattrs/IotDeviceCategoryTemplateAttrsServiceImpl.java

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

@@ -19,4 +19,6 @@ public interface ErrorCodeConstant{
     ErrorCode IOT_INFO_NOT_EXISTS = new ErrorCode( 122, "资料数据不存在");
     ErrorCode IOT_TREE_NOT_EXISTS = new ErrorCode(122, "pms树不存在");
     ErrorCode IOT_COMMON_BOM_MATERIAL_NOT_EXISTS = new ErrorCode(123, "设备分类公共BOM挂载物料关联不存在");
+    ErrorCode IOT_DEVICE_CATEGORY_TEMPLATE_NOT_EXISTS = new ErrorCode(124, "设备分类属性公用模板不存在");
+    ErrorCode IOT_DEVICE_CATEGORY_TEMPLATE_ATTRS_NOT_EXISTS = new ErrorCode(125, "设备分类公共模板属性不存在");
 }

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

@@ -0,0 +1,93 @@
+package cn.iocoder.yudao.module.pms.controller.admin.iotdevicecategorytemplate;
+
+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.iotdevicecategorytemplate.vo.IotDeviceCategoryTemplatePageReqVO;
+import cn.iocoder.yudao.module.pms.controller.admin.iotdevicecategorytemplate.vo.IotDeviceCategoryTemplateRespVO;
+import cn.iocoder.yudao.module.pms.controller.admin.iotdevicecategorytemplate.vo.IotDeviceCategoryTemplateSaveReqVO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotdevicecategorytemplate.IotDeviceCategoryTemplateDO;
+import cn.iocoder.yudao.module.pms.service.iotdevicecategorytemplate.IotDeviceCategoryTemplateService;
+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 = "管理后台 - 设备分类属性公用模板")
+@RestController
+@RequestMapping("/pms/iot-device-category-template")
+@Validated
+public class IotDeviceCategoryTemplateController {
+
+    @Resource
+    private IotDeviceCategoryTemplateService iotDeviceCategoryTemplateService;
+
+    @PostMapping("/create")
+    @Operation(summary = "创建设备分类属性公用模板")
+    @PreAuthorize("@ss.hasPermission('pms:iot-device-category-template:create')")
+    public CommonResult<Long> createIotDeviceCategoryTemplate(@Valid @RequestBody IotDeviceCategoryTemplateSaveReqVO createReqVO) {
+        return success(iotDeviceCategoryTemplateService.createIotDeviceCategoryTemplate(createReqVO));
+    }
+
+    @PutMapping("/update")
+    @Operation(summary = "更新设备分类属性公用模板")
+    @PreAuthorize("@ss.hasPermission('pms:iot-device-category-template:update')")
+    public CommonResult<Boolean> updateIotDeviceCategoryTemplate(@Valid @RequestBody IotDeviceCategoryTemplateSaveReqVO updateReqVO) {
+        iotDeviceCategoryTemplateService.updateIotDeviceCategoryTemplate(updateReqVO);
+        return success(true);
+    }
+
+    @DeleteMapping("/delete")
+    @Operation(summary = "删除设备分类属性公用模板")
+    @Parameter(name = "id", description = "编号", required = true)
+    @PreAuthorize("@ss.hasPermission('pms:iot-device-category-template:delete')")
+    public CommonResult<Boolean> deleteIotDeviceCategoryTemplate(@RequestParam("id") Long id) {
+        iotDeviceCategoryTemplateService.deleteIotDeviceCategoryTemplate(id);
+        return success(true);
+    }
+
+    @GetMapping("/get")
+    @Operation(summary = "获得设备分类属性公用模板")
+    @Parameter(name = "id", description = "编号", required = true, example = "1024")
+    @PreAuthorize("@ss.hasPermission('pms:iot-device-category-template:query')")
+    public CommonResult<IotDeviceCategoryTemplateRespVO> getIotDeviceCategoryTemplate(@RequestParam("id") Long id) {
+        IotDeviceCategoryTemplateDO iotDeviceCategoryTemplate = iotDeviceCategoryTemplateService.getIotDeviceCategoryTemplate(id);
+        return success(BeanUtils.toBean(iotDeviceCategoryTemplate, IotDeviceCategoryTemplateRespVO.class));
+    }
+
+    @GetMapping("/page")
+    @Operation(summary = "获得设备分类属性公用模板分页")
+    @PreAuthorize("@ss.hasPermission('pms:iot-device-category-template:query')")
+    public CommonResult<PageResult<IotDeviceCategoryTemplateRespVO>> getIotDeviceCategoryTemplatePage(@Valid IotDeviceCategoryTemplatePageReqVO pageReqVO) {
+        PageResult<IotDeviceCategoryTemplateDO> pageResult = iotDeviceCategoryTemplateService.getIotDeviceCategoryTemplatePage(pageReqVO);
+        return success(BeanUtils.toBean(pageResult, IotDeviceCategoryTemplateRespVO.class));
+    }
+
+    @GetMapping("/export-excel")
+    @Operation(summary = "导出设备分类属性公用模板 Excel")
+    @PreAuthorize("@ss.hasPermission('pms:iot-device-category-template:export')")
+    @ApiAccessLog(operateType = EXPORT)
+    public void exportIotDeviceCategoryTemplateExcel(@Valid IotDeviceCategoryTemplatePageReqVO pageReqVO,
+              HttpServletResponse response) throws IOException {
+        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+        List<IotDeviceCategoryTemplateDO> list = iotDeviceCategoryTemplateService.getIotDeviceCategoryTemplatePage(pageReqVO).getList();
+        // 导出 Excel
+        ExcelUtils.write(response, "设备分类属性公用模板.xls", "数据", IotDeviceCategoryTemplateRespVO.class,
+                        BeanUtils.toBean(list, IotDeviceCategoryTemplateRespVO.class));
+    }
+
+}

+ 51 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotdevicecategorytemplate/vo/IotDeviceCategoryTemplatePageReqVO.java

@@ -0,0 +1,51 @@
+package cn.iocoder.yudao.module.pms.controller.admin.iotdevicecategorytemplate.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.time.LocalDateTime;
+
+import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+
+@Schema(description = "管理后台 - 设备分类属性公用模板分页 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class IotDeviceCategoryTemplatePageReqVO extends PageParam {
+
+    @Schema(description = "所属设备分类", example = "17640")
+    private Long deviceCategoryId;
+
+    @Schema(description = "模板名称", example = "李四")
+    private String name;
+
+    @Schema(description = "模板编码")
+    private String code;
+
+    @Schema(description = "模板属性 json 格式数据")
+    private String attrs;
+
+    @Schema(description = "模板描述", example = "随便")
+    private String description;
+
+    @Schema(description = "状态 0启用  1停用", example = "2")
+    private Integer status;
+
+    @Schema(description = "排序")
+    private Integer sort;
+
+    @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;
+
+}

+ 62 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotdevicecategorytemplate/vo/IotDeviceCategoryTemplateRespVO.java

@@ -0,0 +1,62 @@
+package cn.iocoder.yudao.module.pms.controller.admin.iotdevicecategorytemplate.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.time.LocalDateTime;
+
+@Schema(description = "管理后台 - 设备分类属性公用模板 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class IotDeviceCategoryTemplateRespVO {
+
+    @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "19054")
+    @ExcelProperty("主键")
+    private Long id;
+
+    @Schema(description = "所属设备分类", example = "17640")
+    @ExcelProperty("所属设备分类")
+    private Long deviceCategoryId;
+
+    @Schema(description = "所属设备分类名称", example = "pms")
+    private String deviceCategoryName;
+
+    @Schema(description = "模板名称", example = "李四")
+    @ExcelProperty("模板名称")
+    private String name;
+
+    @Schema(description = "模板编码")
+    @ExcelProperty("模板编码")
+    private String code;
+
+    @Schema(description = "模板属性 json 格式数据")
+    @ExcelProperty("模板属性 json 格式数据")
+    private String attrs;
+
+    @Schema(description = "模板描述", example = "随便")
+    @ExcelProperty("模板描述")
+    private String description;
+
+    @Schema(description = "状态 0启用  1停用", example = "2")
+    @ExcelProperty("状态 0启用  1停用")
+    private Integer status;
+
+    @Schema(description = "排序")
+    @ExcelProperty("排序")
+    private Integer sort;
+
+    @Schema(description = "备注", example = "随便")
+    @ExcelProperty("备注")
+    private String remark;
+
+    @Schema(description = "模板版本号")
+    @ExcelProperty("模板版本号")
+    private Integer version;
+
+    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("创建时间")
+    private LocalDateTime createTime;
+
+}

+ 43 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotdevicecategorytemplate/vo/IotDeviceCategoryTemplateSaveReqVO.java

@@ -0,0 +1,43 @@
+package cn.iocoder.yudao.module.pms.controller.admin.iotdevicecategorytemplate.vo;
+
+import cn.iocoder.yudao.module.pms.controller.admin.iotdevicetemplate.model.DeviceTemplateAttrs;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.List;
+
+@Schema(description = "管理后台 - 设备分类属性公用模板新增/修改 Request VO")
+@Data
+public class IotDeviceCategoryTemplateSaveReqVO {
+
+    @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "19054")
+    private Long id;
+
+    @Schema(description = "所属设备分类", example = "17640")
+    private Long deviceCategoryId;
+
+    @Schema(description = "模板名称", example = "李四")
+    private String name;
+
+    @Schema(description = "模板编码")
+    private String code;
+
+    @Schema(description = "模板属性 json 格式数据")
+    private List<DeviceTemplateAttrs> attrs;
+
+    @Schema(description = "模板描述", example = "随便")
+    private String description;
+
+    @Schema(description = "状态 0启用  1停用", example = "2")
+    private Integer status;
+
+    @Schema(description = "排序")
+    private Integer sort;
+
+    @Schema(description = "备注", example = "随便")
+    private String remark;
+
+    @Schema(description = "模板版本号")
+    private Integer version;
+
+}

+ 102 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotdevicecategorytemplateattrs/IotDeviceCategoryTemplateAttrsController.java

@@ -0,0 +1,102 @@
+package cn.iocoder.yudao.module.pms.controller.admin.iotdevicecategorytemplateattrs;
+
+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.iotdevicecategorytemplateattrs.vo.IotDeviceCategoryTemplateAttrsPageReqVO;
+import cn.iocoder.yudao.module.pms.controller.admin.iotdevicecategorytemplateattrs.vo.IotDeviceCategoryTemplateAttrsRespVO;
+import cn.iocoder.yudao.module.pms.controller.admin.iotdevicecategorytemplateattrs.vo.IotDeviceCategoryTemplateAttrsSaveReqVO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotdevicecategorytemplateattrs.IotDeviceCategoryTemplateAttrsDO;
+import cn.iocoder.yudao.module.pms.service.iotdevicecategorytemplateattrs.IotDeviceCategoryTemplateAttrsService;
+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 = "管理后台 - 设备分类公共模板属性")
+@RestController
+@RequestMapping("/pms/iot-device-category-template-attrs")
+@Validated
+public class IotDeviceCategoryTemplateAttrsController {
+
+    @Resource
+    private IotDeviceCategoryTemplateAttrsService iotDeviceCategoryTemplateAttrsService;
+
+    @PostMapping("/create")
+    @Operation(summary = "创建设备分类公共模板属性")
+    @PreAuthorize("@ss.hasPermission('pms:iot-device-category-template-attrs:create')")
+    public CommonResult<Long> createIotDeviceCategoryTemplateAttrs(@Valid @RequestBody IotDeviceCategoryTemplateAttrsSaveReqVO createReqVO) {
+        return success(iotDeviceCategoryTemplateAttrsService.createIotDeviceCategoryTemplateAttrs(createReqVO));
+    }
+
+    @PutMapping("/update")
+    @Operation(summary = "更新设备分类公共模板属性")
+    @PreAuthorize("@ss.hasPermission('pms:iot-device-category-template-attrs:update')")
+    public CommonResult<Boolean> updateIotDeviceCategoryTemplateAttrs(@Valid @RequestBody IotDeviceCategoryTemplateAttrsSaveReqVO updateReqVO) {
+        iotDeviceCategoryTemplateAttrsService.updateIotDeviceCategoryTemplateAttrs(updateReqVO);
+        return success(true);
+    }
+
+    @DeleteMapping("/delete")
+    @Operation(summary = "删除设备分类公共模板属性")
+    @Parameter(name = "id", description = "编号", required = true)
+    @PreAuthorize("@ss.hasPermission('pms:iot-device-category-template-attrs:delete')")
+    public CommonResult<Boolean> deleteIotDeviceCategoryTemplateAttrs(@RequestParam("id") Long id) {
+        iotDeviceCategoryTemplateAttrsService.deleteIotDeviceCategoryTemplateAttrs(id);
+        return success(true);
+    }
+
+    @GetMapping("/get")
+    @Operation(summary = "获得设备分类公共模板属性")
+    @Parameter(name = "id", description = "编号", required = true, example = "1024")
+    @PreAuthorize("@ss.hasPermission('pms:iot-device-category-template-attrs:query')")
+    public CommonResult<IotDeviceCategoryTemplateAttrsRespVO> getIotDeviceCategoryTemplateAttrs(@RequestParam("id") Long id) {
+        IotDeviceCategoryTemplateAttrsDO iotDeviceCategoryTemplateAttrs = iotDeviceCategoryTemplateAttrsService.getIotDeviceCategoryTemplateAttrs(id);
+        return success(BeanUtils.toBean(iotDeviceCategoryTemplateAttrs, IotDeviceCategoryTemplateAttrsRespVO.class));
+    }
+
+    @GetMapping("/page")
+    @Operation(summary = "获得设备分类公共模板属性分页")
+    @PreAuthorize("@ss.hasPermission('pms:iot-device-category-template-attrs:query')")
+    public CommonResult<PageResult<IotDeviceCategoryTemplateAttrsRespVO>> getIotDeviceCategoryTemplateAttrsPage(@Valid IotDeviceCategoryTemplateAttrsPageReqVO pageReqVO) {
+        PageResult<IotDeviceCategoryTemplateAttrsDO> pageResult = iotDeviceCategoryTemplateAttrsService.getIotDeviceCategoryTemplateAttrsPage(pageReqVO);
+        return success(BeanUtils.toBean(pageResult, IotDeviceCategoryTemplateAttrsRespVO.class));
+    }
+
+    @GetMapping("/list-by-device-category-id")
+    @Operation(summary = "根据设备分类id获取模板属性列表")
+    @Parameter(name = "deviceCategoryId", description = "设备分类id", required = true, example = "1024")
+    @PreAuthorize("@ss.hasPermission('rq:iot-device-category-template-attrs:query')")
+    public CommonResult<List<IotDeviceCategoryTemplateAttrsRespVO>> getAttrsByDeviceCategoryId(@RequestParam("deviceCategoryId") Long deviceCategoryId) {
+        List<IotDeviceCategoryTemplateAttrsDO> deviceTemplateAttrs = iotDeviceCategoryTemplateAttrsService.getTemplateAttrsByDeviceCategoryId(deviceCategoryId);
+        return success(BeanUtils.toBean(deviceTemplateAttrs, IotDeviceCategoryTemplateAttrsRespVO.class));
+    }
+
+    @GetMapping("/export-excel")
+    @Operation(summary = "导出设备分类公共模板属性 Excel")
+    @PreAuthorize("@ss.hasPermission('pms:iot-device-category-template-attrs:export')")
+    @ApiAccessLog(operateType = EXPORT)
+    public void exportIotDeviceCategoryTemplateAttrsExcel(@Valid IotDeviceCategoryTemplateAttrsPageReqVO pageReqVO,
+              HttpServletResponse response) throws IOException {
+        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+        List<IotDeviceCategoryTemplateAttrsDO> list = iotDeviceCategoryTemplateAttrsService.getIotDeviceCategoryTemplateAttrsPage(pageReqVO).getList();
+        // 导出 Excel
+        ExcelUtils.write(response, "设备分类公共模板属性.xls", "数据", IotDeviceCategoryTemplateAttrsRespVO.class,
+                        BeanUtils.toBean(list, IotDeviceCategoryTemplateAttrsRespVO.class));
+    }
+
+}

+ 66 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotdevicecategorytemplateattrs/vo/IotDeviceCategoryTemplateAttrsPageReqVO.java

@@ -0,0 +1,66 @@
+package cn.iocoder.yudao.module.pms.controller.admin.iotdevicecategorytemplateattrs.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.time.LocalDateTime;
+
+import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+
+@Schema(description = "管理后台 - 设备分类公共模板属性分页 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class IotDeviceCategoryTemplateAttrsPageReqVO extends PageParam {
+
+    @Schema(description = "设备分类id", example = "17218")
+    private Long deviceCategoryId;
+
+    @Schema(description = "公共模板id", example = "17218")
+    private Long templateId;
+
+    @Schema(description = "属性名称", example = "芋艿")
+    private String name;
+
+    @Schema(description = "属性编码")
+    private String code;
+
+    @Schema(description = "属性数据类型 string number boolean", example = "2")
+    private String type;
+
+    @Schema(description = "是否必填 0不必填 1必填")
+    private Integer requiredFlag;
+
+    @Schema(description = "默认值")
+    private String defaultValue;
+
+    @Schema(description = "属性值单位")
+    private String unit;
+
+    @Schema(description = "属性描述", example = "你说的对")
+    private String description;
+
+    @Schema(description = "状态 0启用  1停用", example = "1")
+    private Integer status;
+
+    @Schema(description = "备注", example = "随便")
+    private String remark;
+
+    @Schema(description = "排序")
+    private Integer sort;
+
+    @Schema(description = "下拉框选项")
+    private String selectOptions;
+
+    @Schema(description = "属性版本号")
+    private Integer version;
+
+    @Schema(description = "创建时间")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private LocalDateTime[] createTime;
+
+}

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

@@ -0,0 +1,79 @@
+package cn.iocoder.yudao.module.pms.controller.admin.iotdevicecategorytemplateattrs.vo;
+
+import cn.iocoder.yudao.module.pms.controller.admin.iotdevicetemplate.model.DeviceTemplateAttrs;
+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.time.LocalDateTime;
+import java.util.List;
+
+@Schema(description = "管理后台 - 设备分类公共模板属性 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class IotDeviceCategoryTemplateAttrsRespVO {
+
+    @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "13345")
+    @ExcelProperty("主键")
+    private Long id;
+
+    @Schema(description = "设备分类id", example = "17218")
+    private Long deviceCategoryId;
+
+    @Schema(description = "公共模板id", example = "17218")
+    @ExcelProperty("公共模板id")
+    private Long templateId;
+
+    @Schema(description = "属性名称", example = "芋艿")
+    @ExcelProperty("属性名称")
+    private String name;
+
+    @Schema(description = "属性编码")
+    @ExcelProperty("属性编码")
+    private String code;
+
+    @Schema(description = "属性数据类型 string number boolean", example = "2")
+    @ExcelProperty("属性数据类型 string number boolean")
+    private String type;
+
+    @Schema(description = "是否必填 0不必填 1必填")
+    @ExcelProperty("是否必填 0不必填 1必填")
+    private Integer requiredFlag;
+
+    @Schema(description = "默认值")
+    @ExcelProperty("默认值")
+    private String defaultValue;
+
+    @Schema(description = "属性值单位")
+    @ExcelProperty("属性值单位")
+    private String unit;
+
+    @Schema(description = "属性描述", example = "你说的对")
+    @ExcelProperty("属性描述")
+    private String description;
+
+    @Schema(description = "状态 0启用  1停用", example = "1")
+    @ExcelProperty("状态 0启用  1停用")
+    private Integer status;
+
+    @Schema(description = "备注", example = "随便")
+    @ExcelProperty("备注")
+    private String remark;
+
+    @Schema(description = "排序")
+    @ExcelProperty("排序")
+    private Integer sort;
+
+    @Schema(description = "下拉框选项")
+    private DeviceTemplateAttrs selectOptions;
+
+    @Schema(description = "属性版本号")
+    @ExcelProperty("属性版本号")
+    private Integer version;
+
+    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("创建时间")
+    private LocalDateTime createTime;
+
+}

+ 55 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotdevicecategorytemplateattrs/vo/IotDeviceCategoryTemplateAttrsSaveReqVO.java

@@ -0,0 +1,55 @@
+package cn.iocoder.yudao.module.pms.controller.admin.iotdevicecategorytemplateattrs.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Schema(description = "管理后台 - 设备分类公共模板属性新增/修改 Request VO")
+@Data
+public class IotDeviceCategoryTemplateAttrsSaveReqVO {
+
+    @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "13345")
+    private Long id;
+
+    @Schema(description = "设备分类id", example = "17218")
+    private Long deviceCategoryId;
+
+    @Schema(description = "公共模板id", example = "17218")
+    private Long templateId;
+
+    @Schema(description = "属性名称", example = "芋艿")
+    private String name;
+
+    @Schema(description = "属性编码")
+    private String code;
+
+    @Schema(description = "属性数据类型 string number boolean", example = "2")
+    private String type;
+
+    @Schema(description = "是否必填 0不必填 1必填")
+    private Integer requiredFlag;
+
+    @Schema(description = "默认值")
+    private String defaultValue;
+
+    @Schema(description = "属性值单位")
+    private String unit;
+
+    @Schema(description = "属性描述", example = "你说的对")
+    private String description;
+
+    @Schema(description = "状态 0启用  1停用", example = "1")
+    private Integer status;
+
+    @Schema(description = "备注", example = "随便")
+    private String remark;
+
+    @Schema(description = "排序")
+    private Integer sort;
+
+    @Schema(description = "下拉框选项")
+    private String selectOptions;
+
+    @Schema(description = "属性版本号")
+    private Integer version;
+
+}

+ 0 - 3
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotdevicetemplate/IotDeviceTemplateController.java

@@ -12,11 +12,8 @@ import cn.iocoder.yudao.module.pms.controller.admin.iotdevicetemplate.vo.IotDevi
 import cn.iocoder.yudao.module.pms.controller.admin.iotdevicetemplate.vo.IotDeviceTemplateRespVO;
 import cn.iocoder.yudao.module.pms.controller.admin.iotdevicetemplate.vo.IotDeviceTemplateSaveReqVO;
 import cn.iocoder.yudao.module.pms.convert.iotdevicetemplate.IotDeviceTemplateConvert;
-import cn.iocoder.yudao.module.pms.convert.iotmaterial.IotMaterialConvert;
 import cn.iocoder.yudao.module.pms.dal.dataobject.IotProductClassifyDO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.iotdevicetemplate.IotDeviceTemplateDO;
-import cn.iocoder.yudao.module.pms.dal.dataobject.iotmaterial.IotMaterialDO;
-import cn.iocoder.yudao.module.pms.dal.dataobject.iotmaterialgroup.IotMaterialGroupDO;
 import cn.iocoder.yudao.module.pms.service.IotProductClassifyService;
 import cn.iocoder.yudao.module.pms.service.iotdevicetemplate.IotDeviceTemplateService;
 import io.swagger.v3.oas.annotations.Operation;

+ 3 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotdevicetemplate/vo/IotDeviceTemplatePageReqVO.java

@@ -20,6 +20,9 @@ public class IotDeviceTemplatePageReqVO extends PageParam {
     @Schema(description = "所属设备分类", example = "22225")
     private Long deviceCategoryId;
 
+    @Schema(description = "所属设备id", example = "22225")
+    private Long deviceId;
+
     @Schema(description = "模板名称", example = "赵六")
     private String name;
 

+ 4 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotdevicetemplate/vo/IotDeviceTemplateRespVO.java

@@ -22,6 +22,10 @@ public class IotDeviceTemplateRespVO {
     @ExcelProperty("所属设备分类")
     private Long deviceCategoryId;
 
+    @Schema(description = "所属设备id", example = "22225")
+    @ExcelProperty("所属设备id")
+    private Long deviceId;
+
     @Schema(description = "所属设备分类名称", example = "pms")
     @ExcelProperty("所属设备分类名称")
     private String deviceCategoryName;

+ 3 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotdevicetemplate/vo/IotDeviceTemplateSaveReqVO.java

@@ -16,6 +16,9 @@ public class IotDeviceTemplateSaveReqVO {
     @Schema(description = "所属设备分类", example = "22225")
     private Long deviceCategoryId;
 
+    @Schema(description = "所属设备id", example = "22225")
+    private Long deviceId;
+
     @Schema(description = "模板名称", example = "赵六")
     private String name;
 

+ 6 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotdevicetemplateattrs/vo/IotDeviceTemplateAttrsPageReqVO.java

@@ -17,6 +17,12 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
 @ToString(callSuper = true)
 public class IotDeviceTemplateAttrsPageReqVO extends PageParam {
 
+    @Schema(description = "设备分类id", example = "32238")
+    private Long deviceCategoryId;
+
+    @Schema(description = "设备id", example = "32238")
+    private Long deviceId;
+
     @Schema(description = "设备模板id", example = "32238")
     private Long deviceTemplateId;
 

+ 10 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotdevicetemplateattrs/vo/IotDeviceTemplateAttrsRespVO.java

@@ -1,5 +1,6 @@
 package cn.iocoder.yudao.module.pms.controller.admin.iotdevicetemplateattrs.vo;
 
+import cn.iocoder.yudao.module.pms.controller.admin.iotdevicetemplate.model.DeviceTemplateAttrs;
 import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
 import com.alibaba.excel.annotation.ExcelProperty;
 import io.swagger.v3.oas.annotations.media.Schema;
@@ -20,6 +21,14 @@ public class IotDeviceTemplateAttrsRespVO {
     @ExcelProperty("设备模板id")
     private Long deviceTemplateId;
 
+    @Schema(description = "设备id", example = "32238")
+    @ExcelProperty("设备id")
+    private Long deviceId;
+
+    @Schema(description = "设备分类id", example = "32238")
+    @ExcelProperty("设备分类id")
+    private Long deviceCategoryId;
+
     @Schema(description = "属性名称", example = "李四")
     @ExcelProperty("属性名称")
     private String name;
@@ -62,7 +71,7 @@ public class IotDeviceTemplateAttrsRespVO {
 
     @Schema(description = "下拉框选项 ")
     @ExcelProperty("下拉框选项 ")
-    private String selectOptions;
+    private DeviceTemplateAttrs selectOptions;
 
     @Schema(description = "模板版本号")
     @ExcelProperty("模板版本号")

+ 6 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotdevicetemplateattrs/vo/IotDeviceTemplateAttrsSaveReqVO.java

@@ -13,6 +13,12 @@ public class IotDeviceTemplateAttrsSaveReqVO {
     @Schema(description = "设备模板id", example = "32238")
     private Long deviceTemplateId;
 
+    @Schema(description = "设备id", example = "32238")
+    private Long deviceId;
+
+    @Schema(description = "设备分类id", example = "32238")
+    private Long deviceCategoryId;
+
     @Schema(description = "属性名称", example = "李四")
     private String name;
 

+ 31 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/convert/iotdevicecategorytemplate/IotDeviceCategoryTemplateConvert.java

@@ -0,0 +1,31 @@
+package cn.iocoder.yudao.module.pms.convert.iotdevicecategorytemplate;
+
+import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.module.pms.controller.admin.iotdevicecategorytemplate.vo.IotDeviceCategoryTemplateRespVO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.IotProductClassifyDO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotdevicecategorytemplate.IotDeviceCategoryTemplateDO;
+import org.mapstruct.Mapper;
+import org.mapstruct.factory.Mappers;
+
+import java.util.List;
+import java.util.Map;
+
+@Mapper
+public interface IotDeviceCategoryTemplateConvert {
+
+    IotDeviceCategoryTemplateConvert INSTANCE = Mappers.getMapper(IotDeviceCategoryTemplateConvert.class);
+
+    default List<IotDeviceCategoryTemplateRespVO> convertList(List<IotDeviceCategoryTemplateDO> list, Map<Long, IotProductClassifyDO> productClassifyMap) {
+        return CollectionUtils.convertList(list, template -> convert(template, productClassifyMap.get(template.getDeviceCategoryId())));
+    }
+
+    default IotDeviceCategoryTemplateRespVO convert(IotDeviceCategoryTemplateDO template, IotProductClassifyDO deviceCategory) {
+        IotDeviceCategoryTemplateRespVO templateVO = BeanUtils.toBean(template, IotDeviceCategoryTemplateRespVO.class);
+        if (deviceCategory != null) {
+            templateVO.setDeviceCategoryName(deviceCategory.getName());
+        }
+        return templateVO;
+    }
+
+}

+ 0 - 12
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/convert/iotdevicetemplate/IotDeviceTemplateConvert.java

@@ -2,14 +2,10 @@ package cn.iocoder.yudao.module.pms.convert.iotdevicetemplate;
 
 import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
-import cn.iocoder.yudao.module.pms.controller.admin.iotdevicetemplate.model.DeviceTemplateAttrs;
 import cn.iocoder.yudao.module.pms.controller.admin.iotdevicetemplate.vo.IotDeviceTemplateRespVO;
-import cn.iocoder.yudao.module.pms.controller.admin.iotdevicetemplate.vo.IotDeviceTemplateSaveReqVO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.IotProductClassifyDO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.iotdevicetemplate.IotDeviceTemplateDO;
 import org.mapstruct.Mapper;
-import org.mapstruct.Mapping;
-import org.mapstruct.Named;
 import org.mapstruct.factory.Mappers;
 
 import java.util.List;
@@ -20,14 +16,6 @@ public interface IotDeviceTemplateConvert {
 
     IotDeviceTemplateConvert INSTANCE = Mappers.getMapper(IotDeviceTemplateConvert.class);
 
-    @Mapping(target = "attrs", expression = "java(convertToProperty(bean))")
-    IotDeviceTemplateDO convert(IotDeviceTemplateSaveReqVO bean);
-
-    @Named("convertToProperty")
-    default List<DeviceTemplateAttrs> convertToProperty(IotDeviceTemplateSaveReqVO bean) {
-        return bean.getAttrs();
-    }
-
     default List<IotDeviceTemplateRespVO> convertList(List<IotDeviceTemplateDO> list, Map<Long, IotProductClassifyDO> productClassifyMap) {
         return CollectionUtils.convertList(list, template -> convert(template, productClassifyMap.get(template.getDeviceCategoryId())));
     }

+ 66 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/iotdevicecategorytemplate/IotDeviceCategoryTemplateDO.java

@@ -0,0 +1,66 @@
+package cn.iocoder.yudao.module.pms.dal.dataobject.iotdevicecategorytemplate;
+
+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.*;
+
+/**
+ * 设备分类属性公用模板 DO
+ *
+ * @author ruiqi
+ */
+@TableName("rq_iot_device_category_template")
+@KeySequence("rq_iot_device_category_template_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class IotDeviceCategoryTemplateDO extends BaseDO {
+
+    /**
+     * 主键
+     */
+    @TableId
+    private Long id;
+    /**
+     * 所属设备分类
+     */
+    private Long deviceCategoryId;
+    /**
+     * 模板名称
+     */
+    private String name;
+    /**
+     * 模板编码
+     */
+    private String code;
+    /**
+     * 模板属性 json 格式数据
+     */
+    private String attrs;
+    /**
+     * 模板描述
+     */
+    private String description;
+    /**
+     * 状态 0启用  1停用
+     */
+    private Integer status;
+    /**
+     * 排序
+     */
+    private Integer sort;
+    /**
+     * 备注
+     */
+    private String remark;
+    /**
+     * 模板版本号
+     */
+    private Integer version;
+
+}

+ 94 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/iotdevicecategorytemplateattrs/IotDeviceCategoryTemplateAttrsDO.java

@@ -0,0 +1,94 @@
+package cn.iocoder.yudao.module.pms.dal.dataobject.iotdevicecategorytemplateattrs;
+
+import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
+import cn.iocoder.yudao.module.pms.controller.admin.iotdevicetemplate.model.DeviceTemplateAttrs;
+import com.baomidou.mybatisplus.annotation.KeySequence;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
+import lombok.*;
+
+/**
+ * 设备分类公共模板属性 DO
+ *
+ * @author ruiqi
+ */
+@TableName(value="rq_iot_device_category_template_attrs", autoResultMap = true)
+@KeySequence("rq_iot_device_category_template_attrs_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class IotDeviceCategoryTemplateAttrsDO extends BaseDO {
+
+    /**
+     * 主键
+     */
+    @TableId
+    private Long id;
+    /**
+     * 设备分类id
+     */
+    private Long deviceCategoryId;
+    /**
+     * 公共模板id
+     */
+    private Long templateId;
+    /**
+     * 属性名称
+     */
+    private String name;
+    /**
+     * 属性编码
+     */
+    private String code;
+    /**
+     * 属性数据类型 string number boolean
+     */
+    private String type;
+    /**
+     * 是否必填 0不必填 1必填
+     */
+    private Integer requiredFlag;
+    /**
+     * 默认值
+     */
+    private String defaultValue;
+    /**
+     * 属性值单位
+     */
+    private String unit;
+    /**
+     * 属性描述
+     */
+    private String description;
+    /**
+     * 状态 0启用  1停用
+     */
+    private Integer status;
+    /**
+     * 备注
+     */
+    private String remark;
+    /**
+     * 排序
+     */
+    private Integer sort;
+    /**
+     * 下拉框选项 [
+    {"value": "1", "label": "泵"},
+    {"value": "2", "label": "阀门"},
+    {"value": "3", "label": "传感器"}
+  ]
+     */
+    @TableField(typeHandler = JacksonTypeHandler.class)
+    private DeviceTemplateAttrs selectOptions;
+    /**
+     * 属性版本号
+     */
+    private Integer version;
+
+}

+ 4 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/iotdevicetemplate/IotDeviceTemplateDO.java

@@ -35,6 +35,10 @@ public class IotDeviceTemplateDO extends BaseDO {
      * 所属设备分类
      */
     private Long deviceCategoryId;
+    /**
+     * 所属设备id
+     */
+    private Long deviceId;
     /**
      * 模板名称
      */

+ 6 - 2
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/iotdevicetemplateattrs/IotDeviceTemplateAttrsDO.java

@@ -1,9 +1,12 @@
 package cn.iocoder.yudao.module.pms.dal.dataobject.iotdevicetemplateattrs;
 
 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
+import cn.iocoder.yudao.module.pms.controller.admin.iotdevicetemplate.model.DeviceTemplateAttrs;
 import com.baomidou.mybatisplus.annotation.KeySequence;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
 import lombok.*;
 
 /**
@@ -11,7 +14,7 @@ import lombok.*;
  *
  * @author 芋道源码
  */
-@TableName("rq_iot_device_template_attrs")
+@TableName(value="rq_iot_device_template_attrs", autoResultMap = true)
 @KeySequence("rq_iot_device_template_attrs_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
 @Data
 @EqualsAndHashCode(callSuper = true)
@@ -77,7 +80,8 @@ public class IotDeviceTemplateAttrsDO extends BaseDO {
     {"value": "3", "text": "传感器"}
   ]
      */
-    private String selectOptions;
+    @TableField(typeHandler = JacksonTypeHandler.class)
+    private DeviceTemplateAttrs selectOptions;
     /**
      * 模板版本号
      */

+ 33 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/iotdevicecategorytemplate/IotDeviceCategoryTemplateMapper.java

@@ -0,0 +1,33 @@
+package cn.iocoder.yudao.module.pms.dal.mysql.iotdevicecategorytemplate;
+
+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.iotdevicecategorytemplate.vo.IotDeviceCategoryTemplatePageReqVO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotdevicecategorytemplate.IotDeviceCategoryTemplateDO;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 设备分类属性公用模板 Mapper
+ *
+ * @author ruiqi
+ */
+@Mapper
+public interface IotDeviceCategoryTemplateMapper extends BaseMapperX<IotDeviceCategoryTemplateDO> {
+
+    default PageResult<IotDeviceCategoryTemplateDO> selectPage(IotDeviceCategoryTemplatePageReqVO reqVO) {
+        return selectPage(reqVO, new LambdaQueryWrapperX<IotDeviceCategoryTemplateDO>()
+                .eqIfPresent(IotDeviceCategoryTemplateDO::getDeviceCategoryId, reqVO.getDeviceCategoryId())
+                .likeIfPresent(IotDeviceCategoryTemplateDO::getName, reqVO.getName())
+                .eqIfPresent(IotDeviceCategoryTemplateDO::getCode, reqVO.getCode())
+                .eqIfPresent(IotDeviceCategoryTemplateDO::getAttrs, reqVO.getAttrs())
+                .eqIfPresent(IotDeviceCategoryTemplateDO::getDescription, reqVO.getDescription())
+                .eqIfPresent(IotDeviceCategoryTemplateDO::getStatus, reqVO.getStatus())
+                .eqIfPresent(IotDeviceCategoryTemplateDO::getSort, reqVO.getSort())
+                .eqIfPresent(IotDeviceCategoryTemplateDO::getRemark, reqVO.getRemark())
+                .eqIfPresent(IotDeviceCategoryTemplateDO::getVersion, reqVO.getVersion())
+                .betweenIfPresent(IotDeviceCategoryTemplateDO::getCreateTime, reqVO.getCreateTime())
+                .orderByDesc(IotDeviceCategoryTemplateDO::getId));
+    }
+
+}

+ 44 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/iotdevicecategorytemplateattrs/IotDeviceCategoryTemplateAttrsMapper.java

@@ -0,0 +1,44 @@
+package cn.iocoder.yudao.module.pms.dal.mysql.iotdevicecategorytemplateattrs;
+
+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.iotdevicecategorytemplateattrs.vo.IotDeviceCategoryTemplateAttrsPageReqVO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotdevicecategorytemplateattrs.IotDeviceCategoryTemplateAttrsDO;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * 设备分类公共模板属性 Mapper
+ *
+ * @author ruiqi
+ */
+@Mapper
+public interface IotDeviceCategoryTemplateAttrsMapper extends BaseMapperX<IotDeviceCategoryTemplateAttrsDO> {
+
+    default PageResult<IotDeviceCategoryTemplateAttrsDO> selectPage(IotDeviceCategoryTemplateAttrsPageReqVO reqVO) {
+        return selectPage(reqVO, new LambdaQueryWrapperX<IotDeviceCategoryTemplateAttrsDO>()
+                .eqIfPresent(IotDeviceCategoryTemplateAttrsDO::getDeviceCategoryId, reqVO.getDeviceCategoryId())
+                .eqIfPresent(IotDeviceCategoryTemplateAttrsDO::getTemplateId, reqVO.getTemplateId())
+                .likeIfPresent(IotDeviceCategoryTemplateAttrsDO::getName, reqVO.getName())
+                .eqIfPresent(IotDeviceCategoryTemplateAttrsDO::getCode, reqVO.getCode())
+                .eqIfPresent(IotDeviceCategoryTemplateAttrsDO::getType, reqVO.getType())
+                .eqIfPresent(IotDeviceCategoryTemplateAttrsDO::getRequiredFlag, reqVO.getRequiredFlag())
+                .eqIfPresent(IotDeviceCategoryTemplateAttrsDO::getDefaultValue, reqVO.getDefaultValue())
+                .eqIfPresent(IotDeviceCategoryTemplateAttrsDO::getUnit, reqVO.getUnit())
+                .eqIfPresent(IotDeviceCategoryTemplateAttrsDO::getDescription, reqVO.getDescription())
+                .eqIfPresent(IotDeviceCategoryTemplateAttrsDO::getStatus, reqVO.getStatus())
+                .eqIfPresent(IotDeviceCategoryTemplateAttrsDO::getRemark, reqVO.getRemark())
+                .eqIfPresent(IotDeviceCategoryTemplateAttrsDO::getSort, reqVO.getSort())
+                .eqIfPresent(IotDeviceCategoryTemplateAttrsDO::getSelectOptions, reqVO.getSelectOptions())
+                .eqIfPresent(IotDeviceCategoryTemplateAttrsDO::getVersion, reqVO.getVersion())
+                .betweenIfPresent(IotDeviceCategoryTemplateAttrsDO::getCreateTime, reqVO.getCreateTime())
+                .orderByDesc(IotDeviceCategoryTemplateAttrsDO::getId));
+    }
+
+    default List<IotDeviceCategoryTemplateAttrsDO> selectList(Long deviceCategoryId) {
+        return selectList(IotDeviceCategoryTemplateAttrsDO::getDeviceCategoryId, deviceCategoryId);
+    }
+
+}

+ 1 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/iotdevicetemplate/IotDeviceTemplateMapper.java

@@ -18,6 +18,7 @@ public interface IotDeviceTemplateMapper extends BaseMapperX<IotDeviceTemplateDO
     default PageResult<IotDeviceTemplateDO> selectPage(IotDeviceTemplatePageReqVO reqVO) {
         return selectPage(reqVO, new LambdaQueryWrapperX<IotDeviceTemplateDO>()
                 .eqIfPresent(IotDeviceTemplateDO::getDeviceCategoryId, reqVO.getDeviceCategoryId())
+                .eqIfPresent(IotDeviceTemplateDO::getDeviceId, reqVO.getDeviceId())
                 .likeIfPresent(IotDeviceTemplateDO::getName, reqVO.getName())
                 .eqIfPresent(IotDeviceTemplateDO::getCode, reqVO.getCode())
                 .eqIfPresent(IotDeviceTemplateDO::getAttrs, reqVO.getAttrs())

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

@@ -0,0 +1,55 @@
+package cn.iocoder.yudao.module.pms.service.iotdevicecategorytemplate;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.module.pms.controller.admin.iotdevicecategorytemplate.vo.IotDeviceCategoryTemplatePageReqVO;
+import cn.iocoder.yudao.module.pms.controller.admin.iotdevicecategorytemplate.vo.IotDeviceCategoryTemplateSaveReqVO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotdevicecategorytemplate.IotDeviceCategoryTemplateDO;
+
+import javax.validation.Valid;
+
+/**
+ * 设备分类属性公用模板 Service 接口
+ *
+ * @author ruiqi
+ */
+public interface IotDeviceCategoryTemplateService {
+
+    /**
+     * 创建设备分类属性公用模板
+     *
+     * @param createReqVO 创建信息
+     * @return 编号
+     */
+    Long createIotDeviceCategoryTemplate(@Valid IotDeviceCategoryTemplateSaveReqVO createReqVO);
+
+    /**
+     * 更新设备分类属性公用模板
+     *
+     * @param updateReqVO 更新信息
+     */
+    void updateIotDeviceCategoryTemplate(@Valid IotDeviceCategoryTemplateSaveReqVO updateReqVO);
+
+    /**
+     * 删除设备分类属性公用模板
+     *
+     * @param id 编号
+     */
+    void deleteIotDeviceCategoryTemplate(Long id);
+
+    /**
+     * 获得设备分类属性公用模板
+     *
+     * @param id 编号
+     * @return 设备分类属性公用模板
+     */
+    IotDeviceCategoryTemplateDO getIotDeviceCategoryTemplate(Long id);
+
+    /**
+     * 获得设备分类属性公用模板分页
+     *
+     * @param pageReqVO 分页查询
+     * @return 设备分类属性公用模板分页
+     */
+    PageResult<IotDeviceCategoryTemplateDO> getIotDeviceCategoryTemplatePage(IotDeviceCategoryTemplatePageReqVO pageReqVO);
+
+}

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

@@ -0,0 +1,71 @@
+package cn.iocoder.yudao.module.pms.service.iotdevicecategorytemplate;
+
+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.iotdevicecategorytemplate.vo.IotDeviceCategoryTemplatePageReqVO;
+import cn.iocoder.yudao.module.pms.controller.admin.iotdevicecategorytemplate.vo.IotDeviceCategoryTemplateSaveReqVO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotdevicecategorytemplate.IotDeviceCategoryTemplateDO;
+import cn.iocoder.yudao.module.pms.dal.mysql.iotdevicecategorytemplate.IotDeviceCategoryTemplateMapper;
+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_DEVICE_CATEGORY_TEMPLATE_NOT_EXISTS;
+
+/**
+ * 设备分类属性公用模板 Service 实现类
+ *
+ * @author ruiqi
+ */
+@Service
+@Validated
+public class IotDeviceCategoryTemplateServiceImpl implements IotDeviceCategoryTemplateService {
+
+    @Resource
+    private IotDeviceCategoryTemplateMapper iotDeviceCategoryTemplateMapper;
+
+    @Override
+    public Long createIotDeviceCategoryTemplate(IotDeviceCategoryTemplateSaveReqVO createReqVO) {
+        // 插入
+        IotDeviceCategoryTemplateDO iotDeviceCategoryTemplate = BeanUtils.toBean(createReqVO, IotDeviceCategoryTemplateDO.class);
+        iotDeviceCategoryTemplateMapper.insert(iotDeviceCategoryTemplate);
+        // 返回
+        return iotDeviceCategoryTemplate.getId();
+    }
+
+    @Override
+    public void updateIotDeviceCategoryTemplate(IotDeviceCategoryTemplateSaveReqVO updateReqVO) {
+        // 校验存在
+        validateIotDeviceCategoryTemplateExists(updateReqVO.getId());
+        // 更新
+        IotDeviceCategoryTemplateDO updateObj = BeanUtils.toBean(updateReqVO, IotDeviceCategoryTemplateDO.class);
+        iotDeviceCategoryTemplateMapper.updateById(updateObj);
+    }
+
+    @Override
+    public void deleteIotDeviceCategoryTemplate(Long id) {
+        // 校验存在
+        validateIotDeviceCategoryTemplateExists(id);
+        // 删除
+        iotDeviceCategoryTemplateMapper.deleteById(id);
+    }
+
+    private void validateIotDeviceCategoryTemplateExists(Long id) {
+        if (iotDeviceCategoryTemplateMapper.selectById(id) == null) {
+            throw exception(IOT_DEVICE_CATEGORY_TEMPLATE_NOT_EXISTS);
+        }
+    }
+
+    @Override
+    public IotDeviceCategoryTemplateDO getIotDeviceCategoryTemplate(Long id) {
+        return iotDeviceCategoryTemplateMapper.selectById(id);
+    }
+
+    @Override
+    public PageResult<IotDeviceCategoryTemplateDO> getIotDeviceCategoryTemplatePage(IotDeviceCategoryTemplatePageReqVO pageReqVO) {
+        return iotDeviceCategoryTemplateMapper.selectPage(pageReqVO);
+    }
+
+}

+ 63 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotdevicecategorytemplateattrs/IotDeviceCategoryTemplateAttrsService.java

@@ -0,0 +1,63 @@
+package cn.iocoder.yudao.module.pms.service.iotdevicecategorytemplateattrs;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.module.pms.controller.admin.iotdevicecategorytemplateattrs.vo.IotDeviceCategoryTemplateAttrsPageReqVO;
+import cn.iocoder.yudao.module.pms.controller.admin.iotdevicecategorytemplateattrs.vo.IotDeviceCategoryTemplateAttrsSaveReqVO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotdevicecategorytemplateattrs.IotDeviceCategoryTemplateAttrsDO;
+
+import javax.validation.Valid;
+import java.util.List;
+
+/**
+ * 设备分类公共模板属性 Service 接口
+ *
+ * @author ruiqi
+ */
+public interface IotDeviceCategoryTemplateAttrsService {
+
+    /**
+     * 创建设备分类公共模板属性
+     *
+     * @param createReqVO 创建信息
+     * @return 编号
+     */
+    Long createIotDeviceCategoryTemplateAttrs(@Valid IotDeviceCategoryTemplateAttrsSaveReqVO createReqVO);
+
+    /**
+     * 更新设备分类公共模板属性
+     *
+     * @param updateReqVO 更新信息
+     */
+    void updateIotDeviceCategoryTemplateAttrs(@Valid IotDeviceCategoryTemplateAttrsSaveReqVO updateReqVO);
+
+    /**
+     * 删除设备分类公共模板属性
+     *
+     * @param id 编号
+     */
+    void deleteIotDeviceCategoryTemplateAttrs(Long id);
+
+    /**
+     * 获得设备分类公共模板属性
+     *
+     * @param id 编号
+     * @return 设备分类公共模板属性
+     */
+    IotDeviceCategoryTemplateAttrsDO getIotDeviceCategoryTemplateAttrs(Long id);
+
+    /**
+     * 获得设备分类公共模板属性分页
+     *
+     * @param pageReqVO 分页查询
+     * @return 设备分类公共模板属性分页
+     */
+    PageResult<IotDeviceCategoryTemplateAttrsDO> getIotDeviceCategoryTemplateAttrsPage(IotDeviceCategoryTemplateAttrsPageReqVO pageReqVO);
+
+    /**
+     * 获得设备分类公共模板属性列表
+     *
+     * @param deviceCategoryId 设备分类id
+     * @return 设备分类公共模板属性列表
+     */
+    List<IotDeviceCategoryTemplateAttrsDO> getTemplateAttrsByDeviceCategoryId(Long deviceCategoryId);
+}

+ 78 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotdevicecategorytemplateattrs/IotDeviceCategoryTemplateAttrsServiceImpl.java

@@ -0,0 +1,78 @@
+package cn.iocoder.yudao.module.pms.service.iotdevicecategorytemplateattrs;
+
+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.iotdevicecategorytemplateattrs.vo.IotDeviceCategoryTemplateAttrsPageReqVO;
+import cn.iocoder.yudao.module.pms.controller.admin.iotdevicecategorytemplateattrs.vo.IotDeviceCategoryTemplateAttrsSaveReqVO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotdevicecategorytemplateattrs.IotDeviceCategoryTemplateAttrsDO;
+import cn.iocoder.yudao.module.pms.dal.mysql.iotdevicecategorytemplateattrs.IotDeviceCategoryTemplateAttrsMapper;
+import org.springframework.stereotype.Service;
+import org.springframework.validation.annotation.Validated;
+
+import javax.annotation.Resource;
+
+import java.util.List;
+
+import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstant.IOT_DEVICE_CATEGORY_TEMPLATE_ATTRS_NOT_EXISTS;
+
+/**
+ * 设备分类公共模板属性 Service 实现类
+ *
+ * @author ruiqi
+ */
+@Service
+@Validated
+public class IotDeviceCategoryTemplateAttrsServiceImpl implements IotDeviceCategoryTemplateAttrsService {
+
+    @Resource
+    private IotDeviceCategoryTemplateAttrsMapper iotDeviceCategoryTemplateAttrsMapper;
+
+    @Override
+    public Long createIotDeviceCategoryTemplateAttrs(IotDeviceCategoryTemplateAttrsSaveReqVO createReqVO) {
+        // 插入
+        IotDeviceCategoryTemplateAttrsDO iotDeviceCategoryTemplateAttrs = BeanUtils.toBean(createReqVO, IotDeviceCategoryTemplateAttrsDO.class);
+        iotDeviceCategoryTemplateAttrsMapper.insert(iotDeviceCategoryTemplateAttrs);
+        // 返回
+        return iotDeviceCategoryTemplateAttrs.getId();
+    }
+
+    @Override
+    public void updateIotDeviceCategoryTemplateAttrs(IotDeviceCategoryTemplateAttrsSaveReqVO updateReqVO) {
+        // 校验存在
+        validateIotDeviceCategoryTemplateAttrsExists(updateReqVO.getId());
+        // 更新
+        IotDeviceCategoryTemplateAttrsDO updateObj = BeanUtils.toBean(updateReqVO, IotDeviceCategoryTemplateAttrsDO.class);
+        iotDeviceCategoryTemplateAttrsMapper.updateById(updateObj);
+    }
+
+    @Override
+    public void deleteIotDeviceCategoryTemplateAttrs(Long id) {
+        // 校验存在
+        validateIotDeviceCategoryTemplateAttrsExists(id);
+        // 删除
+        iotDeviceCategoryTemplateAttrsMapper.deleteById(id);
+    }
+
+    private void validateIotDeviceCategoryTemplateAttrsExists(Long id) {
+        if (iotDeviceCategoryTemplateAttrsMapper.selectById(id) == null) {
+            throw exception(IOT_DEVICE_CATEGORY_TEMPLATE_ATTRS_NOT_EXISTS);
+        }
+    }
+
+    @Override
+    public IotDeviceCategoryTemplateAttrsDO getIotDeviceCategoryTemplateAttrs(Long id) {
+        return iotDeviceCategoryTemplateAttrsMapper.selectById(id);
+    }
+
+    @Override
+    public PageResult<IotDeviceCategoryTemplateAttrsDO> getIotDeviceCategoryTemplateAttrsPage(IotDeviceCategoryTemplateAttrsPageReqVO pageReqVO) {
+        return iotDeviceCategoryTemplateAttrsMapper.selectPage(pageReqVO);
+    }
+
+    @Override
+    public List<IotDeviceCategoryTemplateAttrsDO> getTemplateAttrsByDeviceCategoryId(Long deviceCategoryId) {
+        return iotDeviceCategoryTemplateAttrsMapper.selectList(deviceCategoryId);
+    }
+
+}