Lius
2024-08-12 16e35b191d910e5e586a9eae5678324bfa679408
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<?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.MdcProcessQuantityMapper">
 
    <!--分页查询-->
    <select id="pageList" resultType="org.jeecg.modules.mdc.dto.MdcProcessQuantityDto">
        SELECT
            t1.id id,
            t3.equipment_id equipmentId,
            t3.equipment_name equipmentName,
            t2.parts_code partsCode,
            t2.batch_code batchCode,
            t2.sequence_number sequenceNumber,
            t1.standard_id standardId,
            t1.efficient_date efficientDate,
            t1.process_quantity processQuantity,
            t2.duration duration,
            t1.remark remark,
            t1.create_by createBy,
            t1.create_time createTime,
            t1.update_by updateBy,
            t1.update_time updateTime
        FROM
            mdc_process_quantity t1
            LEFT JOIN mdc_standard_process_duration t2 ON t1.standard_id = t2.id
            LEFT JOIN mdc_equipment t3 ON t1.equipment_id = t3.equipment_id
        <where>
            <if test="mdcProcessQuantity.equipmentId != null and mdcProcessQuantity.equipmentId != ''">
                AND t3.equipment_id LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.equipmentId }),'%')
            </if>
            <if test="mdcProcessQuantity.equipmentName != null and mdcProcessQuantity.equipmentName != ''">
                AND t3.equipment_name LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.equipmentName }),'%')
            </if>
            <if test="mdcProcessQuantity.partsCode != null and mdcProcessQuantity.partsCode != ''">
                AND t2.parts_code LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.partsCode }),'%')
            </if>
            <if test="mdcProcessQuantity.batchCode != null and mdcProcessQuantity.batchCode != ''">
                AND t2.batch_code LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.batchCode }),'%')
            </if>
            <if test="mdcProcessQuantity.sequenceNumber != null and mdcProcessQuantity.sequenceNumber != ''">
                AND t2.sequence_number LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.sequenceNumber }),'%')
            </if>
            <if test="mdcProcessQuantity.startTime != null and mdcProcessQuantity.endTime != null">
                AND t1.efficient_date BETWEEN #{ mdcProcessQuantity.startTime } AND #{ mdcProcessQuantity.endTime }
            </if>
            <if test="mdcProcessQuantity.processQuantity != null and mdcProcessQuantity.processQuantity != ''">
                AND t1.process_quantity = #{ mdcProcessQuantity.processQuantity }
            </if>
            <if test="mdcProcessQuantity.mdcSectionIds != null and mdcProcessQuantity.mdcSectionIds.size() > 0 ">
                AND t3.equipment_id IN
                <foreach collection="mdcProcessQuantity.mdcSectionIds" item="id" index="index" open="(" close=")" separator=",">
                    #{ id }
                </foreach>
            </if>
        </where>
        ORDER BY t3.equipment_name ASC, t1.efficient_date DESC
    </select>
 
    <!--导出数据查询-->
    <select id="list" resultType="org.jeecg.modules.mdc.dto.MdcProcessQuantityDto">
        SELECT
        t1.id id,
        t3.equipment_id equipmentId,
        t3.equipment_name equipmentName,
        t2.parts_code partsCode,
        t2.batch_code batchCode,
        t2.sequence_number sequenceNumber,
        t1.standard_id standardId,
        t1.efficient_date efficientDate,
        t1.process_quantity processQuantity,
        t2.duration duration,
        t1.remark remark,
        t1.create_by createBy,
        t1.create_time createTime,
        t1.update_by updateBy,
        t1.update_time updateTime
        FROM
        mdc_process_quantity t1
        LEFT JOIN mdc_standard_process_duration t2 ON t1.standard_id = t2.id
        LEFT JOIN mdc_equipment t3 ON t1.equipment_id = t3.equipment_id
        <where>
            <if test="mdcProcessQuantity.equipmentId != null and mdcProcessQuantity.equipmentId != ''">
                AND t3.equipment_id LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.equipmentId }),'%')
            </if>
            <if test="mdcProcessQuantity.equipmentName != null and mdcProcessQuantity.equipmentName != ''">
                AND t3.equipment_name LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.equipmentName }),'%')
            </if>
            <if test="mdcProcessQuantity.partsCode != null and mdcProcessQuantity.partsCode != ''">
                AND t2.parts_code LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.partsCode }),'%')
            </if>
            <if test="mdcProcessQuantity.batchCode != null and mdcProcessQuantity.batchCode != ''">
                AND t2.batch_code LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.batchCode }),'%')
            </if>
            <if test="mdcProcessQuantity.sequenceNumber != null and mdcProcessQuantity.sequenceNumber != ''">
                AND t2.sequence_number LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.sequenceNumber }),'%')
            </if>
            <if test="mdcProcessQuantity.startTime != null and mdcProcessQuantity.endTime != null">
                AND t1.efficient_date BETWEEN #{ mdcProcessQuantity.startTime } AND #{ mdcProcessQuantity.endTime }
            </if>
            <if test="mdcProcessQuantity.processQuantity != null and mdcProcessQuantity.processQuantity != ''">
                AND t1.process_quantity = #{ mdcProcessQuantity.processQuantity }
            </if>
            <if test="mdcProcessQuantity.mdcSectionIds != null and mdcProcessQuantity.mdcSectionIds.size() > 0 ">
                AND t3.equipment_id IN
                <foreach collection="mdcProcessQuantity.mdcSectionIds" item="id" index="index" open="(" close=")" separator=",">
                    #{ id }
                </foreach>
            </if>
        </where>
        ORDER BY t3.equipment_name ASC, t1.efficient_date DESC
    </select>
 
    <!--根据id查询-->
    <select id="findById" resultType="org.jeecg.modules.mdc.dto.MdcProcessQuantityDto">
        SELECT
            t1.id id,
            t3.equipment_id equipmentId,
            t3.equipment_name equipmentName,
            t2.parts_code partsCode,
            t2.batch_code batchCode,
            t2.sequence_number sequenceNumber,
            t1.standard_id standardId,
            t1.efficient_date efficientDate,
            t1.process_quantity processQuantity,
            t2.duration duration,
            t1.remark remark,
            t1.create_by createBy,
            t1.create_time createTime,
            t1.update_by updateBy,
            t1.update_time updateTime
        FROM mdc_process_quantity t1
            LEFT JOIN mdc_standard_process_duration t2 ON t1.standard_id = t2.id
            LEFT JOIN mdc_equipment t3 ON t1.equipment_id = t3.equipment_id
        WHERE t1.id = #{ id }
    </select>
 
    <select id="findList" resultType="org.jeecg.modules.mdc.dto.MdcProcessQuantityDto">
        SELECT
            t1.id id,
            t1.equipment_id equipmentId,
            t2.parts_code partsCode,
            t2.batch_code batchCode,
            t2.sequence_number sequenceNumber,
            t1.standard_id standardId,
            t1.efficient_date efficientDate,
            t1.process_quantity processQuantity,
            t2.duration duration
        FROM
            mdc_process_quantity t1
                LEFT JOIN mdc_standard_process_duration t2 ON t1.standard_id = t2.id
        WHERE
            t1.equipment_id = #{equipmentId}
            AND t1.efficient_date LIKE CONCAT(CONCAT('%',#{ validDate }),'%')
    </select>
</mapper>