Explorar o código

环境因素识别

Zimo hai 6 días
pai
achega
5c34c8e18d

+ 98 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/qhse/environment/IotEnvironmentRecognizeController.java

@@ -0,0 +1,98 @@
+package cn.iocoder.yudao.module.pms.controller.admin.qhse.environment;
+
+import cn.iocoder.yudao.module.pms.controller.admin.qhse.environment.vo.IotEnvironmentRecognizePageReqVO;
+import cn.iocoder.yudao.module.pms.controller.admin.qhse.environment.vo.IotEnvironmentRecognizeRespVO;
+import cn.iocoder.yudao.module.pms.controller.admin.qhse.environment.vo.IotEnvironmentRecognizeSaveReqVO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.environment.IotEnvironmentRecognizeDO;
+import cn.iocoder.yudao.module.pms.service.qhse.environment.IotEnvironmentRecognizeService;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.security.access.prepost.PreAuthorize;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.Operation;
+
+import java.util.*;
+import java.io.IOException;
+
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+
+import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
+
+import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+
+import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
+
+
+@Tag(name = "管理后台 - 环境因素识别")
+@RestController
+@RequestMapping("/rq/iot-environment-recognize")
+@Validated
+public class IotEnvironmentRecognizeController {
+
+    @Resource
+    private IotEnvironmentRecognizeService iotEnvironmentRecognizeService;
+
+    @PostMapping("/create")
+    @Operation(summary = "创建环境因素识别")
+    @PreAuthorize("@ss.hasPermission('rq:iot-environment-recognize:create')")
+    public CommonResult<Long> createIotEnvironmentRecognize(@Valid @RequestBody IotEnvironmentRecognizeSaveReqVO createReqVO) {
+        return success(iotEnvironmentRecognizeService.createIotEnvironmentRecognize(createReqVO));
+    }
+
+    @PutMapping("/update")
+    @Operation(summary = "更新环境因素识别")
+    @PreAuthorize("@ss.hasPermission('rq:iot-environment-recognize:update')")
+    public CommonResult<Boolean> updateIotEnvironmentRecognize(@Valid @RequestBody IotEnvironmentRecognizeSaveReqVO updateReqVO) {
+        iotEnvironmentRecognizeService.updateIotEnvironmentRecognize(updateReqVO);
+        return success(true);
+    }
+
+    @DeleteMapping("/delete")
+    @Operation(summary = "删除环境因素识别")
+    @Parameter(name = "id", description = "编号", required = true)
+    @PreAuthorize("@ss.hasPermission('rq:iot-environment-recognize:delete')")
+    public CommonResult<Boolean> deleteIotEnvironmentRecognize(@RequestParam("id") Long id) {
+        iotEnvironmentRecognizeService.deleteIotEnvironmentRecognize(id);
+        return success(true);
+    }
+
+    @GetMapping("/get")
+    @Operation(summary = "获得环境因素识别")
+    @Parameter(name = "id", description = "编号", required = true, example = "1024")
+    @PreAuthorize("@ss.hasPermission('rq:iot-environment-recognize:query')")
+    public CommonResult<IotEnvironmentRecognizeRespVO> getIotEnvironmentRecognize(@RequestParam("id") Long id) {
+        IotEnvironmentRecognizeDO iotEnvironmentRecognize = iotEnvironmentRecognizeService.getIotEnvironmentRecognize(id);
+        return success(BeanUtils.toBean(iotEnvironmentRecognize, IotEnvironmentRecognizeRespVO.class));
+    }
+
+    @GetMapping("/page")
+    @Operation(summary = "获得环境因素识别分页")
+    @PreAuthorize("@ss.hasPermission('rq:iot-environment-recognize:query')")
+    public CommonResult<PageResult<IotEnvironmentRecognizeRespVO>> getIotEnvironmentRecognizePage(@Valid IotEnvironmentRecognizePageReqVO pageReqVO) {
+        PageResult<IotEnvironmentRecognizeDO> pageResult = iotEnvironmentRecognizeService.getIotEnvironmentRecognizePage(pageReqVO);
+        return success(BeanUtils.toBean(pageResult, IotEnvironmentRecognizeRespVO.class));
+    }
+
+    @GetMapping("/export-excel")
+    @Operation(summary = "导出环境因素识别 Excel")
+    @PreAuthorize("@ss.hasPermission('rq:iot-environment-recognize:export')")
+    @ApiAccessLog(operateType = EXPORT)
+    public void exportIotEnvironmentRecognizeExcel(@Valid IotEnvironmentRecognizePageReqVO pageReqVO,
+              HttpServletResponse response) throws IOException {
+        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+        List<IotEnvironmentRecognizeDO> list = iotEnvironmentRecognizeService.getIotEnvironmentRecognizePage(pageReqVO).getList();
+        // 导出 Excel
+        ExcelUtils.write(response, "环境因素识别.xls", "数据", IotEnvironmentRecognizeRespVO.class,
+                        BeanUtils.toBean(list, IotEnvironmentRecognizeRespVO.class));
+    }
+
+}

