Explorar o código

添加隐患排查分类simple接口

Zimo hai 2 semanas
pai
achega
c8db83630a

+ 9 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/qhse/hazard/IotHazardTypeController.java

@@ -1,6 +1,7 @@
 package cn.iocoder.yudao.module.pms.controller.admin.qhse.hazard;
 
 import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
+import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
 import cn.iocoder.yudao.framework.common.pojo.PageParam;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
@@ -9,6 +10,7 @@ import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
 import cn.iocoder.yudao.module.pms.controller.admin.qhse.hazard.vo.IotHazardTypePageReqVO;
 import cn.iocoder.yudao.module.pms.controller.admin.qhse.hazard.vo.IotHazardTypeRespVO;
 import cn.iocoder.yudao.module.pms.controller.admin.qhse.hazard.vo.IotHazardTypeSaveReqVO;
+import cn.iocoder.yudao.module.pms.controller.admin.vo.IotProductClassifySimpleRespVO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.hazard.IotHazardTypeDO;
 import cn.iocoder.yudao.module.pms.service.qhse.hazard.IotHazardTypeService;
 import io.swagger.v3.oas.annotations.Operation;
@@ -91,4 +93,11 @@ public class IotHazardTypeController {
                         BeanUtils.toBean(list, IotHazardTypeRespVO.class));
     }
 
+    @GetMapping(value = {"/list-all-simple", "/simple-list"})
+    @Operation(summary = "获取SOC数据源精简信息列表")
+    public CommonResult<List<IotProductClassifySimpleRespVO>> getSimpleIotProductClassifyList() {
+        List<IotHazardTypeDO> list = iotHazardTypeService.getHazardTypeList(
+                new IotHazardTypePageReqVO().setStatus(CommonStatusEnum.ENABLE.getStatus()));
+        return success(BeanUtils.toBean(list, IotProductClassifySimpleRespVO.class));
+    }
 }

+ 9 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/qhse/hazard/IotHazardTypeMapper.java

@@ -7,6 +7,8 @@ import cn.iocoder.yudao.module.pms.controller.admin.qhse.hazard.vo.IotHazardType
 import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.hazard.IotHazardTypeDO;
 import org.apache.ibatis.annotations.Mapper;
 
+import java.util.List;
+
 /**
  * QHSE-隐患排查分类 Mapper
  *
@@ -34,4 +36,11 @@ public interface IotHazardTypeMapper extends BaseMapperX<IotHazardTypeDO> {
     default Long selectCountByParentId(Long parentId) {
         return selectCount(IotHazardTypeDO::getParentId, parentId);
     }
+
+    default List<IotHazardTypeDO> selectList(IotHazardTypePageReqVO reqVO) {
+        return selectList(new LambdaQueryWrapperX<IotHazardTypeDO>()
+                .likeIfPresent(IotHazardTypeDO::getName, reqVO.getName())
+                .likeIfPresent(IotHazardTypeDO::getRemark, reqVO.getRemark())
+                .eqIfPresent(IotHazardTypeDO::getStatus, reqVO.getStatus()));
+    }
 }

+ 2 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/qhse/hazard/IotHazardTypeService.java

@@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.pms.controller.admin.qhse.hazard.vo.IotHazardType
 import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.hazard.IotHazardTypeDO;
 
 import javax.validation.Valid;
+import java.util.List;
 
 /**
  * QHSE-隐患排查分类 Service 接口
@@ -13,7 +14,7 @@ import javax.validation.Valid;
  * @author 超级管理员
  */
 public interface IotHazardTypeService {
-
+    List<IotHazardTypeDO> getHazardTypeList(IotHazardTypePageReqVO pageReqVO);
     /**
      * 创建QHSE-隐患排查分类
      *

+ 9 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/qhse/hazard/IotHazardTypeServiceImpl.java

@@ -15,6 +15,8 @@ import org.springframework.stereotype.Service;
 import org.springframework.validation.annotation.Validated;
 
 import javax.annotation.Resource;
+import java.util.Comparator;
+import java.util.List;
 import java.util.Objects;
 
 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
@@ -32,6 +34,13 @@ public class IotHazardTypeServiceImpl implements IotHazardTypeService {
     @Resource
     private IotHazardTypeMapper iotHazardTypeMapper;
 
+    @Override
+    public List<IotHazardTypeDO> getHazardTypeList(IotHazardTypePageReqVO pageReqVO) {
+        List<IotHazardTypeDO> list = iotHazardTypeMapper.selectList(pageReqVO);
+        list.sort(Comparator.comparing(IotHazardTypeDO::getSort));
+        return list;
+    }
+
     @Override
     public Long createIotHazardType(IotHazardTypeSaveReqVO createReqVO) {
         if (createReqVO.getParentId() == null) {