Ver Fonte

资料库

lipenghui há 5 meses atrás
pai
commit
6cb15e9bf0
17 ficheiros alterados com 477 adições e 2 exclusões
  1. 1 0
      yudao-module-pms/yudao-module-pms-api/src/main/java/cn/iocoder/yudao/module/pms/enums/ErrorCodeConstant.java
  2. 2 2
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/IotInfoClassifyController.java
  3. 94 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/IotInfoController.java
  4. 2 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/vo/IotInfoClassifyListReqVO.java
  5. 1 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/vo/IotInfoClassifyPageReqVO.java
  6. 1 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/vo/IotInfoClassifyRespVO.java
  7. 1 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/vo/IotInfoClassifySaveReqVO.java
  8. 2 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/vo/IotInfoClassifySimpleRespVO.java
  9. 43 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/vo/IotInfoPageReqVO.java
  10. 51 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/vo/IotInfoRespVO.java
  11. 42 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/vo/IotInfoSaveReqVO.java
  12. 1 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/IotInfoClassifyDO.java
  13. 59 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/IotInfoDO.java
  14. 33 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/IotInfoMapper.java
  15. 13 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/IotDeviceServiceImpl.java
  16. 56 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/IotInfoService.java
  17. 75 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/IotInfoServiceImpl.java

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

@@ -14,4 +14,5 @@ public interface ErrorCodeConstant{
     ErrorCode IOT_DEVICE_TEMPLATE_ATTRS_NOT_EXISTS = new ErrorCode(105, "设备模板属性不存在");
     ErrorCode IOT_DEVICE_TEMPLATE_NOT_EXISTS = new ErrorCode(106, "设备模板不存在");
     ErrorCode IOT_BOM_NOT_EXISTS = new ErrorCode(107, "BOM 关系不存在");
+    ErrorCode IOT_INFO_NOT_EXISTS = new ErrorCode( 122, "资料数据不存在");
 }

+ 2 - 2
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/IotInfoClassifyController.java