+ 79 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/qhse/environment/vo/IotEnvironmentRecognizePageReqVO.java

@@ -0,0 +1,79 @@
+package cn.iocoder.yudao.module.pms.controller.admin.qhse.environment.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 IotEnvironmentRecognizePageReqVO extends PageParam {
+
+    @Schema(description = "工序")
+    private String process;
+
+    @Schema(description = "步骤分解")
+    private String stepBreak;
+
+    @Schema(description = "环境因素")
+    private String environmentElement;
+
+    @Schema(description = "时态-过去")
+    private Boolean timeBefore;
+
+    @Schema(description = "时态-现在")
+    private Boolean timeNow;
+
+    @Schema(description = "时态-将来")
+    private Boolean timeFuture;
+
+    @Schema(description = "状态-正常")
+    private Boolean statusNormal;
+
+    @Schema(description = "状态-异常")
+    private Boolean statusException;
+
+    @Schema(description = "状态-紧急")
+    private Boolean statusDanger;
+
+    @Schema(description = "环境影响类型-能源")
+    private Boolean typeEnergy;
+
+    @Schema(description = "环境影响类型-水体")
+    private Boolean typeWater;
+
+    @Schema(description = "环境影响类型-大气")
+    private Boolean typeGas;
+
+    @Schema(description = "环境影响类型-噪音")
+    private Boolean typeNoise;
+
+    @Schema(description = "环境影响类型-废弃物")
+    private Boolean typeWaste;
+
+    @Schema(description = "环境影响类型-土壤")
+    private Boolean typeSoil;
+
+    @Schema(description = "环境影响类型-其他")
+    private Boolean typeOther;
+
+    @Schema(description = "控制措施")
+    private String controlMethod;
+
+    @Schema(description = "创建时间")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private LocalDateTime[] createTime;
+
+    @Schema(description = "备注", example = "你猜")
+    private String remark;
+
+    @Schema(description = "部门id", example = "31868")
+    private Long deptId;
+
+}

+ 99 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/qhse/environment/vo/IotEnvironmentRecognizeRespVO.java

@@ -0,0 +1,99 @@
+package cn.iocoder.yudao.module.pms.controller.admin.qhse.environment.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 IotEnvironmentRecognizeRespVO {
+
+    @Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "21060")
+    @ExcelProperty("主键id")
+    private Long id;
+
+    @Schema(description = "工序")
+    @ExcelProperty("工序")
+    private String process;
+
+    @Schema(description = "步骤分解")
+    @ExcelProperty("步骤分解")
+    private String stepBreak;
+
+    @Schema(description = "环境因素")
+    @ExcelProperty("环境因素")
+    private String environmentElement;
+
+    @Schema(description = "时态-过去")
+    @ExcelProperty("时态-过去")
+    private Boolean timeBefore;
+
+    @Schema(description = "时态-现在")
+    @ExcelProperty("时态-现在")
+    private Boolean timeNow;
+
+    @Schema(description = "时态-将来")
+    @ExcelProperty("时态-将来")
+    private Boolean timeFuture;
+
+    @Schema(description = "状态-正常")
+    @ExcelProperty("状态-正常")
+    private Boolean statusNormal;
+
+    @Schema(description = "状态-异常")
+    @ExcelProperty("状态-异常")
+    private Boolean statusException;
+
+    @Schema(description = "状态-紧急")
+    @ExcelProperty("状态-紧急")
+    private Boolean statusDanger;
+
+    @Schema(description = "环境影响类型-能源")
+    @ExcelProperty("环境影响类型-能源")
+    private Boolean typeEnergy;
+
+    @Schema(description = "环境影响类型-水体")
+    @ExcelProperty("环境影响类型-水体")
+    private Boolean typeWater;
+
+    @Schema(description = "环境影响类型-大气")
+    @ExcelProperty("环境影响类型-大气")
+    private Boolean typeGas;
+
+    @Schema(description = "环境影响类型-噪音")
+    @ExcelProperty("环境影响类型-噪音")
+    private Boolean typeNoise;
+
+    @Schema(description = "环境影响类型-废弃物")
+    @ExcelProperty("环境影响类型-废弃物")
+    private Boolean typeWaste;
+
+    @Schema(description = "环境影响类型-土壤")
+    @ExcelProperty("环境影响类型-土壤")
+    private Boolean typeSoil;
+
+    @Schema(description = "环境影响类型-其他")
+    @ExcelProperty("环境影响类型-其他")
+    private Boolean typeOther;
+
+    @Schema(description = "控制措施")
+    @ExcelProperty("控制措施")
+    private String controlMethod;
+
+    @Schema(description = "创建时间")
+    @ExcelProperty("创建时间")
+    private LocalDateTime createTime;
+
+    @Schema(description = "备注", example = "你猜")
+    @ExcelProperty("备注")
+    private String remark;
+
+    @Schema(description = "部门id", example = "31868")
+    @ExcelProperty("部门id")
+    private Long deptId;
+
+}

