From 57c72c8438ccb461d5d2f751f710d6908f0e0d32 Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Thu, 04 Nov 2021 14:59:20 +0800
Subject: [PATCH] 版本修复

---
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/alarm/mapper/AlarmMapper.xml |  209 ++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 176 insertions(+), 33 deletions(-)

diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/alarm/mapper/AlarmMapper.xml b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/alarm/mapper/AlarmMapper.xml
index 118c4ed..18afadc 100644
--- a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/alarm/mapper/AlarmMapper.xml
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/alarm/mapper/AlarmMapper.xml
@@ -243,49 +243,191 @@
         SELECT
         *
         FROM
-            sys_alarm
+        sys_alarm
         WHERE
-            1 = 1
-            <if test="alarm.district!=null">
-                and district like concat('%',#{alarm.district},'%')
-            </if>
-            <if test="alarm.province!=null">
-                and province like concat('%',#{alarm.province},'%')
-            </if>
-            <if test="alarm.city!=null">
-                and city like concat('%',#{alarm.city},'%')
-            </if>
-            <if test="alarm.alarmPeople!=null">
-                and alarmPeople like concat('%',#{alarm.alarmPeople},'%')
-            </if>
-            <if test="alarm.jtype!=null">
-                and jtype = #{alarm.jtype}
-            </if>
-            AND waringType IN ( "安装任务" )
+        1 = 1
+        <if test="alarm.district!=null">
+            and district like concat('%',#{alarm.district},'%')
+        </if>
+        <if test="alarm.province!=null">
+            and province like concat('%',#{alarm.province},'%')
+        </if>
+        <if test="alarm.city!=null">
+            and city like concat('%',#{alarm.city},'%')
+        </if>
+        <if test="alarm.alarmPeople!=null">
+            and alarmPeople like concat('%',#{alarm.alarmPeople},'%')
+        </if>
+        <if test="alarm.jtype!=null">
+            and jtype = #{alarm.jtype}
+        </if>
+        <if test="alarm.rname!=null">
+            and rname like concat('%',#{alarm.rname},'%')
+        </if>
+        <if test="alarm.deviceNumber!=null">
+            and deviceNumber like concat('%',#{alarm.deviceNumber},'%')
+        </if>
+        AND waringType IN ( "安装任务" )
         ORDER BY
-            jtype ASC,
-            alarmTime DESC
+        jtype ASC,
+        alarmTime DESC
     </select>
 
     <select id="getChartData" resultType="java.util.Map">
         SELECT
-            COUNT( * ) AS value,
-            "未安装" as name
+        COUNT( * ) AS value,
+        "未安装" as name
         FROM
-            sys_alarm
+        sys_alarm
         WHERE
-            1 = 1
-            AND jtype = 0
-            AND waringType IN ( "安装任务" ) UNION ALL
+        1 = 1
+
+        <if test="beginTime!=null and beginTime!=''">
+            and alarmTime&gt;=#{beginTime}
+        </if>
+        <if test="endTime!=null and endTime!=''">
+            and alarmTime&lt;=#{endTime}
+        </if>
+
+        AND jtype = 0
+        AND waringType IN ( "安装任务" ) UNION ALL
         SELECT
-            COUNT( * ) AS value,
-            "已安装" as name
+        COUNT( * ) AS value,
+        "已安装" as name
         FROM
-            sys_alarm
+        sys_alarm
         WHERE
-            1 = 1
-            AND jtype = 2
-            AND waringType IN ( "安装任务" )
+        1 = 1
+
+        <if test="beginTime!=null and beginTime!=''">
+            and alarmTime&gt;=#{beginTime}
+        </if>
+        <if test="endTime!=null and endTime!=''">
+            and alarmTime&lt;=#{endTime}
+        </if>
+
+        AND jtype = 2
+        AND waringType IN ( "安装任务" )
+    </select>
+    <select id="getChartDataAlarm" resultType="java.util.Map">
+        SELECT
+        COUNT( * ) AS
+        value
+        ,
+        "未处理" AS name
+        FROM
+        sys_alarm
+        WHERE
+        1 = 1
+
+        <if test="beginTime!=null and beginTime!=''">
+            and alarmTime&gt;=#{beginTime}
+        </if>
+        <if test="endTime!=null and endTime!=''">
+            and alarmTime&lt;=#{endTime}
+        </if>
+
+        AND jtype = 0
+        AND waringType IN ( "紧急求救" ) UNION ALL
+        SELECT
+        COUNT( * ) AS
+        value
+        ,
+        "处理中" AS name
+        FROM
+        sys_alarm
+        WHERE
+        1 = 1
+
+        <if test="beginTime!=null and beginTime!=''">
+            and alarmTime&gt;=#{beginTime}
+        </if>
+        <if test="endTime!=null and endTime!=''">
+            and alarmTime&lt;=#{endTime}
+        </if>
+
+        AND jtype = 1
+        AND waringType IN ( "紧急求救" )
+        UNION ALL
+        SELECT
+        COUNT( * ) AS
+        value
+        ,
+        "已处理" AS name
+        FROM
+        sys_alarm
+        WHERE
+        1 = 1
+
+        <if test="beginTime!=null and beginTime!=''">
+            and alarmTime&gt;=#{beginTime}
+        </if>
+        <if test="endTime!=null and endTime!=''">
+            and alarmTime&lt;=#{endTime}
+        </if>
+
+        AND jtype = 2
+        AND waringType IN ( "紧急求救" )
+    </select>
+    <select id="getChartDataAlarmBs" resultType="java.util.Map">
+        SELECT
+        COUNT( * ) AS
+        value
+        ,
+        "一般警情" AS name
+        FROM
+        sys_alarm
+        WHERE
+        1 = 1
+
+        <if test="beginTime!=null and beginTime!=''">
+            and alarmTime&gt;=#{beginTime}
+        </if>
+        <if test="endTime!=null and endTime!=''">
+            and alarmTime&lt;=#{endTime}
+        </if>
+
+        AND alarmbs = 0
+        AND waringType IN ( "紧急求救" ) UNION ALL
+        SELECT
+        COUNT( * ) AS
+        value
+        ,
+        "误报警情" AS name
+        FROM
+        sys_alarm
+        WHERE
+        1 = 1
+
+        <if test="beginTime!=null and beginTime!=''">
+            and alarmTime&gt;=#{beginTime}
+        </if>
+        <if test="endTime!=null and endTime!=''">
+            and alarmTime&lt;=#{endTime}
+        </if>
+
+        AND alarmbs = 1
+        AND waringType IN ( "紧急求救" )
+        UNION ALL
+        SELECT
+        COUNT( * ) AS
+        value
+        ,
+        "严重警情" AS name
+        FROM
+        sys_alarm
+        WHERE
+        1 = 1
+
+        <if test="beginTime!=null and beginTime!=''">
+            and alarmTime&gt;=#{beginTime}
+        </if>
+        <if test="endTime!=null and endTime!=''">
+            and alarmTime&lt;=#{endTime}
+        </if>
+
+        AND alarmbs = 2
+        AND waringType IN ( "紧急求救" )
     </select>
 
     <select id="listAll" resultMap="alarmResultMap">
@@ -673,7 +815,8 @@
         WHERE
 
         <if test="alarm.securityArr!=null and alarm.securityArr!=''">
-            securityId = "" or securityId IS NULL
+            (securityId = "" or securityId IS NULL)
+            AND jtype != 2
             AND securityArr LIKE concat('%',#{alarm.securityArr},'%')
         </if>
 

--
Gitblit v1.9.3