qushaowei
2024-01-11 0581d9986b4d14cdf8a6f66a929674224dd45b2f
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
<?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.eam.mapper.EquipmentReportRepairMapper">
    <select id="getReportRepairList"  parameterType="Map" resultType="Map">
        SELECT
        t1.id,
        t1.err_uda1 errUda1,
        t1.err_uda2 errUda2,
        t1.num num,
        t1.equipment_id equipmentId,
        t1.fault_reason faultReason,
        t1.fault_description faultDescription,
        t1.photo photo,
        t1.is_stop isStop,
        t1.approval approval,
        t1.fault_time faultTime,
        t1.type,
        t1.source source,
        t1.source_id sourceId,
        t1.urgency urgency,
        t1.is_create_order isCreateOrder,
        t1.use_depart_id useDepartId,
        t1.remark remark,
        t1.status status,
        t1.create_by createBy,
        t1.create_time createTime,
        t1.update_by updateBy,
        t1.update_time updateTime,
        t1.accept_time acceptTime,
        t1.fault_hour faultHour,
        t2.num equipmentNum,
        t2.name equipmentName,
        t2.model equipmentModel,
        t2.specific_equipment specificEquipment,
        t2.team_id teamId,
        t2.specification equipmentSpecification,
        t3.depart_name departName,
        t4.item_text urgencyName,
        t5.item_text statusName,
        t6.item_text isStopName,
        t7.item_text errUda1_dictText
        FROM
        mom_eam_equipment_report_repair t1
        left join mom_eam_equipment t2 on t1.equipment_id = t2.id
        left join sys_depart t3 on t1.use_depart_id = t3.id
        left join (select * from v_sys_dict where dict_code='urgency') t4 on t1.urgency = t4.item_value
        left join (select * from v_sys_dict where dict_code='equipment_report_repair_status') t5 on t1.status = t5.item_value
        left join (select * from v_sys_dict where dict_code='is_stop') t6 on t1.is_stop = t6.item_value
        left join (select * from v_sys_dict where dict_code='is_product') t7 on t1.err_uda1 = t7.item_value
        WHERE t1.del_flag = 0
        <if test="params.num != null and params.num != ''">
            and t1.num like concat('%',#{params.num},'%')
        </if>
        <if test="params.equipmentId != null and params.equipmentId != ''">
            and t1.equipment_id = #{params.equipmentId}
        </if>
        <if test="params.faultDescription != null and params.faultDescription != ''">
            and t1.fault_description like concat('%',#{params.faultDescription},'%')
        </if>
        <if test="params.faultStartTime != null and params.faultStartTime != ''">
            and t1.fault_time &gt;= #{params.faultStartTime}
        </if>
        <if test="params.faultEndTime != null and params.faultEndTime != ''">
            and t1.fault_time &lt;= #{params.faultEndTime}
        </if>
        <if test="params.isStop != null and params.isStop != ''">
            and t1.is_stop = #{params.isStop}
        </if>
        <if test="params.status != null and params.status != ''">
            and t1.status = #{params.status}
        </if>
        <if test="params.errUda2 != null and params.errUda2 != ''">
            and t1.err_uda2 like concat('%',#{params.errUda2},'%')
        </if>
        <if test="params.errUda1 != null and params.errUda1 != ''">
            and t1.err_uda1 = #{params.errUda1}
        </if>
        <if test="params.isStop != null and params.isStop != ''">
            and t1.is_stop  = #{params.isStop}
        </if>
        <if test="params.createBy!= null and params.createBy != ''">
            and t1.create_by like concat('%',#{params.createBy},'%')
        </if>
        <if test="params.equipmentNum != null and params.equipmentNum != ''">
            and t2.num like concat('%',#{params.equipmentNum},'%')
        </if>
        <if test="params.equipmentName != null and params.equipmentName != ''">
            and t2.name like concat('%',#{params.equipmentName},'%')
        </if>
        <if test="params.model != null and params.model != ''">
            and t2.model like concat('%',#{params.model},'%')
        </if>
        <if test="params.specificEquipment != null and params.specificEquipment != ''">
            and t2.specific_equipment = #{params.specificEquipment}
        </if>
        <if test="params.specification != null and params.specification != ''">
            and t2.specification like concat('%',#{params.specification},'%')
        </if>
        <if test="params.useId != null and params.useId != ''">
            and t2.use_id  = #{params.useId}
        </if>
        <if test="params.teamId != null and params.teamId != ''">
            and t2.team_id = #{params.teamId}
        </if>
        <if test="equipNums.size!=0">
            and t2.num in
            <foreach collection="equipNums" open="(" separator="," close=")" item="num">
                #{num}
            </foreach>
        </if>
        ORDER BY t1.create_time desc
    </select>
    <select id="exportList" resultType="org.jeecg.modules.eam.vo.RepairReportExportVo">
        SELECT
        t1.id,
        t1.err_uda1 errUda1,
        t1.err_uda2 errUda2,
        t1.num num,
        t1.equipment_id equipmentId,
        t1.fault_reason faultReason,
        t1.fault_description faultDescription,
        t1.photo photo,
        t1.is_stop isStop,
        t1.approval approval,
        t1.fault_time faultTime,
        t1.source source,
        t1.source_id sourceId,
        t1.urgency urgency,
        t1.is_create_order isCreateOrder,
        t1.use_depart_id useDepartId,
        t1.remark remark,
        t1.status status,
        t1.create_by createBy,
        t1.create_time createTime,
        t1.update_by updateBy,
        t1.update_time updateTime,
        t1.accept_time acceptTime,
        t1.fault_hour faultHour,
        t2.num equipmentNum,
        t2.name equipmentName,
        t2.model equipmentModel,
        t2.team_id teamId,
        t2.specification specification,
        t2.use_id useId,
        t2.specific_equipment specificEquipment
        FROM
        mom_eam_equipment_report_repair t1
        left join mom_eam_equipment t2 on t1.equipment_id = t2.id
        WHERE t1.del_flag = 0
        <if test="num != null and num != ''">
            and t1.num like concat('%',#{num},'%')
        </if>
        <if test="faultStartTime != null and faultStartTime != ''">
            and t1.fault_time &gt;= #{faultStartTime}
        </if>
        <if test="faultEndTime != null and faultEndTime != ''">
            and t1.fault_time &lt;= #{faultEndTime}
        </if>
        <if test="isStop != null and isStop != ''">
            and t1.is_stop = #{isStop}
        </if>
        <if test="status != null and status != ''">
            and t1.status = #{status}
        </if>
        <if test="errUda2 != null and errUda2 != ''">
            and t1.err_uda2 like concat('%',#{errUda2},'%')
        </if>
        <if test="errUda1 != null and errUda1 != ''">
            and t1.err_uda1 = #{errUda1}
        </if>
        <if test="createBy!= null and createBy != ''">
            and t1.create_by like concat('%',#{createBy},'%')
        </if>
        <if test="equipmentNum != null and equipmentNum != ''">
            and t2.num like concat('%',#{equipmentNum},'%')
        </if>
        <if test="equipmentName != null and equipmentName != ''">
            and t2.name like concat('%',#{equipmentName},'%')
        </if>
        <if test="equipmentModel != null and equipmentModel != ''">
            and t2.model like concat('%',#{model},'%')
        </if>
        <if test="specification != null and specification != ''">
            and t2.specification like concat('%',#{specification},'%')
        </if>
        <if test="useId != null and useId != ''">
            and t2.use_id  = #{useId}
        </if>
        <if test="equipNums.size!=0">
            and t2.num in
            <foreach collection="equipNums" open="(" separator="," close=")" item="num">
                #{num}
            </foreach>
        </if>
        ORDER BY t1.create_time desc
    </select>
</mapper>