+ 71 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/qhse/environment/vo/IotEnvironmentRecognizeSaveReqVO.java

@@ -0,0 +1,71 @@
+package cn.iocoder.yudao.module.pms.controller.admin.qhse.environment.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+import java.util.*;
+
+@Schema(description = "管理后台 - 环境因素识别新增/修改 Request VO")
+@Data
+public class IotEnvironmentRecognizeSaveReqVO {
+
+    @Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "21060")
+    private Long id;
+
+    @Schema(description = "工序")
+    private String process;
+
+    @Schema(description = "步骤分解")
+    private String stepBreak;
+
+    @Schema(description = "环境因素")
+    private String environmentElement;
+
+    @Schema(description = "时态-过去")
+    private Boolean timeBefore;
+
+    @Schema(description = "时态-现在")
+    private Boolean timeNow;
+
+    @Schema(description = "时态-将来")
+    private Boolean timeFuture;
+
+    @Schema(description = "状态-正常")
+    private Boolean statusNormal;
+
+    @Schema(description = "状态-异常")
+    private Boolean statusException;
+
+    @Schema(description = "状态-紧急")
+    private Boolean statusDanger;
+
+    @Schema(description = "环境影响类型-能源")
+    private Boolean typeEnergy;
+
+    @Schema(description = "环境影响类型-水体")
+    private Boolean typeWater;
+
+    @Schema(description = "环境影响类型-大气")
+    private Boolean typeGas;
+
+    @Schema(description = "环境影响类型-噪音")
+    private Boolean typeNoise;
+
+    @Schema(description = "环境影响类型-废弃物")
+    private Boolean typeWaste;
+
+    @Schema(description = "环境影响类型-土壤")
+    private Boolean typeSoil;
+
+    @Schema(description = "环境影响类型-其他")
+    private Boolean typeOther;
+
+    @Schema(description = "控制措施")
+    private String controlMethod;
+
+    @Schema(description = "备注", example = "你猜")
+    private String remark;
+
+    @Schema(description = "部门id", example = "31868")
+    private Long deptId;
+
+}

+ 107 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/qhse/environment/IotEnvironmentRecognizeDO.java

@@ -0,0 +1,107 @@
+package cn.iocoder.yudao.module.pms.dal.dataobject.qhse.environment;
+
+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_environment_recognize")
+@KeySequence("rq_iot_environment_recognize_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class IotEnvironmentRecognizeDO extends BaseDO {
+
+    /**
+     * 主键id
+     */
+    @TableId
+    private Long id;
+    /**
+     * 工序
+     */
+    private String process;
+    /**
+     * 步骤分解
+     */
+    private String stepBreak;
+    /**
+     * 环境因素
+     */
+    private String environmentElement;
+    /**
+     * 时态-过去
+     */
+    private Boolean timeBefore;
+    /**
+     * 时态-现在
+     */
+    private Boolean timeNow;
+    /**
+     * 时态-将来
+     */
+    private Boolean timeFuture;
+    /**
+     * 状态-正常
+     */
+    private Boolean statusNormal;
+    /**
+     * 状态-异常
+     */
+    private Boolean statusException;
+    /**
+     * 状态-紧急
+     */
+    private Boolean statusDanger;
+    /**
+     * 环境影响类型-能源
+     */
+    private Boolean typeEnergy;
+    /**
+     * 环境影响类型-水体
+     */
+    private Boolean typeWater;
+    /**
+     * 环境影响类型-大气
+     */
+    private Boolean typeGas;
+    /**
+     * 环境影响类型-噪音
+     */
+    private Boolean typeNoise;
+    /**
+     * 环境影响类型-废弃物
+     */
+    private Boolean typeWaste;
+    /**
+     * 环境影响类型-土壤
+     */
+    private Boolean typeSoil;
+    /**
+     * 环境影响类型-其他
+     */
+    private Boolean typeOther;
+    /**
+     * 控制措施
+     */
+    private String controlMethod;
+    /**
+     * 备注
+     */
+    private String remark;
+    /**
+     * 部门id
+     */
+    private Long deptId;
+
+}

