Lius
2025-03-03 5ae1b71ab6b57140d46e6a8b9e606bb4a390ce27
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
43
44
45
46
47
48
<?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.MdcPlanCloseMapper">
 
    <select id="pageList" resultType="org.jeecg.modules.mdc.entity.MdcPlanClose">
        SELECT
            *
        FROM
            mdc_plan_close
        <where>
            <if test="mdcPlanClose.equipmentId != null and mdcPlanClose.equipmentId != ''">
                AND equipment_id = #{ mdcPlanClose.equipmentId }
            </if>
            <if test="mdcPlanClose.planCloseType != null and mdcPlanClose.planCloseType != ''">
                AND plan_close_type = #{ mdcPlanClose.planCloseType }
            </if>
            <if test="mdcPlanClose.theDate != null and mdcPlanClose.theDate != ''">
                AND the_date LIKE CONCAT('%',#{ mdcPlanClose.theDate },'%')
            </if>
            <if test="mdcPlanClose.startTime != null and mdcPlanClose.startTime != ''">
                AND the_date &gt;= #{ mdcPlanClose.startTime }
            </if>
            <if test="mdcPlanClose.endTime != null and mdcPlanClose.endTime != ''">
                AND the_date &lt;= #{mdcPlanClose.endTime }
            </if>
            <if test="mdcPlanClose.equipmentIdList != null and mdcPlanClose.equipmentIdList.size() > 0 ">
                AND equipment_id IN
                <foreach collection="mdcPlanClose.equipmentIdList" item="id" index="index" open="(" close=")" separator=",">
                    #{ id }
                </foreach>
            </if>
            AND close_type = #{ mdcPlanClose.closeType }
        </where>
        ORDER BY the_date DESC, equipment_id ASC
    </select>
 
    <!--计算 计划/非计划停机当天总时长-->
    <select id="findPlanTimeDuration" resultType="java.lang.Integer">
        SELECT
            sum(plan_close_time_long)
        FROM
            mdc_plan_close
        WHERE
            equipment_id = #{equipmentId}
            AND the_date = #{validDate}
            AND close_type = #{closeType}
    </select>
</mapper>