wl
2022-11-28 160f973ce4eb04e690c396ebd45bffbc6fb99961
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
<?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 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
        <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>
            <if test="tap.type!=null and tap.type!=''" >
                war.violation_type=#{tap.type}
            </if>
        </where>
        group by vp.id,vp.name
        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>
 
</mapper>