From 950f31ee2351e2d26ede3eeba49c09d52f46b296 Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期五, 03 十一月 2023 17:31:53 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ard-work/src/main/resources/mapper/alarm/ArdAlarmWallMapper.xml | 128 ++++++++++++++++++++++++++++++++----------
1 files changed, 97 insertions(+), 31 deletions(-)
diff --git a/ard-work/src/main/resources/mapper/alarm/ArdAlarmWallMapper.xml b/ard-work/src/main/resources/mapper/alarm/ArdAlarmWallMapper.xml
index 97fa3ee..99e112e 100644
--- a/ard-work/src/main/resources/mapper/alarm/ArdAlarmWallMapper.xml
+++ b/ard-work/src/main/resources/mapper/alarm/ArdAlarmWallMapper.xml
@@ -1,48 +1,68 @@
<?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">
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.alarm.wall.mapper.ArdAlarmWallMapper">
-
+
<resultMap type="ArdAlarmWall" id="ArdAlarmWallResult">
- <result property="id" column="id" />
- <result property="wallId" column="wall_id" />
- <result property="wallName" column="wall_name" />
- <result property="userId" column="user_id" />
- <result property="alarmType" column="alarm_type" />
- <result property="alarmTime" column="alarm_time" />
- <result property="longitude" column="longitude" />
- <result property="latitude" column="latitude" />
- <result property="altitude" column="altitude" />
- <result property="createBy" column="create_by" />
- <result property="createTime" column="create_time" />
- <result property="updateBy" column="update_by" />
- <result property="updateTime" column="update_time" />
+ <result property="id" column="id"/>
+ <result property="wallId" column="wall_id"/>
+ <result property="wallName" column="wall_name"/>
+ <result property="userId" column="user_id"/>
+ <result property="alarmType" column="alarm_type"/>
+ <result property="alarmTime" column="alarm_time"/>
+ <result property="longitude" column="longitude"/>
+ <result property="latitude" column="latitude"/>
+ <result property="altitude" column="altitude"/>
+ <result property="createBy" column="create_by"/>
+ <result property="createTime" column="create_time"/>
+ <result property="updateBy" column="update_by"/>
+ <result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectArdAlarmWallVo">
- select id,wall_id,wall_name, user_id, alarm_type, alarm_time, longitude, latitude, altitude, create_by, create_time, update_by, update_time from ard_alarm_wall
+ select id,
+ wall_id,
+ wall_name,
+ user_id,
+ alarm_type,
+ alarm_time,
+ longitude,
+ latitude,
+ altitude,
+ create_by,
+ create_time,
+ update_by,
+ update_time
+ from ard_alarm_wall
</sql>
<select id="selectArdAlarmWallList" parameterType="ArdAlarmWall" resultMap="ArdAlarmWallResult">
<include refid="selectArdAlarmWallVo"/>
<where>
- <if test="wallId != null and wallId != ''"> and wall_id = #{wallId}</if>
- <if test="wallName != null and wallName != ''"> and wall_name = #{wallName}</if>
- <if test="userId != null and userId != ''"> and user_id = #{userId}</if>
- <if test="alarmType != null and alarmType != ''"> and alarm_type = #{alarmType}</if>
- <if test="alarmTime != null "> and alarm_time = #{alarmTime}</if>
- <if test="longitude != null "> and longitude = #{longitude}</if>
- <if test="latitude != null "> and latitude = #{latitude}</if>
- <if test="altitude != null "> and altitude = #{altitude}</if>
+ <if test="wallId != null and wallId != ''">and wall_id = #{wallId}</if>
+ <if test="wallName != null and wallName != ''">and wall_name = #{wallName}</if>
+ <if test="userId != null and userId != ''">and user_id = #{userId}</if>
+ <if test="alarmType != null and alarmType != ''">and alarm_type = #{alarmType}</if>
+<!-- <if test="alarmTime != null ">and alarm_time = #{alarmTime}</if>-->
+ <if test="longitude != null ">and longitude = #{longitude}</if>
+ <if test="latitude != null ">and latitude = #{latitude}</if>
+ <if test="altitude != null ">and altitude = #{altitude}</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="selectArdAlarmWallById" parameterType="String" resultMap="ArdAlarmWallResult">
<include refid="selectArdAlarmWallVo"/>
where id = #{id}
</select>
-
+
<insert id="insertArdAlarmWall" parameterType="ArdAlarmWall">
insert into ard_alarm_wall
<trim prefix="(" suffix=")" suffixOverrides=",">
@@ -59,7 +79,7 @@
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
- </trim>
+ </trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="wallId != null">#{wallId},</if>
@@ -74,7 +94,7 @@
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
- </trim>
+ </trim>
</insert>
<update id="updateArdAlarmWall" parameterType="ArdAlarmWall">
@@ -97,13 +117,59 @@
</update>
<delete id="deleteArdAlarmWallById" parameterType="String">
- delete from ard_alarm_wall where id = #{id}
+ delete
+ from ard_alarm_wall
+ where id = #{id}
</delete>
<delete id="deleteArdAlarmWallByIds" parameterType="String">
- delete from ard_alarm_wall where id in
+ delete from ard_alarm_wall where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
+ <select id="selectCountByAlarmTime" resultType="Integer">
+ SELECT COUNT(DISTINCT aaw.wall_name)
+ FROM ard_alarm_wall aaw
+ WHERE aaw.alarm_time >= CURRENT_TIMESTAMP - INTERVAL '%${refreshTime}%' MINUTE
+ and aaw.view_time is null
+ </select>
+ <select id="selectListAllByCommand" resultMap="ArdAlarmWallResult">
+ SELECT T.*
+ FROM (
+ SELECT aaa.ID,
+ aaa.user_id,
+ aaa.wall_NAME,
+ aaa.alarm_time,
+ aaa.longitude,
+ aaa.latitude,
+ aaa.altitude,
+ ROW_NUMBER() OVER ( PARTITION BY aaa.wall_NAME ORDER BY aaa.alarm_time DESC ) AS rn, COUNT(CASE WHEN aaa.view_time IS NULL THEN 1 END) OVER ( PARTITION BY aaa.wall_NAME ) AS COUNT,
+ COUNT ( aaa.alarm_time ) OVER ( PARTITION BY aaa.wall_NAME ) AS total
+ FROM
+ ard_alarm_wall aaa
+ WHERE
+ aaa.alarm_time >= ( CURRENT_TIMESTAMP - INTERVAL '%${refreshTime}%' MINUTE )
+ ORDER BY
+ aaa.create_time DESC
+ ) T
+ WHERE T.rn = 1
+ </select>
+ <update id="updateViewTimeByUserId" parameterType="String">
+ update ard_alarm_wall
+ set view_time=#{viewTime}
+ where user_id = #{userId}
+ and create_time <= #{createTime}
+ and view_time is null
+ </update>
+ <select id="wallYear" resultType="com.ruoyi.statistical.vo.CountVo">
+ select to_char(alarm_time::DATE, 'MM') as date,count(id)
+ from ard_alarm_wall
+ where alarm_time >= #{start} and alarm_time <= #{end} group by date order by date
+ </select>
+ <select id="wallMonth" resultType="com.ruoyi.statistical.vo.CountVo">
+ select to_char(alarm_time::DATE, 'dd') as date,count(id)
+ from ard_alarm_wall
+ where alarm_time >= #{start} and alarm_time <= #{end} group by date order by date
+ </select>
</mapper>
\ No newline at end of file
--
Gitblit v1.9.3