+ 45 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/qhse/environment/IotEnvironmentRecognizeMapper.java

@@ -0,0 +1,45 @@
+package cn.iocoder.yudao.module.pms.dal.mysql.qhse.environment;
+
+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.qhse.environment.vo.IotEnvironmentRecognizePageReqVO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.environment.IotEnvironmentRecognizeDO;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 环境因素识别 Mapper
+ *
+ * @author 超级管理员
+ */
+@Mapper
+public interface IotEnvironmentRecognizeMapper extends BaseMapperX<IotEnvironmentRecognizeDO> {
+
+    default PageResult<IotEnvironmentRecognizeDO> selectPage(IotEnvironmentRecognizePageReqVO reqVO) {
+        return selectPage(reqVO, new LambdaQueryWrapperX<IotEnvironmentRecognizeDO>()
+                .eqIfPresent(IotEnvironmentRecognizeDO::getProcess, reqVO.getProcess())
+                .eqIfPresent(IotEnvironmentRecognizeDO::getStepBreak, reqVO.getStepBreak())
+                .eqIfPresent(IotEnvironmentRecognizeDO::getEnvironmentElement, reqVO.getEnvironmentElement())
+                .eqIfPresent(IotEnvironmentRecognizeDO::getTimeBefore, reqVO.getTimeBefore())
+                .eqIfPresent(IotEnvironmentRecognizeDO::getTimeNow, reqVO.getTimeNow())
+                .eqIfPresent(IotEnvironmentRecognizeDO::getTimeFuture, reqVO.getTimeFuture())
+                .eqIfPresent(IotEnvironmentRecognizeDO::getStatusNormal, reqVO.getStatusNormal())
+                .eqIfPresent(IotEnvironmentRecognizeDO::getStatusException, reqVO.getStatusException())
+                .eqIfPresent(IotEnvironmentRecognizeDO::getStatusDanger, reqVO.getStatusDanger())
+                .eqIfPresent(IotEnvironmentRecognizeDO::getTypeEnergy, reqVO.getTypeEnergy())
+                .eqIfPresent(IotEnvironmentRecognizeDO::getTypeWater, reqVO.getTypeWater())
+                .eqIfPresent(IotEnvironmentRecognizeDO::getTypeGas, reqVO.getTypeGas())
+                .eqIfPresent(IotEnvironmentRecognizeDO::getTypeNoise, reqVO.getTypeNoise())
+                .eqIfPresent(IotEnvironmentRecognizeDO::getTypeWaste, reqVO.getTypeWaste())
+                .eqIfPresent(IotEnvironmentRecognizeDO::getTypeSoil, reqVO.getTypeSoil())
+                .eqIfPresent(IotEnvironmentRecognizeDO::getTypeOther, reqVO.getTypeOther())
+                .eqIfPresent(IotEnvironmentRecognizeDO::getControlMethod, reqVO.getControlMethod())
+                .betweenIfPresent(IotEnvironmentRecognizeDO::getCreateTime, reqVO.getCreateTime())
+                .eqIfPresent(IotEnvironmentRecognizeDO::getRemark, reqVO.getRemark())
+                .eqIfPresent(IotEnvironmentRecognizeDO::getDeptId, reqVO.getDeptId())
+                .orderByDesc(IotEnvironmentRecognizeDO::getId));
+    }
+
+}

+ 57 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/qhse/environment/IotEnvironmentRecognizeService.java

