Browse Source

+ 设备告警

chen.cheng 11 months ago
parent
commit
46abeb4677

+ 22 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/AdmOpAlarm.java

@@ -1,6 +1,7 @@
 package com.ruoyi.ems.domain;
 
 import java.util.Date;
+import java.util.List;
 
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
@@ -39,6 +40,9 @@ public class AdmOpAlarm extends BaseEntity
     @Excel(name = "对象代码")
     private String objCode;
 
+    @Excel(name = "对象名称")
+    private String objName;
+
     /** 告警日期 */
     @JsonFormat(pattern = "yyyy-MM-dd")
     @Excel(name = "告警日期", width = 30, dateFormat = "yyyy-MM-dd")
@@ -65,6 +69,8 @@ public class AdmOpAlarm extends BaseEntity
     @Excel(name = "告警状态")
     private Integer alarmState;
 
+    private List<Integer> alarmStateList;
+
     public void setId(Long id)
     {
         this.id = id;
@@ -172,6 +178,22 @@ public class AdmOpAlarm extends BaseEntity
         this.systemCode = systemCode;
     }
 
+    public List<Integer> getAlarmStateList() {
+        return alarmStateList;
+    }
+
+    public void setAlarmStateList(List<Integer> alarmStateList) {
+        this.alarmStateList = alarmStateList;
+    }
+
+    public String getObjName() {
+        return objName;
+    }
+
+    public void setObjName(String objName) {
+        this.objName = objName;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 17 - 4
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/AdmOpAlarmMapper.xml

@@ -14,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="alarmCode"    column="alarm_code"    />
         <result property="subSystemName" column="sub_system_name"/>
         <result property="systemCode" column="system_code"/>
+        <result property="objName" column="obj_name"/>
         <result property="alarmMsg"    column="alarm_msg"    />
         <result property="alarmType"    column="alarm_type"    />
         <result property="alarmState"    column="alarm_state"    />
@@ -30,6 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                alarm.alarm_msg,
                alarm.alarm_type,
                alarm.alarm_state,
+               alarm.obj_name,
                sub.system_name sub_system_name,
                alarm.system_code
         from adm_op_alarm alarm
@@ -43,11 +45,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="objType != null ">and obj_type = #{objType}</if>
             <if test="objCode != null  and objCode != ''">and obj_code = #{objCode}</if>
             <if test="alarmCode != null  and alarmCode != ''">and alarm_code = #{alarmCode}</if>
+            <if test="objName !=null and objName!=''">and alarm.obj_name like concat('%', #{objName}, '%')</if>
             <if test="systemCode !=null and systemCode != ''">and alarm.system_code = #{systemCode}</if>
             <if test="alarmMsg != null  and alarmMsg != ''">and alarm_msg like concat('%', #{alarmMsg}, '%')</if>
             <if test="alarmType != null ">and alarm_type = #{alarmType}</if>
             <if test="alarmState != null ">and alarm_state = #{alarmState}</if>
+            <if test="alarmStateList != null and alarmStateList.size() > 0">
+                and alarm_state in
+                <foreach collection="alarmStateList" item="alarmState" open="(" close=")" separator=",">
+                    #{alarmState}
+                </foreach>
+            </if>
         </where>
+        order by alarm.alarm_time desc
     </select>
 
     <select id="selectAdmOpAlarmById" parameterType="Long" resultMap="AdmOpAlarmResult">
@@ -61,26 +71,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="areaCode != null and areaCode != ''">area_code,</if>
             <if test="objType != null">obj_type,</if>
             <if test="objCode != null and objCode != ''">obj_code,</if>
+            <if test="objName != null and objName!=''">obj_name,</if>
             <if test="alarmDate != null">alarm_date,</if>
             <if test="alarmTime != null">alarm_time,</if>
-            <if test="systemCode !=null">system_code, </if>
+            <if test="systemCode !=null">system_code,</if>
             <if test="alarmCode != null">alarm_code,</if>
             <if test="alarmMsg != null">alarm_msg,</if>
             <if test="alarmType != null">alarm_type,</if>
             <if test="alarmState != null">alarm_state,</if>
-         </trim>
+        </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="areaCode != null and areaCode != ''">#{areaCode},</if>
             <if test="objType != null">#{objType},</if>
             <if test="objCode != null and objCode != ''">#{objCode},</if>
+            <if test="objName != null and objName!=''">#{objName},</if>
             <if test="alarmDate != null">#{alarmDate},</if>
             <if test="alarmTime != null">#{alarmTime},</if>
-            <if test="systemCode !=null">#{systemCode}, </if>
+            <if test="systemCode !=null">#{systemCode},</if>
             <if test="alarmCode != null">#{alarmCode},</if>
             <if test="alarmMsg != null">#{alarmMsg},</if>
             <if test="alarmType != null">#{alarmType},</if>
             <if test="alarmState != null">#{alarmState},</if>
-         </trim>
+        </trim>
     </insert>
 
     <update id="updateAdmOpAlarm" parameterType="com.ruoyi.ems.domain.AdmOpAlarm">
@@ -89,6 +101,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="areaCode != null and areaCode != ''">area_code = #{areaCode},</if>
             <if test="objType != null">obj_type = #{objType},</if>
             <if test="objCode != null and objCode != ''">obj_code = #{objCode},</if>
+            <if test="objName != null and objName!=''">obj_name = #{objName},</if>
             <if test="alarmDate != null">alarm_date = #{alarmDate},</if>
             <if test="alarmTime != null">alarm_time = #{alarmTime},</if>
             <if test="alarmCode != null">alarm_code = #{alarmCode},</if>