SmartSubstationPlatform/riis-system/src/main/resources/mapper/patroltask/DefectDeviceMapper.xml
2025-04-23 13:40:42 +08:00

54 lines
2.3 KiB
XML

<?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.DefectDeviceMapper">
<select id="getDefectDeviceList" resultType="java.util.Map">
SELECT
d.*,sd.device_class,tt.cexamine_user_name,tt.examine_date
FROM
( SELECT *, CASE WHEN revise_valid = '0' THEN '1' WHEN revise_valid = '1' THEN '2' ELSE valid END AS valid1 FROM
iis_defect_device ) d
INNER JOIN iis_substation_device sd ON sd.device_id = d.device_id
INNER JOIN iis_task_todo tt ON tt.task_todo_id = d.task_todo_id
WHERE
d.datastatus = '1'
AND tt.task_type != '4'
AND (d.valid1= '2'
OR ( d.flag = '4' OR d.flag = '6' ))
<if test="stationCode != null and stationCode != ''">
AND d.station_code=#{stationCode}
</if>
<if test="areaId != null and areaId != ''">
AND d.area_id=#{areaId}
</if>
<if test="bayId != null and bayId != ''">
AND d.bay_id=#{bayId}
</if>
<if test="taskName != null and taskName != ''">
AND d.task_name LIKE concat('%',#{taskName},'%')
</if>
<if test="deviceName != null and deviceName != ''">
AND d.device_name LIKE concat('%',#{deviceName},'%')
</if>
<if test="patroldeviceName != null and patroldeviceName != ''">
AND d.patroldevice_name LIKE concat('%',#{patroldeviceName},'%')
</if>
<if test="componentName != null and componentName != ''">
AND d.component_name LIKE concat('%',#{componentName},'%')
</if>
<if test="recognitionType != null and recognitionType != ''">
AND FIND_IN_SET(#{recognitionType},d.recognition_type)
</if>
<if test="isDefectFlag != null and isDefectFlag != ''">
AND d.is_defect_flag=#{isDefectFlag}
</if>
<if test="startDate != null and startDate != ''">
and str_to_date(time, '%Y-%m-%d %H:%i:%s') &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and str_to_date(time, '%Y-%m-%d %H:%i:%s') &lt;= #{endDate}
</if>
ORDER BY d.patroldevice_date
</select>
</mapper>