Lius
2025-04-27 0b2ebd27d2afc72aaeb9cd7b1eeec30a90748f3a
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
31
32
33
34
35
36
37
38
39
40
41
42
<?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.MdcDowntimeMapper">
 
    <select id="pageList" resultType="org.jeecg.modules.mdc.dto.MdcDowntimeDto">
        SELECT
            t1.* ,
            t2.downtime_type downtimeType,
            t2.downtime_description downtimeDescription
        FROM mdc_downtime t1 LEFT JOIN mdc_downtime_reason t2 ON t1.reason_id = t2.id
        <where>
            <if test="mdcDowntimeVo.equipmentId != null and mdcDowntimeVo.equipmentId != ''">
                AND t1.equipment_id = #{ mdcDowntimeVo.equipmentId }
            </if>
            <if test="mdcDowntimeVo.equipmentName != null and mdcDowntimeVo.equipmentName != ''">
                AND t1.equipment_name = #{ mdcDowntimeVo.equipmentName }
            </if>
            <if test="mdcDowntimeVo.theDate != null and mdcDowntimeVo.theDate != ''">
                AND t1.the_date = #{ mdcDowntimeVo.theDate }
            </if>
            <if test="mdcDowntimeVo.equipmentIdList != null and mdcDowntimeVo.equipmentIdList.size() > 0 ">
                AND t1.equipment_id IN
                <foreach collection="mdcDowntimeVo.equipmentIdList" item="equipmentId" index="index" open="(" close=")" separator=",">
                    #{ equipmentId }
                </foreach>
            </if>
        </where>
        ORDER BY t1.create_time DESC
    </select>
 
    <select id="findPlanTimeDuration" resultType="org.jeecg.modules.mdc.entity.MdcDowntime">
        SELECT
            t1.*
        FROM
            mdc_downtime t1
                LEFT JOIN mdc_downtime_reason t2 ON t1.reason_id = t2.id
        WHERE
            t1.equipment_id = #{equipmentId}
            AND t2.downtime_type = #{closeType}
            AND t1.the_date = #{validDate}
    </select>
</mapper>