TpPInspectRecordSMapper.xml
10.3 KB
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
<?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="com.zteits.park.mapper.smapper.TpPInspectRecordSMapper">
<resultMap id="BaseResultMap" type="com.zteits.park.domain.TpPInspectRecord">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="inspect_record_no" jdbcType="VARCHAR" property="inspectRecordNo" />
<result column="inspect_type" jdbcType="INTEGER" property="inspectType" />
<result column="inspect_eqp_no" jdbcType="VARCHAR" property="inspectEqpNo" />
<result column="inspect_eqp_name" jdbcType="VARCHAR" property="inspectEqpName" />
<result column="pl_no" jdbcType="VARCHAR" property="plNo" />
<result column="pl_name" jdbcType="VARCHAR" property="plName" />
<result column="park_area_code" jdbcType="VARCHAR" property="parkAreaCode" />
<result column="park_area_name" jdbcType="VARCHAR" property="parkAreaName" />
<result column="berth_no" jdbcType="VARCHAR" property="berthNo" />
<result column="eqp_no" jdbcType="VARCHAR" property="eqpNo" />
<result column="charger_code" jdbcType="VARCHAR" property="chargerCode" />
<result column="charger_name" jdbcType="VARCHAR" property="chargerName" />
<result column="inspect_code" jdbcType="VARCHAR" property="inspectCode" />
<result column="inspect_name" jdbcType="VARCHAR" property="inspectName" />
<result column="handler_code" jdbcType="VARCHAR" property="handlerCode" />
<result column="handler_name" jdbcType="VARCHAR" property="handlerName" />
<result column="trace_id" jdbcType="BIGINT" property="traceId" />
<result column="accept_time" jdbcType="TIMESTAMP" property="acceptTime" />
<result column="inspect_img_url1" jdbcType="VARCHAR" property="inspectImgUrl1" />
<result column="inspect_img_url2" jdbcType="VARCHAR" property="inspectImgUrl2" />
<result column="inspect_img_url3" jdbcType="VARCHAR" property="inspectImgUrl3" />
<result column="inspect_time" jdbcType="TIMESTAMP" property="inspectTime" />
<result column="inspect_level" jdbcType="INTEGER" property="inspectLevel" />
<result column="inspect_address" jdbcType="VARCHAR" property="inspectAddress" />
<result column="inspect_extra_remark" jdbcType="VARCHAR" property="inspectExtraRemark" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="deal_state" jdbcType="INTEGER" property="dealState" />
<result column="data_state" jdbcType="INTEGER" property="dataState" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="create_op" jdbcType="VARCHAR" property="createOp" />
<result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime" />
<result column="modify_op" jdbcType="VARCHAR" property="modifyOp" />
<result column="org_id" jdbcType="BIGINT" property="orgId" />
</resultMap>
<sql id="Base_Column_List">
id, inspect_record_no, inspect_type, inspect_eqp_no, inspect_eqp_name, pl_no, pl_name,
park_area_code, park_area_name, berth_no, eqp_no, charger_code, charger_name, inspect_code,
inspect_name, handler_code, handler_name, trace_id, accept_time, inspect_img_url1,
inspect_img_url2, inspect_img_url3, inspect_time, inspect_level, inspect_address,
inspect_extra_remark, remark, deal_state, data_state, create_time, create_op, modify_time,
modify_op, org_id
</sql>
<select id="queryInspectRecordListStatic" parameterType="com.zteits.clouds.api.dto.park.param.TpPInspectRecordRequest"
resultType="com.zteits.park.domain.TpPInspectRecord">
select
inspect_eqp_no inspectEqpNo,inspect_eqp_name inspectEqpName,deal_state dealState
from tp_p_inspect_record
where inspect_type = #{inspectType,jdbcType=INTEGER}
and deal_state = 0
and data_state = 1
AND org_id = #{orgId}
group by inspect_eqp_no,inspect_eqp_name
order by inspect_eqp_no
</select>
<select id="queryTpPInspectRecord" parameterType="com.zteits.clouds.api.dto.park.param.TpPInspectRecordRequest"
resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tp_p_inspect_record
where
data_state = 1
<if test="inspectType != null and inspectType != ''">
AND inspect_type = #{inspectType}
</if>
<if test="inspectEqpNo != null and inspectEqpNo != ''">
AND inspect_eqp_no = #{inspectEqpNo}
</if>
<!--<if test="handlerCode != null and handlerCode != ''">-->
<!--AND handler_code = #{handlerCode}-->
<!--</if>-->
AND org_id = #{orgId}
<if test="plNo != null and plNo != ''">
AND pl_no = #{plNo}
</if>
<if test="dealStates !=null and dealStates.size > 0 ">
and deal_state in
<foreach collection="dealStates" item="state" separator="," open="(" close=")">
${state}
</foreach>
</if>
<if test="dealState != null">
and deal_state = #{dealState}
</if>
<if test="beginTime != null">
and accept_time >= #{beginTime}
</if>
<if test="handleDuration != null">
and DATE_ADD(accept_time,INTERVAL #{handleDuration} SECOND) <= now()
</if>
<if test="endTime != null">
and accept_time <= #{endTime}
</if>
<if test="handlerCode != null and handlerCode != ''">
and inspect_record_no in (
SELECT
DISTINCT rlt_inspect_record_no
FROM tp_p_inspect_record_trace
WHERE data_state = 1
AND accept_op = #{handlerCode}
)
</if>
<if test="beginTime != null">
and accept_time >= #{beginTime}
</if>
<if test="endTime != null">
and accept_time <= #{endTime}
</if>
<if test="handlerCode != null and handlerCode != ''">
and inspect_record_no in (
SELECT
DISTINCT rlt_inspect_record_no
FROM tp_p_inspect_record_trace
WHERE data_state = 1
AND accept_op = #{handlerCode}
)
</if>
</select>
<select id="getInspectRecordMsg" parameterType="com.zteits.clouds.api.dto.park.param.TpPInspectRecordRequest"
resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tp_p_inspect_record
where inspect_record_no = #{inspectRecordNo,jdbcType=VARCHAR}
and data_state = 1
</select>
<select id="queryTpPInspectRecordCount" resultType="java.util.Map">
select
deal_state dealState,count(*) num
from tp_p_inspect_record
where
data_state = 1
<if test="inspectType != null and inspectType != ''">
AND inspect_type = #{inspectType}
</if>
<if test="inspectEqpNo != null and inspectEqpNo != ''">
AND inspect_eqp_no = #{inspectEqpNo}
</if>
<!--<if test="handlerCode != null and handlerCode != ''">-->
<!--AND handler_code = #{handlerCode}-->
<!--</if>-->
AND org_id = #{orgId}
<if test="plNo != null and plNo != ''">
AND pl_no = #{plNo}
</if>
<if test="dealStates !=null and dealStates.size > 0 ">
and deal_state in
<foreach collection="dealStates" item="state" separator="," open="(" close=")">
${state}
</foreach>
</if>
<if test="dealState != null">
and deal_state = #{dealState}
</if>
<if test="handlerCode != null and handlerCode != ''">
and inspect_record_no in (
SELECT
DISTINCT rlt_inspect_record_no
FROM tp_p_inspect_record_trace
WHERE data_state = 1
AND accept_op = #{handlerCode}
)
</if>
GROUP BY deal_state
</select>
<!-- 修改 -->
<update id="updateByInspectRecordNo" parameterType="com.zteits.park.domain.TpPInspectRecord">
update tp_p_inspect_record
<set>
<if test="inspectType != null">
inspect_type = #{inspectType,jdbcType=INTEGER},
</if>
<if test="inspectEqpNo != null">
inspect_eqp_no = #{inspectEqpNo,jdbcType=VARCHAR},
</if>
<if test="inspectEqpName != null">
inspect_eqp_name = #{inspectEqpName,jdbcType=VARCHAR},
</if>
<if test="plNo != null">
pl_no = #{plNo,jdbcType=VARCHAR},
</if>
<if test="plName != null">
pl_name = #{plName,jdbcType=VARCHAR},
</if>
<if test="parkAreaCode != null">
park_area_code = #{parkAreaCode,jdbcType=VARCHAR},
</if>
<if test="parkAreaName != null">
park_area_name = #{parkAreaName,jdbcType=VARCHAR},
</if>
<if test="berthNo != null">
berth_no = #{berthNo,jdbcType=VARCHAR},
</if>
<if test="eqpNo != null">
eqp_no = #{eqpNo,jdbcType=VARCHAR},
</if>
<if test="chargerCode != null">
charger_code = #{chargerCode,jdbcType=VARCHAR},
</if>
<if test="chargerName != null">
charger_name = #{chargerName,jdbcType=VARCHAR},
</if>
<if test="inspectCode != null">
inspect_code = #{inspectCode,jdbcType=VARCHAR},
</if>
<if test="inspectName != null">
inspect_name = #{inspectName,jdbcType=VARCHAR},
</if>
<if test="inspectImgUrl1 != null">
inspect_img_url1 = #{inspectImgUrl1,jdbcType=VARCHAR},
</if>
<if test="inspectImgUrl2 != null">
inspect_img_url2 = #{inspectImgUrl2,jdbcType=VARCHAR},
</if>
<if test="inspectImgUrl3 != null">
inspect_img_url3 = #{inspectImgUrl3,jdbcType=VARCHAR},
</if>
<if test="inspectTime != null">
inspect_time = #{inspectTime,jdbcType=TIMESTAMP},
</if>
<if test="inspectAddress != null">
inspect_address = #{inspectAddress,jdbcType=VARCHAR},
</if>
<if test="inspectExtraRemark != null">
inspect_extra_remark = #{inspectExtraRemark,jdbcType=VARCHAR},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="dealState != null">
deal_state = #{dealState,jdbcType=INTEGER},
</if>
<if test="dataState != null">
data_state = #{dataState,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="createOp != null">
create_op = #{createOp,jdbcType=VARCHAR},
</if>
<if test="modifyTime != null">
modify_time = #{modifyTime,jdbcType=TIMESTAMP},
</if>
<if test="modifyOp != null">
modify_op = #{modifyOp,jdbcType=VARCHAR},
</if>
</set>
where inspect_record_no = #{inspectRecordNo,jdbcType=VARCHAR}
</update>
</mapper>