Lius
2025-06-28 3d4e5941c728ff1c13d05195299c9c2163060ea4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?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="org.jeecg.modules.mdc.mapper.MdcEquipmentFaultInfoMapper">
 
    <select id="findFaultRecord" resultType="org.jeecg.modules.mdc.vo.EquFaultRecord">
        SELECT
            t3.equipment_code equipmentId,
            t1.fault_start_time startTime,
            t2.actual_end_time endTime
        FROM
            eam_report_repair t1
            LEFT JOIN eam_repair_order t2 ON t2.report_id = t1.id
            LEFT JOIN eam_equipment t3 ON t1.equipment_id = t3.id
        WHERE
            (
                ( t1.fault_start_time BETWEEN #{startTime} AND #{endTime} )
                OR ( t2.actual_end_time BETWEEN #{startTime} AND #{endTime} )
                OR ( t1.fault_start_time &lt; #{startTime} AND t2.actual_end_time IS NULL )
            )
          AND t3.equipment_code IN
            <foreach collection="equipmentIdList" item="id" index="index" open="(" close=")" separator=",">
                #{ id }
            </foreach>
          AND t1.report_status != 'ABOLISH'
    </select>
 
    <select id="getMaxStaticsData" resultType="java.lang.String">
        SELECT TOP 1 the_date FROM mdc_equipment_fault_info ORDER BY the_date DESC
    </select>
</mapper>