|
@@ -390,38 +390,66 @@
|
|
a.released_reason AS releasedReason,
|
|
a.released_reason AS releasedReason,
|
|
a.remark AS remark
|
|
a.remark AS remark
|
|
FROM
|
|
FROM
|
|
- msg_alarm AS a
|
|
|
|
- JOIN
|
|
|
|
- base_camera_management AS b ON a.camera_code = b.camera_code
|
|
|
|
- JOIN
|
|
|
|
- base_railway_management AS l ON b.railway_code = l.railway_code
|
|
|
|
- WHERE
|
|
|
|
- (railwayCode IS NULL OR railwayCode = '' OR CONCAT(l.railway_name, l.railway_code) LIKE CONCAT('%', #{railwayCode}, '%'))
|
|
|
|
- AND (beginMile IS NULL OR beginMile = 0 OR b.begin_mile >= #{beginMile})
|
|
|
|
- AND (endMile IS NULL OR endMile = 0 OR b.end_mile <= #{endMile})
|
|
|
|
- AND (ids IS NULL OR ids.size = 0 OR a.id IN
|
|
|
|
- <foreach item="item" collection="ids" separator=",">
|
|
|
|
- #{item}
|
|
|
|
- </foreach>)
|
|
|
|
- AND (dsFlay OR (
|
|
|
|
- (dsUserId IS NULL OR dsUserId = '' OR a.create_by = #{dsUserId}) OR
|
|
|
|
- (dsDeptId IS NULL OR dsDeptId = 0 OR b.dept_id = #{dsDeptId}) OR
|
|
|
|
- (dsDeptIds IS NULL OR (
|
|
|
|
- b.dept_id IN
|
|
|
|
- <foreach item="item" collection="dsDeptIds" separator=",">
|
|
|
|
- #{item}
|
|
|
|
- </foreach>
|
|
|
|
- ))
|
|
|
|
- ))
|
|
|
|
- AND (alarmType IS NULL OR alarmType = 0 OR a.alarm_type = #{alarmType})
|
|
|
|
- AND (alarmMile IS NULL OR alarmMile = 0 OR a.alarm_mile = #{alarmMile})
|
|
|
|
- AND (isLock IS NULL OR isLock = 0 OR a.is_lock = #{isLock})
|
|
|
|
- AND (lineDir IS NULL OR lineDir = 0 OR a.line_dir = #{lineDir})
|
|
|
|
- AND (releasedType IS NULL OR releasedType = 0 OR a.released_type = #{releasedType})
|
|
|
|
- AND (beginAlarmTime IS NULL OR beginAlarmTime = '' OR DATE_FORMAT(a.alarm_time, '%Y-%m-%d') >= DATE_FORMAT(#{beginAlarmTime}, '%Y-%m-%d'))
|
|
|
|
- AND (endAlarmTime IS NULL OR endAlarmTime = '' OR DATE_FORMAT(a.alarm_time, '%Y-%m-%d') <= DATE_FORMAT(#{endAlarmTime}, '%Y-%m-%d'))
|
|
|
|
- ORDER BY
|
|
|
|
- a.alarm_time DESC;
|
|
|
|
|
|
+ msg_alarm AS a join
|
|
|
|
+ base_camera_management AS b on a.camera_code=b.camera_code join
|
|
|
|
+ base_railway_management AS l on b.railway_code=l.railway_code
|
|
|
|
+ <where>
|
|
|
|
+ <if test="railwayCode != null and railwayCode != ''">
|
|
|
|
+ concat(l.railway_name,l.railway_code)
|
|
|
|
+ like concat("%",#{railwayCode},"%")
|
|
|
|
+ </if>
|
|
|
|
+ <if test="beginMile != null and beginMile != 0">
|
|
|
|
+ and b.begin_mile >=#{beginMile}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="endMile != null and endMile != 0">
|
|
|
|
+ and b.end_mile <=#{endMile}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="ids != null and ids.size>0">
|
|
|
|
+ and a.id in
|
|
|
|
+ <foreach item="items" collection="ids" separator="," open="(" close=")" index="">
|
|
|
|
+ #{items}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="!dsFlay">
|
|
|
|
+ and
|
|
|
|
+ <trim prefix="(" prefixOverrides="or" suffix=")">
|
|
|
|
+ <if test="dsUserId != null and dsUserId != ''">
|
|
|
|
+ or a.create_by=#{dsUserId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="dsDeptId != null and dsDeptId != 0">
|
|
|
|
+ or b.dept_id=#{dsDeptId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="dsDeptIds != null">
|
|
|
|
+ or b.dept_id in
|
|
|
|
+ <foreach item="item" collection="dsDeptIds" separator="," open="(" close=")" index="">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ </trim>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="alarmType != null and alarmType != 0">
|
|
|
|
+ and a.alarm_type=#{alarmType}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="alarmMile != null and alarmMile != 0">
|
|
|
|
+ and a.alarm_mile=#{alarmMile}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="isLock != null and isLock != 0">
|
|
|
|
+ and a.is_lock=#{isLock}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="lineDir != null and lineDir != 0">
|
|
|
|
+ and a.line_dir =#{lineDir}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="releasedType != null and releasedType != 0">
|
|
|
|
+ and a.released_type =#{releasedType}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="beginAlarmTime != null and beginAlarmTime != ''">
|
|
|
|
+ and date_format(a.alarm_time,'%Y-%m-%d') >= date_format(#{beginAlarmTime},'%Y-%m-%d')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="endAlarmTime != null and endAlarmTime != ''">
|
|
|
|
+ AND date_format(a.alarm_time,'%Y-%m-%d') <= date_format(#{endAlarmTime},'%Y-%m-%d')
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ order by a.alarm_time desc
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="getByAlarmId" resultType="com.ozs.service.entity.MsgAlarm" parameterType="java.lang.String">
|
|
<select id="getByAlarmId" resultType="com.ozs.service.entity.MsgAlarm" parameterType="java.lang.String">
|
|
@@ -526,4 +554,43 @@
|
|
and a.released_url is null
|
|
and a.released_url is null
|
|
and a.alarm_time <= DATE_SUB(NOW(), INTERVAL 10 MINUTE)
|
|
and a.alarm_time <= DATE_SUB(NOW(), INTERVAL 10 MINUTE)
|
|
</select>
|
|
</select>
|
|
|
|
+ <select id="selectAlarmStatistics" resultType="java.util.HashMap">
|
|
|
|
+ SELECT
|
|
|
|
+ SUM(CASE WHEN rm.railway_type = 1 THEN 1 ELSE 0 END) AS highAlarmCount,
|
|
|
|
+ SUM(CASE WHEN rm.railway_type <> 1 THEN 1 ELSE 0 END) AS puAlarmCount,
|
|
|
|
+ SUM(CASE WHEN am.is_lock = 2 AND rm.railway_type = 1 THEN 1 ELSE 0 END) AS highUnresolvedCount,
|
|
|
|
+ SUM(CASE WHEN am.is_lock = 2 AND rm.railway_type <> 1 THEN 1 ELSE 0 END) AS puUnresolvedCount
|
|
|
|
+ FROM
|
|
|
|
+ msg_alarm am
|
|
|
|
+ JOIN
|
|
|
|
+ base_camera_management cm ON am.camera_code = cm.camera_code
|
|
|
|
+ JOIN
|
|
|
|
+ base_railway_management rm ON cm.railway_code = rm.railway_code
|
|
|
|
+ <where>
|
|
|
|
+ am.is_lock IN (1, 2)
|
|
|
|
+ <if test="ids != null and ids.size>0">
|
|
|
|
+ and a.id in
|
|
|
|
+ <foreach item="items" collection="ids" separator="," open="(" close=")" index="">
|
|
|
|
+ #{items}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="!dsFlay">
|
|
|
|
+ and
|
|
|
|
+ <trim prefix="(" prefixOverrides="or" suffix=")">
|
|
|
|
+ <if test="dsUserId != null and dsUserId != ''">
|
|
|
|
+ or am.create_by=#{dsUserId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="dsDeptId != null and dsDeptId != 0">
|
|
|
|
+ or cm.dept_id=#{dsDeptId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="dsDeptIds != null">
|
|
|
|
+ or cm.dept_id in
|
|
|
|
+ <foreach item="item" collection="dsDeptIds" separator="," open="(" close=")" index="">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ </trim>
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ </select>
|
|
</mapper>
|
|
</mapper>
|