From 7cbb0422ec68c5b2254a4dab449218ea2ca32c76 Mon Sep 17 00:00:00 2001
From: Administrator <1144154118@qq.com>
Date: 星期六, 19 八月 2023 11:14:48 +0800
Subject: [PATCH] 打卡
---
ard-work/src/main/resources/mapper/alarm/ArdAlarmRadarMapper.xml | 61 +++++++++++++++++++-----------
1 files changed, 39 insertions(+), 22 deletions(-)
diff --git a/ard-work/src/main/resources/mapper/alarm/ArdAlarmRadarMapper.xml b/ard-work/src/main/resources/mapper/alarm/ArdAlarmRadarMapper.xml
index 0cb747e..6819e98 100644
--- a/ard-work/src/main/resources/mapper/alarm/ArdAlarmRadarMapper.xml
+++ b/ard-work/src/main/resources/mapper/alarm/ArdAlarmRadarMapper.xml
@@ -2,7 +2,7 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.ruoyi.alarm.radarAlarm.mapper.ArdAlarmRadarMapper">
+<mapper namespace="com.ruoyi.alarm.radar.mapper.ArdAlarmRadarMapper">
<resultMap type="ArdAlarmRadar" id="ArdAlarmRadarResult">
<result property="id" column="id"/>
<result property="name" column="name"/>
@@ -44,7 +44,14 @@
<if test="name != null and name != ''">and name like '%'||#{name}||'%'</if>
<if test="alarmType != null and alarmType != ''">and alarm_type = #{alarmType}</if>
<if test="deptId != null ">and dept_id = #{deptId}</if>
+ <if test="params.beginTime != null and params.beginTime != ''"><!-- 寮�濮嬫椂闂存绱� -->
+ AND alarm_time >= to_timestamp(#{params.beginTime},'yyyy-MM-DD HH24:MI:ss')
+ </if>
+ <if test="params.endTime != null and params.endTime != ''"><!-- 缁撴潫鏃堕棿妫�绱� -->
+ AND alarm_time <= to_timestamp(#{params.endTime},'yyyy-MM-DD HH24:MI:ss')
+ </if>
</where>
+ order by alarm_time desc
</select>
<select id="selectArdAlarmRadarById" parameterType="String" resultMap="ArdAlarmRadarResult">
@@ -121,33 +128,35 @@
</delete>
<select id="selectListAllByCommand" resultMap="ArdAlarmRadarResult">
- SELECT T
- .*
- FROM (
- SELECT aar.ID,
- aar.target_id,
- aar.NAME,
- aar.alarm_type,
- aar.alarm_time,
- aar.longitude,
- aar.latitude,
- ROW_NUMBER() OVER ( PARTITION BY aar.NAME ORDER BY aar.alarm_time DESC ) AS rn, COUNT(CASE WHEN aar.view_time IS NULL THEN 1 END) OVER ( PARTITION BY aar.NAME ) AS COUNT,
- COUNT ( aar.alarm_time ) OVER ( PARTITION BY aar.NAME ) AS total
- FROM
- ard_alarm_radar aar
- WHERE
- aar.alarm_time >= ( CURRENT_TIMESTAMP - INTERVAL '%${refreshTime}%' MINUTE )
- AND aar.alarm_type = #{alarmType}
- ORDER BY
- aar.alarm_time DESC
- ) T
- WHERE T.rn = 1
+ select aaar.ID,
+ aaar.target_id,
+ aaar.NAME,
+ aaar.alarm_type,
+ aaar.alarm_time,
+ aaar.longitude,
+ aaar.latitude,
+ r.COUNT,
+ r.total from
+ (SELECT
+ aar.NAME,
+ max(aar.create_time) as create_time1,
+ count(case when aar.view_time is null THEN 1 END) as count,
+ count(aar.id) as total
+ FROM
+ ard_alarm_radar aar
+ WHERE
+ aar.create_time >= ( CURRENT_TIMESTAMP - INTERVAL '%${refreshTime}%' MINUTE )
+ AND aar.alarm_type = #{alarmType}
+ GROUP BY aar.NAME
+ ) r
+ INNER JOIN ard_alarm_radar aaar ON r.create_time1 = aaar.create_time
</select>
<select id="selectCountByAlarmTime" resultType="Integer">
SELECT COUNT(DISTINCT aar.name)
FROM ard_alarm_radar aar
WHERE aar.alarm_time >= CURRENT_TIMESTAMP - INTERVAL '%${refreshTime}%' MINUTE
and aar.alarm_type = #{alarmType}
+ and aar.view_time is null
</select>
<select id="getCameraByRadar" resultType="String">
select ac.id
@@ -173,4 +182,12 @@
and alarm_type =#{ardAlarmRadar.alarmType}
and name = #{ardAlarmRadar.name}
</select>
+ <update id="updateViewTimeByCondition" parameterType="String">
+ update ard_alarm_radar
+ set view_time=#{viewTime}
+ where name = #{name}
+ and alarm_type=#{alarmType}
+ and alarm_time<=#{alarmTime}
+ and view_time is null
+ </update>
</mapper>
\ No newline at end of file
--
Gitblit v1.9.3