2025-04-23 13:40:42 +08:00
|
|
|
|
<?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.yfd.platform.modules.patroltask.mapper.AlarmLogMapper">
|
|
|
|
|
|
|
|
|
|
<!--静默监视查询-->
|
|
|
|
|
<select id="getAlarmListByType" resultType="java.util.Map">
|
|
|
|
|
SELECT
|
|
|
|
|
area_id,sp.patroldevice_name,sp.area_name,sp.place,a.*
|
|
|
|
|
FROM
|
|
|
|
|
(
|
|
|
|
|
SELECT
|
|
|
|
|
patroldevice_code,
|
|
|
|
|
monitor_type,
|
|
|
|
|
COUNT(*) count,
|
|
|
|
|
MAX(alarm_date) alarmDate
|
|
|
|
|
FROM
|
|
|
|
|
iis_alarm_log
|
|
|
|
|
WHERE
|
|
|
|
|
task_alarm_type = '2'
|
|
|
|
|
AND station_id = #{stationId}
|
|
|
|
|
<if test="areaId != null and areaId != ''">
|
|
|
|
|
AND area_id = #{areaId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="patrolDeviceName != null and patrolDeviceName != ''">
|
|
|
|
|
AND patroldevice_name LIKE concat('%',#{patrolDeviceName},'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="monitorType != null and monitorType != ''">
|
|
|
|
|
AND monitor_type = #{monitorType}
|
|
|
|
|
</if>
|
|
|
|
|
GROUP BY
|
|
|
|
|
monitor_type,
|
|
|
|
|
patroldevice_code) a
|
|
|
|
|
LEFT JOIN iis_substation_patroldevice sp ON a.patroldevice_code= sp.patroldevice_code
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!--根据设备编号查询告警列表-->
|
|
|
|
|
<select id="getAlarmListPage" resultType="java.util.Map">
|
|
|
|
|
SELECT
|
|
|
|
|
patroldevice_code,
|
|
|
|
|
content,
|
|
|
|
|
alarm_date,
|
|
|
|
|
defect_file_path
|
|
|
|
|
FROM
|
|
|
|
|
iis_alarm_log
|
|
|
|
|
WHERE
|
|
|
|
|
task_alarm_type = '2'
|
|
|
|
|
<if test="patrolDeviceCode != null and patrolDeviceCode != ''">
|
|
|
|
|
AND patroldevice_code = #{patrolDeviceCode}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="monitorType != null and monitorType != ''">
|
|
|
|
|
AND monitor_type = #{monitorType}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="startDate != null and startDate != ''">
|
|
|
|
|
and str_to_date(alarm_date, '%Y-%m-%d %H:%i:%s') >= #{startDate}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endDate != null and endDate != ''">
|
|
|
|
|
and str_to_date(alarm_date, '%Y-%m-%d %H:%i:%s') <= #{endDate}
|
|
|
|
|
</if>
|
|
|
|
|
ORDER By alarm_date DESC
|
|
|
|
|
</select>
|
2025-04-28 08:51:12 +08:00
|
|
|
|
<select id="getConfirmationRate" resultType="java.util.Map">
|
|
|
|
|
SELECT
|
|
|
|
|
COUNT(*) AS total_alarms, -- 总告警数量
|
|
|
|
|
SUM(check_result = 1) AS confirmed_count, -- 属实的数量(check_result=1)
|
|
|
|
|
ROUND(
|
|
|
|
|
SUM(check_result = 1) / COUNT(*) * 100, -- 计算比率(分子/分母*100)
|
|
|
|
|
3
|
|
|
|
|
) AS confirmation_rate,-- 比率保留2位小数
|
|
|
|
|
'%' AS unit
|
|
|
|
|
FROM
|
|
|
|
|
iis_alarm_log
|
|
|
|
|
WHERE 1=1
|
|
|
|
|
<if test="stationId != null and stationId != ''">
|
|
|
|
|
AND station_id = #{stationId}
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
2025-04-23 13:40:42 +08:00
|
|
|
|
</mapper>
|