@@ -66,9 +66,9 @@ public class IotInfoClassifyController {
 
     @GetMapping(value = {"/list-all-simple", "/simple-list"})
     @Operation(summary = "获取资料分类精简信息列表", description = "只包含被开启的资料分类,主要用于前端的下拉选项")
-    public CommonResult<List<IotInfoClassifySimpleRespVO>> getSimpleIotInfoClassifyList() {
+    public CommonResult<List<IotInfoClassifySimpleRespVO>> getSimpleIotInfoClassifyList(Long deviceId) {
         List<IotInfoClassifyDO> list = IotInfoClassifyService.getIotInfoClassifyList(
-                new IotInfoClassifyListReqVO().setStatus(CommonStatusEnum.ENABLE.getStatus()));
+                new IotInfoClassifyListReqVO().setStatus(CommonStatusEnum.ENABLE.getStatus()).setDeviceId(deviceId));
         return success(BeanUtils.toBean(list, IotInfoClassifySimpleRespVO.class));
     }
 

+ 94 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/IotInfoController.java

@@ -0,0 +1,94 @@
+package cn.iocoder.yudao.module.pms.controller.admin;
+
+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.vo.IotInfoPageReqVO;
+import cn.iocoder.yudao.module.pms.controller.admin.vo.IotInfoRespVO;
+import cn.iocoder.yudao.module.pms.controller.admin.vo.IotInfoSaveReqVO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.IotInfoDO;
+import cn.iocoder.yudao.module.pms.service.IotInfoService;
+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("/rq/iot-info")
+@Validated
+public class IotInfoController {
+
+    @Resource
+    private IotInfoService iotInfoService;
+
+    @PostMapping("/create")
+    @Operation(summary = "创建资料")
+    @PreAuthorize("@ss.hasPermission('rq:iot-info:create')")
+    public CommonResult<Long> createIotInfo(@Valid @RequestBody IotInfoSaveReqVO createReqVO) {
+        return success(iotInfoService.createIotInfo(createReqVO));
+    }
+
+    @PutMapping("/update")
+    @Operation(summary = "更新资料")
+    @PreAuthorize("@ss.hasPermission('rq:iot-info:update')")
+    public CommonResult<Boolean> updateIotInfo(@Valid @RequestBody IotInfoSaveReqVO updateReqVO) {
+        iotInfoService.updateIotInfo(updateReqVO);
+        return success(true);
+    }
+
+    @DeleteMapping("/delete")
+    @Operation(summary = "删除资料")
+    @Parameter(name = "id", description = "编号", required = true)
+    @PreAuthorize("@ss.hasPermission('rq:iot-info:delete')")
+    public CommonResult<Boolean> deleteIotInfo(@RequestParam("id") Long id) {
+        iotInfoService.deleteIotInfo(id);
+        return success(true);
+    }
+
+    @GetMapping("/get")
+    @Operation(summary = "获得资料")
+    @Parameter(name = "id", description = "编号", required = true, example = "1024")
+    @PreAuthorize("@ss.hasPermission('rq:iot-info:query')")
+    public CommonResult<IotInfoRespVO> getIotInfo(@RequestParam("id") Long id) {
+        IotInfoDO iotInfo = iotInfoService.getIotInfo(id);
+        return success(BeanUtils.toBean(iotInfo, IotInfoRespVO.class));
+    }
+
+    @GetMapping("/page")
+    @Operation(summary = "获得资料分页")
+    @PreAuthorize("@ss.hasPermission('rq:iot-info:query')")
+    public CommonResult<PageResult<IotInfoRespVO>> getIotInfoPage(@Valid IotInfoPageReqVO pageReqVO) {
+        PageResult<IotInfoDO> pageResult = iotInfoService.getIotInfoPage(pageReqVO);
+        return success(BeanUtils.toBean(pageResult, IotInfoRespVO.class));
+    }
+
+    @GetMapping("/export-excel")
+    @Operation(summary = "导出资料 Excel")
+    @PreAuthorize("@ss.hasPermission('rq:iot-info:export')")
+    @ApiAccessLog(operateType = EXPORT)
+    public void exportIotInfoExcel(@Valid IotInfoPageReqVO pageReqVO,
+              HttpServletResponse response) throws IOException {
+        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+        List<IotInfoDO> list = iotInfoService.getIotInfoPage(pageReqVO).getList();
+        // 导出 Excel
+        ExcelUtils.write(response, "资料.xls", "数据", IotInfoRespVO.class,
+                        BeanUtils.toBean(list, IotInfoRespVO.class));
+    }
+
+}

+ 2 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/vo/IotInfoClassifyListReqVO.java

@@ -13,4 +13,6 @@ public class IotInfoClassifyListReqVO {
     @Schema(description = "展示状态,参见 CommonStatusEnum 枚举类", example = "1")
     private Integer status;
 
+    @Schema(description = "设备id")
+    private Long deviceId;
 }

+ 1 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/vo/IotInfoClassifyPageReqVO.java

@@ -36,4 +36,5 @@ public class IotInfoClassifyPageReqVO extends PageParam {
     @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
     private LocalDateTime[] createTime;
     private String remark;
+    private Long deviceId;
 }

+ 1 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/vo/IotInfoClassifyRespVO.java

@@ -40,4 +40,5 @@ public class IotInfoClassifyRespVO {
     @ExcelProperty("创建时间")
     private LocalDateTime createTime;
     private String remark;
+    private Long deviceId;
 }

+ 1 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/vo/IotInfoClassifySaveReqVO.java

@@ -31,4 +31,5 @@ public class IotInfoClassifySaveReqVO {
     private Integer status;
 
     private String remark;
+    private Long deviceId;
 }

+ 2 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/vo/IotInfoClassifySimpleRespVO.java

@@ -20,4 +20,6 @@ public class IotInfoClassifySimpleRespVO {
     @Schema(description = "父产品分类 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
     private Long parentId;
 
+    @Schema(description = "排序")
+    private Integer sort;
 }

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

@@ -0,0 +1,43 @@
+package cn.iocoder.yudao.module.pms.controller.admin.vo;
+
+import lombok.*;
+import java.util.*;
+import io.swagger.v3.oas.annotations.media.Schema;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+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 IotInfoPageReqVO extends PageParam {
+
+    @Schema(description = "设备id", example = "17918")
+    private Long deviceId;
+
+    @Schema(description = "分类id", example = "17918")
+    private Long classId;
+
+    @Schema(description = "部门id", example = "2503")
+    private Long orgId;
+
+    @Schema(description = "文件名称", example = "王五")
+    private String filename;
+
+    @Schema(description = "文件类型", example = "1")
+    private String fileType;
+
+    @Schema(description = "文件路径")
+    private String filePath;
+
+    @Schema(description = "备注", example = "随便")
+    private String remark;
+
+    @Schema(description = "创建时间")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private LocalDateTime[] createTime;
+
+}

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

@@ -0,0 +1,51 @@
+package cn.iocoder.yudao.module.pms.controller.admin.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+import java.util.*;
+import org.springframework.format.annotation.DateTimeFormat;
+import java.time.LocalDateTime;
+import com.alibaba.excel.annotation.*;
+
+@Schema(description = "管理后台 - 资料 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class IotInfoRespVO {
+
+    @Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "31940")
+    @ExcelProperty("主键id")
+    private Long id;
+
+    @Schema(description = "设备id", requiredMode = Schema.RequiredMode.REQUIRED, example = "17918")
+    @ExcelProperty("设备id")
+    private Long deviceId;
+
+    @Schema(description = "分类id", requiredMode = Schema.RequiredMode.REQUIRED, example = "17918")
+    @ExcelProperty("分类id")
+    private Long classId;
+
+    @Schema(description = "部门id", requiredMode = Schema.RequiredMode.REQUIRED, example = "2503")
+    @ExcelProperty("部门id")
+    private Long orgId;
+
+    @Schema(description = "文件名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
+    @ExcelProperty("文件名称")
+    private String filename;
+
+    @Schema(description = "文件类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
+    @ExcelProperty("文件类型")
+    private String fileType;
+
+    @Schema(description = "文件路径", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("文件路径")
+    private String filePath;
+
+    @Schema(description = "备注", example = "随便")
+    @ExcelProperty("备注")
+    private String remark;
+
+    @Schema(description = "创建时间")
+    @ExcelProperty("创建时间")
+    private LocalDateTime createTime;
+
+}

+ 42 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/vo/IotInfoSaveReqVO.java

@@ -0,0 +1,42 @@
+package cn.iocoder.yudao.module.pms.controller.admin.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+import java.util.*;
+import javax.validation.constraints.*;
+
+@Schema(description = "管理后台 - 资料新增/修改 Request VO")
+@Data
+public class IotInfoSaveReqVO {
+
+    @Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "31940")
+    private Long id;
+
+    @Schema(description = "设备id", requiredMode = Schema.RequiredMode.REQUIRED, example = "17918")
+    @NotNull(message = "设备id不能为空")
+    private Long deviceId;
+
+    @Schema(description = "分类id", requiredMode = Schema.RequiredMode.REQUIRED, example = "17918")
+    @NotNull(message = "分类id不能为空")
+    private Long classId;
+
+    @Schema(description = "部门id", requiredMode = Schema.RequiredMode.REQUIRED, example = "2503")
+    @NotNull(message = "部门id不能为空")
+    private Long orgId;
+
+    @Schema(description = "文件名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
+    @NotEmpty(message = "文件名称不能为空")
+    private String filename;
+
+    @Schema(description = "文件类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
+    @NotEmpty(message = "文件类型不能为空")
+    private String fileType;
+
+    @Schema(description = "文件路径", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotEmpty(message = "文件路径不能为空")
+    private String filePath;
+
+    @Schema(description = "备注", example = "随便")
+    private String remark;
+
+}

+ 1 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/IotInfoClassifyDO.java

@@ -46,4 +46,5 @@ public class IotInfoClassifyDO extends BaseDO {
 
     private String remark;
 
+    private Long deviceId;
 }

+ 59 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/IotInfoDO.java

@@ -0,0 +1,59 @@
+package cn.iocoder.yudao.module.pms.dal.dataobject;
+
+import lombok.*;
+import java.util.*;
+import java.time.LocalDateTime;
+import java.time.LocalDateTime;
+import com.baomidou.mybatisplus.annotation.*;
+import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
+
+/**
+ * 资料 DO
+ *
+ * @author 芋道源码
+ */
+@TableName("rq_iot_info")
+@KeySequence("rq_iot_info_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class IotInfoDO extends BaseDO {
+
+    /**
+     * 主键id
+     */
+    @TableId
+    private Long id;
+    /**
+     * 设备id
+     */
+    private Long deviceId;
+    /**
+     * 分类id
+     */
+    private Long classId;
+    /**
+     * 部门id
+     */
+    private Long orgId;
+    /**
+     * 文件名称
+     */
+    private String filename;
+    /**
+     * 文件类型
+     */
+    private String fileType;
+    /**
+     * 文件路径
+     */
+    private String filePath;
+    /**
+     * 备注
+     */
+    private String remark;
+
+}

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

@@ -0,0 +1,33 @@
+package cn.iocoder.yudao.module.pms.dal.mysql;
+
+import java.util.*;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.module.pms.controller.admin.vo.IotInfoPageReqVO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.IotInfoDO;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 资料 Mapper
+ *
+ * @author 芋道源码
+ */
+@Mapper
+public interface IotInfoMapper extends BaseMapperX<IotInfoDO> {
+
+    default PageResult<IotInfoDO> selectPage(IotInfoPageReqVO reqVO) {
+        return selectPage(reqVO, new LambdaQueryWrapperX<IotInfoDO>()
+                .eqIfPresent(IotInfoDO::getDeviceId, reqVO.getDeviceId())
+                .eqIfPresent(IotInfoDO::getOrgId, reqVO.getOrgId())
+                .likeIfPresent(IotInfoDO::getFilename, reqVO.getFilename())
+                .eqIfPresent(IotInfoDO::getFileType, reqVO.getFileType())
+                .eqIfPresent(IotInfoDO::getFilePath, reqVO.getFilePath())
+                .eqIfPresent(IotInfoDO::getClassId, reqVO.getClassId())
+                .eqIfPresent(IotInfoDO::getRemark, reqVO.getRemark())
+                .betweenIfPresent(IotInfoDO::getCreateTime, reqVO.getCreateTime())
+                .orderByDesc(IotInfoDO::getId));
+    }
+
+}

+ 13 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/IotDeviceServiceImpl.java

@@ -5,8 +5,11 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
 import cn.iocoder.yudao.module.pms.controller.admin.vo.IotDevicePageReqVO;
 import cn.iocoder.yudao.module.pms.controller.admin.vo.IotDeviceSaveReqVO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.IotDeviceDO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.IotInfoClassifyDO;
 import cn.iocoder.yudao.module.pms.dal.mysql.IotDeviceMapper;
+import cn.iocoder.yudao.module.pms.dal.mysql.IotInfoClassifyMapper;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.annotation.Validated;
 
 import javax.annotation.Resource;
@@ -25,13 +28,23 @@ public class IotDeviceServiceImpl implements IotDeviceService {
 
     @Resource
     private IotDeviceMapper iotDeviceMapper;
+    @Resource
+    private IotInfoClassifyMapper iotInfoClassifyMapper;
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public Long createIotDevice(IotDeviceSaveReqVO createReqVO) {
         // 插入
         IotDeviceDO iotDevice = BeanUtils.toBean(createReqVO, IotDeviceDO.class);
         iotDevice.setDeleted(false);
         iotDeviceMapper.insert(iotDevice);
+        //插入资料
+        IotInfoClassifyDO infoClassifyDO = new IotInfoClassifyDO();
+        infoClassifyDO.setName(iotDevice.getDeviceName()+"设备资料");
+        infoClassifyDO.setStatus(0);
+        infoClassifyDO.setParentId(0L);
+        infoClassifyDO.setDeviceId(iotDevice.getId());
+        iotInfoClassifyMapper.insert(infoClassifyDO);
         // 返回
         return iotDevice.getId();
     }

+ 56 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/IotInfoService.java

@@ -0,0 +1,56 @@
+package cn.iocoder.yudao.module.pms.service;
+
+import java.util.*;
+import javax.validation.*;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import cn.iocoder.yudao.module.pms.controller.admin.vo.IotInfoPageReqVO;
+import cn.iocoder.yudao.module.pms.controller.admin.vo.IotInfoSaveReqVO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.IotInfoDO;
+
+/**
+ * 资料 Service 接口
+ *
+ * @author 芋道源码
+ */
+public interface IotInfoService {
+
+    /**
+     * 创建资料
+     *
+     * @param createReqVO 创建信息
+     * @return 编号
+     */
+    Long createIotInfo(@Valid IotInfoSaveReqVO createReqVO);
+
+    /**
+     * 更新资料
+     *
+     * @param updateReqVO 更新信息
+     */
+    void updateIotInfo(@Valid IotInfoSaveReqVO updateReqVO);
+
+    /**
+     * 删除资料
+     *
+     * @param id 编号
+     */
+    void deleteIotInfo(Long id);
+
+    /**
+     * 获得资料
+     *
+     * @param id 编号
+     * @return 资料
+     */
+    IotInfoDO getIotInfo(Long id);
+
+    /**
+     * 获得资料分页
+     *
+     * @param pageReqVO 分页查询
+     * @return 资料分页
+     */
+    PageResult<IotInfoDO> getIotInfoPage(IotInfoPageReqVO pageReqVO);
+
+}

+ 75 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/IotInfoServiceImpl.java

@@ -0,0 +1,75 @@
+package cn.iocoder.yudao.module.pms.service;
+
+import cn.iocoder.yudao.module.pms.controller.admin.vo.IotInfoPageReqVO;
+import cn.iocoder.yudao.module.pms.controller.admin.vo.IotInfoSaveReqVO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.IotInfoDO;
+import cn.iocoder.yudao.module.pms.dal.mysql.IotInfoMapper;
+import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.*;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+
+
+import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstant.IOT_INFO_NOT_EXISTS;
+
+/**
+ * 资料 Service 实现类
+ *
+ * @author 芋道源码
+ */
+@Service
+@Validated
+public class IotInfoServiceImpl implements IotInfoService {
+
+    @Resource
+    private IotInfoMapper iotInfoMapper;
+
+    @Override
+    public Long createIotInfo(IotInfoSaveReqVO createReqVO) {
+        // 插入
+        IotInfoDO iotInfo = BeanUtils.toBean(createReqVO, IotInfoDO.class);
+        iotInfoMapper.insert(iotInfo);
+        // 返回
+        return iotInfo.getId();
+    }
+
+    @Override
+    public void updateIotInfo(IotInfoSaveReqVO updateReqVO) {
+        // 校验存在
+        validateIotInfoExists(updateReqVO.getId());
+        // 更新
+        IotInfoDO updateObj = BeanUtils.toBean(updateReqVO, IotInfoDO.class);
+        iotInfoMapper.updateById(updateObj);
+    }
+
+    @Override
+    public void deleteIotInfo(Long id) {
+        // 校验存在
+        validateIotInfoExists(id);
+        // 删除
+        iotInfoMapper.deleteById(id);
+    }
+
+    private void validateIotInfoExists(Long id) {
+        if (iotInfoMapper.selectById(id) == null) {
+            throw exception(IOT_INFO_NOT_EXISTS);
+        }
+    }
+
+    @Override
+    public IotInfoDO getIotInfo(Long id) {
+        return iotInfoMapper.selectById(id);
+    }
+
+    @Override
+    public PageResult<IotInfoDO> getIotInfoPage(IotInfoPageReqVO pageReqVO) {
+        return iotInfoMapper.selectPage(pageReqVO);
+    }
+
+}