SmartSubstationPlatform/riis-system/src/main/resources/mapper/patroltask/AlarmLogMapper.xml

62 lines
2.1 KiB
XML
Raw Normal View History

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') &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and str_to_date(alarm_date, '%Y-%m-%d %H:%i:%s') &lt;= #{endDate}
</if>
ORDER By alarm_date DESC
</select>
</mapper>