From a77cd2572fae653df15a202bdcd692a8e9c44a04 Mon Sep 17 00:00:00 2001 From: zhanghua <314079846@qq.com> Date: 星期四, 05 九月 2024 21:43:19 +0800 Subject: [PATCH] 11 --- ycl-platform/src/main/resources/mapper/trend/TrendAnalysisMapper.xml | 83 +++++++++++++++++++++++++++++------------ 1 files changed, 59 insertions(+), 24 deletions(-) diff --git a/ycl-platform/src/main/resources/mapper/trend/TrendAnalysisMapper.xml b/ycl-platform/src/main/resources/mapper/trend/TrendAnalysisMapper.xml index 930caa3..a67d6fa 100644 --- a/ycl-platform/src/main/resources/mapper/trend/TrendAnalysisMapper.xml +++ b/ycl-platform/src/main/resources/mapper/trend/TrendAnalysisMapper.xml @@ -3,35 +3,70 @@ <mapper namespace="com.ycl.mapper.trend.TrendAnalysisMapper"> <select id="selectTrendInfo" resultType="com.ycl.vo.TrendVo" parameterType="com.ycl.dto.trend.TrendAnalysisParam"> - select vp.id,vp.name,count(0) as count from - ums_warn_alarm_record war - left join - ums_violations v - on v.id=war.case_number_id - left join - ums_video_point vp - on v.video_point_id=vp.id + SELECT + t2.id, + t2.NAME, + count( 0 ) AS count, + t2.longitude, + t2.latitude + FROM + ums_violations t1 + LEFT JOIN ums_video_point t2 ON t2.id = t1.video_point_id + LEFT JOIN ums_video_alarm_report t3 ON t3.id = t1.video_alarm_report_id <where> - <if test="tap.startTime!=null and tap.startTime!=''and tap.endTime!=null and tap.endTime!=''" > - war.alarm_time between #{tap.startTime} and #{tap.endTime} + <if test="tap.startTime!=null and tap.startTime!=''and tap.endTime!=null and tap.endTime!=''"> + t3.alarm_time between #{tap.startTime} and #{tap.endTime} </if> - <if test="tap.type!=null and tap.type!=''" > - war.violation_type=#{tap.type} - </if> + and t1.video_point_id IS NOT NULL </where> - group by vp.id,vp.name - order by count DESC + GROUP BY + t1.video_point_id + ORDER BY count DESC </select> - <select id="selectTrendPointInfo" resultType="com.ycl.vo.TrendVo" parameterType="string"> - SELECT vp.address, DATE_FORMAT(war.alarm_time,"%Y-%m-%d") as dateTime,count(0) as count - from ums_warn_alarm_record war - left join ums_violations v - on v.id=war.case_number_id - left join ums_video_point vp - on v.video_point_id=vp.id - where vp.id=#{id} - GROUP BY vp.address,DATE_FORMAT(war.alarm_time,"%Y-%m-%d") + <select id="selectTrendPointInfo" resultType="com.ycl.vo.TrendVo"> + SELECT t2.address, DATE_FORMAT(t3.alarm_time,"%Y-%m-%d") as dateTime,count(0) as count + FROM + ums_violations t1 + LEFT JOIN ums_video_point t2 ON t2.id = t1.video_point_id + LEFT JOIN ums_video_alarm_report t3 ON t3.id = t1.video_alarm_report_id + <where> + <if test="longitude='' and longitude =null and latitude='' and latitude=null"> + t2.longitude=#{longitude} and t2.latitude=#{latitude} + </if> + and t1.video_point_id IS NOT NULL + </where> + GROUP BY + t1.video_point_id,DATE_FORMAT(t3.alarm_time,"%Y-%m-%d") + </select> + <select id="queryPointInfoByTime" resultType="com.ycl.vo.TrendVo"> + SELECT t2.address, DATE_FORMAT(t3.alarm_time,"%Y-%m-%d") as dateTime,count(0) as count + FROM + ums_violations t1 + LEFT JOIN ums_video_point t2 ON t2.id = t1.video_point_id + LEFT JOIN ums_video_alarm_report t3 ON t3.id = t1.video_alarm_report_id + where t1.video_point_id = #{pointId} + <if test="startTime!=null and startTime != ''"> + and t3.alarm_time BETWEEN #{startTime} and #{endTime} + </if> + + GROUP BY + t1.video_point_id,DATE_FORMAT(t3.alarm_time,"%Y-%m-%d") + order by DATE_FORMAT(t3.alarm_time,"%Y-%m-%d") + </select> + <select id="queryPointInfoTypeByTime" resultType="com.ycl.vo.TrendVo"> + SELECT t3.algo_name as name,count(0) as count + FROM + ums_violations t1 + LEFT JOIN ums_video_point t2 ON t2.id = t1.video_point_id + LEFT JOIN ums_video_alarm_report t3 ON t3.id = t1.video_alarm_report_id + where t3.algo_name is not null + and t1.video_point_id = #{pointId} + <if test="startTime!=null and startTime != ''"> + and t3.alarm_time BETWEEN #{startTime} and #{endTime} + </if> + GROUP BY t3.algo_name + order by t3.algo_name </select> </mapper> -- Gitblit v1.8.0