@@ -0,0 +1,57 @@
+package cn.iocoder.yudao.module.pms.service.qhse.environment;
+
+import java.util.*;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import cn.iocoder.yudao.module.pms.controller.admin.qhse.environment.vo.IotEnvironmentRecognizePageReqVO;
+import cn.iocoder.yudao.module.pms.controller.admin.qhse.environment.vo.IotEnvironmentRecognizeSaveReqVO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.environment.IotEnvironmentRecognizeDO;
+
+import javax.validation.Valid;
+
+/**
+ * 环境因素识别 Service 接口
+ *
+ * @author 超级管理员
+ */
+public interface IotEnvironmentRecognizeService {
+
+    /**
+     * 创建环境因素识别
+     *
+     * @param createReqVO 创建信息
+     * @return 编号
+     */
+    Long createIotEnvironmentRecognize(@Valid IotEnvironmentRecognizeSaveReqVO createReqVO);
+
+    /**
+     * 更新环境因素识别
+     *
+     * @param updateReqVO 更新信息
+     */
+    void updateIotEnvironmentRecognize(@Valid IotEnvironmentRecognizeSaveReqVO updateReqVO);
+
+    /**
+     * 删除环境因素识别
+     *
+     * @param id 编号
+     */
+    void deleteIotEnvironmentRecognize(Long id);
+
+    /**
+     * 获得环境因素识别
+     *
+     * @param id 编号
+     * @return 环境因素识别
+     */
+    IotEnvironmentRecognizeDO getIotEnvironmentRecognize(Long id);
+
+    /**
+     * 获得环境因素识别分页
+     *
+     * @param pageReqVO 分页查询
+     * @return 环境因素识别分页
+     */
+    PageResult<IotEnvironmentRecognizeDO> getIotEnvironmentRecognizePage(IotEnvironmentRecognizePageReqVO pageReqVO);
+
+}

+ 77 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/qhse/environment/IotEnvironmentRecognizeServiceImpl.java

@@ -0,0 +1,77 @@
+package cn.iocoder.yudao.module.pms.service.qhse.environment;
+
+import cn.iocoder.yudao.framework.common.exception.ErrorCode;
+import cn.iocoder.yudao.module.pms.controller.admin.qhse.environment.vo.IotEnvironmentRecognizePageReqVO;
+import cn.iocoder.yudao.module.pms.controller.admin.qhse.environment.vo.IotEnvironmentRecognizeSaveReqVO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.environment.IotEnvironmentRecognizeDO;
+import cn.iocoder.yudao.module.pms.dal.mysql.qhse.environment.IotEnvironmentRecognizeMapper;
+import org.springframework.stereotype.Service;
+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 javax.annotation.Resource;
+
+import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
+
+/**
+ * 环境因素识别 Service 实现类
+ *
+ * @author 超级管理员
+ */
+@Service
+@Validated
+public class IotEnvironmentRecognizeServiceImpl implements IotEnvironmentRecognizeService {
+
+    @Resource
+    private IotEnvironmentRecognizeMapper iotEnvironmentRecognizeMapper;
+
+    @Override
+    public Long createIotEnvironmentRecognize(IotEnvironmentRecognizeSaveReqVO createReqVO) {
+        // 插入
+        IotEnvironmentRecognizeDO iotEnvironmentRecognize = BeanUtils.toBean(createReqVO, IotEnvironmentRecognizeDO.class);
+        iotEnvironmentRecognize.setDeleted(false);
+        iotEnvironmentRecognizeMapper.insert(iotEnvironmentRecognize);
+        // 返回
+        return iotEnvironmentRecognize.getId();
+    }
+
+    @Override
+    public void updateIotEnvironmentRecognize(IotEnvironmentRecognizeSaveReqVO updateReqVO) {
+        // 校验存在
+        validateIotEnvironmentRecognizeExists(updateReqVO.getId());
+        // 更新
+        IotEnvironmentRecognizeDO updateObj = BeanUtils.toBean(updateReqVO, IotEnvironmentRecognizeDO.class);
+        iotEnvironmentRecognizeMapper.updateById(updateObj);
+    }
+
+    @Override
+    public void deleteIotEnvironmentRecognize(Long id) {
+        // 校验存在
+        validateIotEnvironmentRecognizeExists(id);
+        // 删除
+        iotEnvironmentRecognizeMapper.deleteById(id);
+    }
+
+    private void validateIotEnvironmentRecognizeExists(Long id) {
+        if (iotEnvironmentRecognizeMapper.selectById(id) == null) {
+            throw exception(new ErrorCode(1,"不存在"));
+        }
+    }
+
+    @Override
+    public IotEnvironmentRecognizeDO getIotEnvironmentRecognize(Long id) {
+        return iotEnvironmentRecognizeMapper.selectById(id);
+    }
+
+    @Override
+    public PageResult<IotEnvironmentRecognizeDO> getIotEnvironmentRecognizePage(IotEnvironmentRecognizePageReqVO pageReqVO) {
+        return iotEnvironmentRecognizeMapper.selectPage(pageReqVO);
+    }
+
+}