From 2c2b1ab406d3049a0e69fff01e3daade5cbe90ea Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Thu, 08 Apr 2021 19:59:26 +0800
Subject: [PATCH] 预警数量统计接口修改,新增按时间条件查询条件,违禁品统计接口修改
---
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/alarm/mapper/AlarmMapper.xml | 117 +++++++++++++++++++++++-----------------------------------
1 files changed, 46 insertions(+), 71 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 bed7c13..b1843e4 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
@@ -80,6 +80,20 @@
<if test="alarm.endTime!=null and alarm.endTime!=''">
and a.alarmTime<=#{alarm.endTime}
</if>
+ <if test="alarm.timeDesc!=null and alarm.timeDesc!=''">
+ <if test="alarm.timeDesc=='30分钟以上'">
+ and czTime-alarmTime>1800
+ </if>
+ <if test="alarm.timeDesc=='10-30分钟'">
+ and czTime-alarmTime>600 and czTime-alarmTime <1800
+ </if>
+ <if test="alarm.timeDesc=='5-10分钟'">
+ and czTime-alarmTime>300 and czTime-alarmTime <600
+ </if>
+ <if test="alarm.timeDesc=='小于5分钟'">
+ and czTime-alarmTime>0 and czTime-alarmTime <300
+ </if>
+ </if>
and a.waringType IN("紧急求救")
@@ -296,10 +310,14 @@
<!--查询当天警情总数-->
<select id="selectAlarmCount" resultType="java.lang.Integer">
SELECT count(*) FROM `sys_alarm`
- where
+ where
waringType = '紧急求救'
- and
- to_days(alarmTime) = to_days(curdate())
+ <if test="conditionVo.status==0">
+ and to_days(alarmTime) = to_days(curdate())
+ </if>
+ <if test="conditionVo.startTime!=null and conditionVo.startTime!='' and conditionVo.endTime!=null and conditionVo.endTime!=''">
+ and alarmTime between #{conditionVo.startTime} and #{conditionVo.endTime}
+ </if>
</select>
@@ -332,46 +350,26 @@
order by a.click_date asc
</select>
- <!--查询警情当前时间段内每天的数据-->
- <select id="selectTimeAlarmData" resultType="java.lang.Integer">
- select a.days, ifnull(count,0) count from
- (
- SELECT @date := DATE_ADD( @date, INTERVAL + 1 DAY ) days FROM
- (
- SELECT @date := DATE_ADD( #{conditionVo.startTime}, INTERVAL - 1 DAY ) FROM sys_date
- ) time
- WHERE to_days( @date ) < to_days( #{conditionVo.endTime} )
- ) a
- left join
- (
- select DATE_FORMAT(alarmTime,'%Y-%m-%d') as datetime, count(*) as count from sys_alarm
- where waringType = '紧急求救'
- group by DATE_FORMAT(alarmTime,'%Y-%m-%d')
- ) b
- on
- a.days = b.datetime
- </select>
-
-<!-- <!–查询本日,本周,本月 主动报警的数量–>-->
-<!-- <select id="selectAlarmSum" resultType="java.util.HashMap">-->
-<!-- select sa.alarmType name,IFNULL(sb.count, 0) value from (select alarmType from sys_alarm GROUP BY alarmType) sa-->
-<!-- left join-->
-<!-- ( select alarmType,count(*) count from sys_alarm-->
-<!-- where 1=1-->
-<!-- <if test="conditionVo.status==0">-->
-<!-- and to_days(alarmTime) = to_days(now())-->
-<!-- </if>-->
-<!-- <if test="conditionVo.status==1">-->
-<!-- and YEARWEEK(date_format(alarmTime,'%Y-%m-%d'),1) = YEARWEEK(now(),1)-->
-<!-- </if>-->
-<!-- <if test="conditionVo.status==2">-->
-<!-- and date_format(alarmTime,'%Y%m') = date_format(now(),'%Y%m')-->
-<!-- </if>-->
-<!-- group by alarmType-->
-<!-- ) sb-->
-<!-- on-->
-<!-- sa.alarmType = sb.alarmType-->
-<!-- </select>-->
+ <!-- <!–查询本日,本周,本月 主动报警的数量–>-->
+ <!-- <select id="selectAlarmSum" resultType="java.util.HashMap">-->
+ <!-- select sa.alarmType name,IFNULL(sb.count, 0) value from (select alarmType from sys_alarm GROUP BY alarmType) sa-->
+ <!-- left join-->
+ <!-- ( select alarmType,count(*) count from sys_alarm-->
+ <!-- where 1=1-->
+ <!-- <if test="conditionVo.status==0">-->
+ <!-- and to_days(alarmTime) = to_days(now())-->
+ <!-- </if>-->
+ <!-- <if test="conditionVo.status==1">-->
+ <!-- and YEARWEEK(date_format(alarmTime,'%Y-%m-%d'),1) = YEARWEEK(now(),1)-->
+ <!-- </if>-->
+ <!-- <if test="conditionVo.status==2">-->
+ <!-- and date_format(alarmTime,'%Y%m') = date_format(now(),'%Y%m')-->
+ <!-- </if>-->
+ <!-- group by alarmType-->
+ <!-- ) sb-->
+ <!-- on-->
+ <!-- sa.alarmType = sb.alarmType-->
+ <!-- </select>-->
<!--查询本日,本周,本月 主动报警的数量-->
<select id="selectAlarmSum" resultType="java.util.HashMap">
@@ -409,13 +407,13 @@
<select id="queryPoliceTime" resultType="java.util.HashMap">
SELECT
- a.alarmPeople,
- a.alarmId,
- max( a.jjTime ) AS jjTime
+ a.alarmPeople,
+ a.alarmId,
+ max( a.jjTime ) AS jjTime
FROM
- sys_alarm a
+ sys_alarm a
WHERE
- 1 =1
+ 1 =1
<if test="policeIdArr!=null and policeIdArr.size>0">
and alarmId in
@@ -493,28 +491,5 @@
) b
on
a.days = b.datetime
- </select>
-
-
- <!--查询本年所有月份的预警数量-->
- <select id="queryYearAlarm" resultType="java.util.HashMap">
-
-
-
- <if test="childList!=null and childList.size>0">
-
- <foreach collection="childList" index="index" item="item" open="" separator="union all" close="">
- SELECT
- #{item} as month,count(ce.id) as count
- FROM
- sys_alarm as ce
- WHERE
- YEAR ( alarmTime ) = date_format(now(),'%Y%')
- AND MONTH ( alarmTime ) = #{item}
- AND waringType = "紧急求救"
- AND deviceNumber = #{deviceNumber}
- </foreach>
- </if>
-
</select>
</mapper>
--
Gitblit v1.9.3