From 9587d2bc8fa6b236c26ab04de6e68de9c7a9845f Mon Sep 17 00:00:00 2001
From: liriming <1343021927@qq.com>
Date: 星期四, 28 十一月 2024 09:20:19 +0800
Subject: [PATCH] 获取预警配置列表接口

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictAlarmConfigServiceImpl.java |   15 +++++++++++++--
 iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mcs/MmPredictAlarmConfigDao.xml                                       |   19 +++++++++++++++++++
 iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/McsApi.java                                       |    4 ++++
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmPredictAlarmConfigService.java          |    6 ++++++
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java                                       |    9 +++++++++
 5 files changed, 51 insertions(+), 2 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/McsApi.java b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/McsApi.java
index ee39d33..512dad7 100644
--- a/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/McsApi.java
+++ b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/McsApi.java
@@ -52,6 +52,10 @@
     @Operation(summary = "获取预警信息列表")
     List<AlarmMessageRespDTO> listAlarmMessage(@RequestParam Map<String, Object> params);
 
+    @PostMapping(PREFIX + "/alarm-config/list")
+    @Operation(summary = "获取预警配置列表")
+    List<AlarmConfigRespDTO> listAlarmConfig(@RequestParam Map<String, Object> params);
+
     @PostMapping(PREFIX + "/schedule-suggest/create")
     @Operation(summary = "添加调度建议")
     Boolean createScheduleSuggest(@RequestBody ScheduleSuggestRespDTO dto);
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java
index 3aa0c92..7092979 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java
@@ -16,6 +16,7 @@
 import com.iailab.module.model.mcs.pre.entity.DmModuleEntity;
 import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity;
 import com.iailab.module.model.mcs.pre.service.*;
+import com.iailab.module.model.mcs.pre.service.impl.MmPredictAlarmConfigServiceImpl;
 import com.iailab.module.model.mdk.vo.ItemVO;
 import com.iailab.module.model.mpk.service.ChartService;
 import lombok.extern.slf4j.Slf4j;
@@ -65,6 +66,9 @@
 
     @Autowired
     private PlanItemApi planItemApi;
+
+    @Autowired
+    private MmPredictAlarmConfigService mmPredictAlarmConfigService;
 
     private int HOUR_MINS = 60;
 
@@ -463,6 +467,11 @@
     }
 
     @Override
+    public List<AlarmConfigRespDTO> listAlarmConfig(Map<String, Object> params) {
+        return mmPredictAlarmConfigService.list(params);
+    }
+
+    @Override
     public Boolean createScheduleSuggest(ScheduleSuggestRespDTO dto) {
         return true;
     }
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmPredictAlarmConfigService.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmPredictAlarmConfigService.java
index 9009260..fb480b2 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmPredictAlarmConfigService.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmPredictAlarmConfigService.java
@@ -3,10 +3,14 @@
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.iailab.framework.common.pojo.PageResult;
 import com.iailab.framework.common.service.BaseService;
+import com.iailab.module.model.api.mcs.dto.AlarmConfigRespDTO;
 import com.iailab.module.model.mcs.pre.entity.MmPredictAlarmConfigEntity;
 import com.iailab.module.model.mcs.pre.vo.MmPredictAlarmConfigPageReqVO;
 import com.iailab.module.model.mcs.pre.vo.MmPredictAlarmConfigRespVO;
 import com.iailab.module.model.mcs.pre.vo.MmPredictAlarmConfigSaveReqVO;
+
+import java.util.List;
+import java.util.Map;
 
 /**
  * @author PanZhibao
@@ -24,4 +28,6 @@
     void update(MmPredictAlarmConfigSaveReqVO reqVO);
 
     void delete(String id);
+
+    List<AlarmConfigRespDTO> list(Map<String, Object> params);
 }
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictAlarmConfigServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictAlarmConfigServiceImpl.java
index a7d76f5..42b9252 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictAlarmConfigServiceImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictAlarmConfigServiceImpl.java
@@ -1,20 +1,24 @@
 package com.iailab.module.model.mcs.pre.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.iailab.framework.common.pojo.PageResult;
 import com.iailab.framework.common.service.impl.BaseServiceImpl;
 import com.iailab.framework.common.util.object.BeanUtils;
 import com.iailab.framework.security.core.util.SecurityFrameworkUtils;
+import com.iailab.module.model.api.mcs.dto.AlarmConfigRespDTO;
 import com.iailab.module.model.mcs.pre.dao.MmPredictAlarmConfigDao;
+import com.iailab.module.model.mcs.pre.entity.DmModuleEntity;
 import com.iailab.module.model.mcs.pre.entity.MmPredictAlarmConfigEntity;
+import com.iailab.module.model.mcs.pre.entity.MmPredictAlarmMessageEntity;
 import com.iailab.module.model.mcs.pre.service.MmPredictAlarmConfigService;
 import com.iailab.module.model.mcs.pre.vo.MmPredictAlarmConfigPageReqVO;
 import com.iailab.module.model.mcs.pre.vo.MmPredictAlarmConfigRespVO;
 import com.iailab.module.model.mcs.pre.vo.MmPredictAlarmConfigSaveReqVO;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 
-import java.util.Date;
-import java.util.UUID;
+import java.util.*;
 
 /**
  * @author PanZhibao
@@ -57,4 +61,11 @@
     public void delete(String id) {
         baseDao.deleteById(id);
     }
+
+    @Override
+    public List<AlarmConfigRespDTO> list(Map<String, Object> params) {
+        QueryWrapper<MmPredictAlarmConfigEntity> wrapper = new QueryWrapper<>();
+        wrapper.eq("is_enable", 1);
+        return BeanUtils.toBean(baseDao.selectList(wrapper), AlarmConfigRespDTO.class);
+    }
 }
\ No newline at end of file
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mcs/MmPredictAlarmConfigDao.xml b/iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mcs/MmPredictAlarmConfigDao.xml
new file mode 100644
index 0000000..9cee8c2
--- /dev/null
+++ b/iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mcs/MmPredictAlarmConfigDao.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.iailab.module.model.mcs.pre.dao.MmPredictAlarmConfigDao">
+    <select id="getPageList" resultType="com.iailab.module.model.mcs.pre.vo.MmPredictAlarmConfigRespVO">
+        select t1.*,t2.itemname itemName,t3.tagname outName
+        from t_mm_predict_alarm_config t1
+        left join t_mm_predict_item t2 on t2.id = t1.item_id
+        left join t_mm_item_output t3 on t3.id = t1.out_id
+        <where>
+            <if test="params.title != null and params.title != ''">
+                AND t.title LIKE CONCAT('%', #{params.title},'%')
+            </if>
+            <if test="params.alarmObj != null and params.alarmObj != ''">
+                AND t.alarmObj LIKE CONCAT('%', #{params.alarmObj},'%')
+            </if>
+        </where>
+    </select>
+</mapper>
\ No newline at end of file

--
Gitblit v1.9.3