fuliqi
2023-11-25 24f7afc0e1dc48653c41e7a29111d35ff7230f76
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?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">
<mapper namespace="com.ycl.mapper.trend.TrendAnalysisMapper">
 
    <select id="selectTrendInfo" resultType="com.ycl.vo.TrendVo" parameterType="com.ycl.dto.trend.TrendAnalysisParam">
        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!=''">
                t3.alarm_time between #{tap.startTime} and #{tap.endTime}
            </if>
            and t1.video_point_id IS NOT NULL
        </where>
        GROUP BY
        t1.video_point_id
        ORDER BY count DESC
    </select>
 
    <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>