Lius
2024-10-24 a7a4e0e6ae09c720e50dc22fc50c67519414067c
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?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.MdcEquipmentOvertimeMapper">
 
    <!--分页查询-->
    <select id="pageList" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentOvertime">
        SELECT
            t1.id,
            t1.equipment_id equipmentId,
            t2.equipment_name equipmentName,
            t1.the_date theDate,
            t1.start_time startTime,
            t1.end_time endTime,
            t1.duration duration,
            t1.remark remark,
            t1.create_by createBy,
            t1.create_time createTime,
            t1.update_by updateBy,
            t1.update_time updateTime
        FROM
            mdc_equipment_overtime t1
            LEFT JOIN mdc_equipment t2 ON t2.equipment_id = t1.equipment_id
        <where>
            <if test="mdcEquipmentOvertime.equipmentName != null and mdcEquipmentOvertime.equipmentName != '' ">
                AND t2.equipment_name LIKE '%' + #{mdcEquipmentOvertime.equipmentName} + '%'
            </if>
            <if test="mdcEquipmentOvertime.equipmentId != null and mdcEquipmentOvertime.equipmentId != '' ">
                AND t1.equipment_id LIKE '%' + #{mdcEquipmentOvertime.equipmentId} + '%'
            </if>
            <if test="mdcEquipmentOvertime.mdcSectionIds != null and mdcEquipmentOvertime.mdcSectionIds.size() > 0 ">
                AND t1.equipment_id IN
                <foreach collection="mdcEquipmentOvertime.mdcSectionIds" item="id" index="index" open="(" close=")" separator=",">
                    #{ id }
                </foreach>
            </if>
            <if test="mdcEquipmentOvertime.startTime != null and mdcEquipmentOvertime.startTime != '' and mdcEquipmentOvertime.endTime != null and mdcEquipmentOvertime.endTime != ''">
                AND t1.the_date BETWEEN #{ mdcEquipmentOvertime.startTime } AND #{ mdcEquipmentOvertime.endTime }
            </if>
        </where>
        order by t1.the_date asc
    </select>
 
    <!--list列表-->
    <select id="list" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentOvertime">
        SELECT
            t1.id,
            t1.equipment_id equipmentId,
            t2.equipment_name equipmentName,
            t1.the_date theDate,
            t1.start_time startTime,
            t1.end_time endTime,
            t1.duration duration,
            t1.remark remark,
            t1.create_by createBy,
            t1.create_time createTime,
            t1.update_by updateBy,
            t1.update_time updateTime
        FROM
            mdc_equipment_overtime t1
            LEFT JOIN mdc_equipment t2 ON t2.equipment_id = t1.equipment_id
        <where>
            <if test="mdcEquipmentOvertime.equipmentName != null and mdcEquipmentOvertime.equipmentName != '' ">
                AND t2.equipment_name LIKE '%' + #{mdcEquipmentOvertime.equipmentName} + '%'
            </if>
            <if test="mdcEquipmentOvertime.equipmentId != null and mdcEquipmentOvertime.equipmentId != '' ">
                AND t1.equipment_id LIKE '%' + #{mdcEquipmentOvertime.equipmentId} + '%'
            </if>
            <if test="mdcEquipmentOvertime.mdcSectionIds != null and mdcEquipmentOvertime.mdcSectionIds.size() > 0 ">
                AND t1.equipment_id IN
                <foreach collection="mdcEquipmentOvertime.mdcSectionIds" item="id" index="index" open="(" close=")" separator=",">
                    #{ id }
                </foreach>
            </if>
            <if test="mdcEquipmentOvertime.startTime != null and mdcEquipmentOvertime.startTime != '' and mdcEquipmentOvertime.endTime != null and mdcEquipmentOvertime.endTime != ''">
                AND t1.the_date BETWEEN #{ mdcEquipmentOvertime.startTime } AND #{ mdcEquipmentOvertime.endTime }
            </if>
        </where>
            order by t1.the_date asc
    </select>
 
    <!--查询加班时长-->
    <select id="computeOvertime" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentOvertime">
        SELECT
            *
        FROM
            mdc_equipment_overtime
        WHERE
            the_date LIKE #{ validDate } + '%' AND equipment_id = #{ equipmentId }
    </select>
</mapper>