123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221 |
- <?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.ozs.service.mapper.MsgAlarmMapper">
- <resultMap id="AlarmStatisticVoResult" type="com.ozs.service.entity.vo.AlarmStatisticVo">
- <id column="id" property="id"/>
- <result column="alarm_id" property="alarmId"/>
- <result column="monthsta" property="monthsta"/>
- <result column="frequency" property="frequency"/>
- <result column="camera_code" property="cameraCode"/>
- <result column="alarm_time" property="alarmTime"/>
- <result column="alarm_mile" property="alarmMile"/>
- <result column="content" property="content"/>
- <result column="alarm_confidence" property="alarmConfidence"/>
- <result column="line_dir" property="lineDir"/>
- <result column="alarm_type" property="alarmType"/>
- <result column="alarm_attr" property="alarmAttr"/>
- <result column="image_url" property="imageUrl"/>
- <result column="released_by" property="releasedBy"/>
- <result column="released_time" property="releasedTime"/>
- <result column="is_lock" property="isLock"/>
- <association property="baseCameraManagement" javaType="com.ozs.service.entity.BaseCameraManagement">
- <id column="id" property="id"/>
- <result column="railway_code" property="railwayCode"/>
- <result column="channel" property="channel"/>
- <result column="install_mile" property="installMile"/>
- <result column="begin_mile" property="beginMile"/>
- <result column="end_mile" property="endMile"/>
- <result column="install_longitude" property="installLongitude"/>
- <result column="install_latitude" property="installLatitude"/>
- </association>
- </resultMap>
- <select id="list" resultMap="AlarmStatisticVoResult">
- SELECT
- a.alarm_id ,
- a.camera_code ,
- a.alarm_time ,
- a.alarm_mile ,
- a.content ,
- a.alarm_confidence,
- a.line_dir ,
- a.alarm_type ,
- a.alarm_attr ,
- a.image_url ,
- a.released_by ,
- a.released_time,
- a.is_lock ,
- b.railway_code AS railway_code,
- b.channel AS channel,
- b.install_mile AS install_mile,
- b.begin_mile AS begin_mile,
- b.end_mile AS end_mile,
- b.install_longitude AS install_longitude,
- b.install_latitude AS install_latitude
- FROM
- msg_alarm AS a left join
- base_camera_management AS b on a.camera_code=b.camera_code left join
- msg_web_push m on a.alarm_id = m.alarm_id
- <where>
- <if test="railwayCode != null and railwayCode != ''">
- and UPPER(b.railway_code) like UPPER(CONCAT('%',#{railwayCode},'%'))
- </if>
- <if test="startMonth != null and startMonth != 0">
- <![CDATA[and MONTH(a.alarm_time) >=#{startMonth}]]>
- </if>
- <if test="endMonth != null and endMonth != 0">
- <![CDATA[and MONTH(a.alarm_time) <=#{endMonth}]]>
- </if>
- <if test="alarmType != null and alarmType != ''">
- and UPPER(a.alarm_type) like UPPER(CONCAT('%',#{alarmType},'%'))
- </if>
- <if test="userId != null and userId != ''">
- and UPPER(m.receive_by) like UPPER(CONCAT('%',#{userId},'%'))
- </if>
- </where>
- group by a.alarm_id
- </select>
- <select id="listMonth" resultMap="AlarmStatisticVoResult">
- SELECT
- a.alarm_id ,
- MONTH(a.alarm_time) as monthsta,
- count(DISTINCT a.alarm_id) as frequency,
- a.camera_code ,
- a.alarm_time ,
- a.alarm_mile ,
- a.content ,
- a.alarm_confidence,
- a.line_dir ,
- a.alarm_type ,
- a.alarm_attr ,
- a.image_url ,
- a.released_by ,
- a.released_time,
- a.is_lock ,
- b.railway_code AS railway_code,
- b.channel AS channel,
- b.install_mile AS install_mile,
- b.begin_mile AS begin_mile,
- b.end_mile AS end_mile,
- b.install_longitude AS install_longitude,
- b.install_latitude AS install_latitude
- FROM
- msg_alarm AS a left join
- base_camera_management AS b on a.camera_code=b.camera_code left join
- msg_web_push m on a.alarm_id = m.alarm_id
- <where>
- <if test="railwayCode != null and railwayCode != ''">
- and UPPER(b.railway_code) like UPPER(CONCAT('%',#{railwayCode},'%'))
- </if>
- <if test="startMonth != null and startMonth != 0">
- <![CDATA[and MONTH(a.alarm_time) >=#{startMonth}]]>
- </if>
- <if test="endMonth != null and endMonth != 0">
- <![CDATA[and MONTH(a.alarm_time) <=#{endMonth}]]>
- </if>
- <if test="alarmType != null and alarmType != ''">
- and UPPER(a.alarm_type) like UPPER(CONCAT('%',#{alarmType},'%'))
- </if>
- <if test="userId != null and userId != ''">
- and UPPER(m.receive_by) like UPPER(CONCAT('%',#{userId},'%'))
- </if>
- </where>
- group by a.alarm_id,MONTH(a.alarm_time)
- </select>
- <resultMap id="AlarmStatisticDtoResult" type="com.ozs.service.entity.vo.AlarmStatisticDto">
- <id column="id" property="id"/>
- <result column="alarmId" property="alarmId"/>
- <result column="railwayName" property="railwayName"/>
- <result column="alarmTime" property="alarmTime"/>
- <result column="lineDir" property="lineDir"/>
- <result column="lineDirValue" property="lineDirValue"/>
- <result column="alarmType" property="alarmType"/>
- <result column="alarmTypeValue" property="alarmTypeValue"/>
- <result column="alarmMile" property="alarmMile"/>
- <result column="beginMile" property="beginMile"/>
- <result column="endMile" property="endMile"/>
- </resultMap>
- <select id="listDto" resultMap="AlarmStatisticDtoResult">
- SELECT
- a.alarm_id AS alarmId,
- a.alarm_time AS alarmTime,
- a.alarm_mile AS alarmMile,
- a.line_dir AS lineDir,
- a.alarm_type AS alarmType,
- c.railway_name AS railwayName,
- b.begin_mile AS beginMile,
- b.end_mile AS endMile
- FROM
- msg_alarm AS a left join
- base_camera_management AS b on a.camera_code=b.camera_code left join
- msg_web_push m on a.alarm_id = m.alarm_id left join
- base_railway_management c on b.railway_code=c.railway_code
- <where>
- <if test="railwayCode != null and railwayCode != ''">
- and UPPER(b.railway_code) like UPPER(CONCAT('%',#{railwayCode},'%'))
- </if>
- <if test="startMonth != null and startMonth != 0">
- <![CDATA[and MONTH(a.alarm_time) >=#{startMonth}]]>
- </if>
- <if test="endMonth != null and endMonth != 0">
- <![CDATA[and MONTH(a.alarm_time) <=#{endMonth}]]>
- </if>
- <if test="alarmType != null and alarmType != ''">
- and UPPER(a.alarm_type) like UPPER(CONCAT('%',#{alarmType},'%'))
- </if>
- <if test="userId != null and userId != ''">
- and UPPER(m.receive_by) like UPPER(CONCAT('%',#{userId},'%'))
- </if>
- </where>
- group by a.alarm_id
- </select>
- <resultMap id="AlarmStatisticMonthDtoResult" type="com.ozs.service.entity.vo.AlarmStatisticMonthDto">
- <id column="id" property="id"/>
- <result column="alarmId" property="alarmId"/>
- <result column="railwayName" property="railwayName"/>
- <result column="alarmType" property="alarmType"/>
- <result column="alarmTime" property="alarmTime"/>
- <result column="monthsta" property="monthsta"/>
- <result column="frequency" property="frequency"/>
- </resultMap>
- <select id="listDtoMonth" resultMap="AlarmStatisticMonthDtoResult">
- SELECT
- a.alarm_id AS alarmId,
- MONTH(a.alarm_time) as monthsta,
- count(DISTINCT a.alarm_id) as frequency,
- a.alarm_type AS alarmType,
- a.alarm_time AS alarmTime,
- c.railway_name AS railwayName
- FROM
- msg_alarm AS a left join
- base_camera_management AS b on a.camera_code=b.camera_code left join
- msg_web_push m on a.alarm_id = m.alarm_id left join
- base_railway_management c on b.railway_code=c.railway_code
- <where>
- <if test="railwayCode != null and railwayCode != ''">
- and UPPER(b.railway_code) like UPPER(CONCAT('%',#{railwayCode},'%'))
- </if>
- <if test="startMonth != null and startMonth != 0">
- <![CDATA[and MONTH(a.alarm_time) >=#{startMonth}]]>
- </if>
- <if test="endMonth != null and endMonth != 0">
- <![CDATA[and MONTH(a.alarm_time) <=#{endMonth}]]>
- </if>
- <if test="alarmType != null and alarmType != ''">
- and UPPER(a.alarm_type) like UPPER(CONCAT('%',#{alarmType},'%'))
- </if>
- <if test="userId != null and userId != ''">
- and UPPER(m.receive_by) like UPPER(CONCAT('%',#{userId},'%'))
- </if>
- </where>
- group by a.alarm_id,MONTH(a.alarm_time)
- </select>
- </mapper>
|