TpEEmployeeChargeSMapper.xml
16.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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
<?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.TpEEmployeeChargeSMapper">
<resultMap id="BaseResultGroupMap" type="com.zteits.clouds.api.dto.park.dto.TpEEmployeeChargeDTO">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="charger_code" jdbcType="VARCHAR" property="chargerCode" />
<result column="charger_name" jdbcType="VARCHAR" property="chargerName" />
<result column="charger_nickname" jdbcType="VARCHAR" property="chargerNickname" />
<result column="pl_no" jdbcType="VARCHAR" property="plNo" />
<result column="pl_name" jdbcType="VARCHAR" property="plName" />
<result column="charger_pwd" jdbcType="VARCHAR" property="chargerPwd" />
<result column="token" jdbcType="VARCHAR" property="token" />
<result column="charger_type" jdbcType="CHAR" property="chargerType" />
<result column="charger_sex" jdbcType="CHAR" property="chargerSex" />
<result column="phone_no" jdbcType="VARCHAR" property="phoneNo" />
<result column="addr" jdbcType="VARCHAR" property="addr" />
<result column="card_id" jdbcType="VARCHAR" property="cardId" />
<result column="status" jdbcType="CHAR" property="status" />
<result column="sign_modify_time" jdbcType="TIMESTAMP" property="signModifyTime" />
<result column="entry_time" jdbcType="DATE" property="entryTime" />
<result column="entry_status" jdbcType="INTEGER" property="entryStatus" />
<result column="account_status" jdbcType="INTEGER" property="accountStatus" />
<result column="auth_status" jdbcType="INTEGER" property="authStatus" />
<result column="data_status" jdbcType="INTEGER" property="dataStatus" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="create_op" jdbcType="BIGINT" property="createOp" />
<result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime" />
<result column="modify_op" jdbcType="BIGINT" property="modifyOp" />
<result column="org_id" jdbcType="BIGINT" property="orgId" />
</resultMap>
<resultMap id="BaseResultMap" type="com.zteits.park.domain.TpEEmployeeCharge">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="charger_code" jdbcType="VARCHAR" property="chargerCode" />
<result column="charger_name" jdbcType="VARCHAR" property="chargerName" />
<result column="charger_nickname" jdbcType="VARCHAR" property="chargerNickname" />
<result column="pl_no" jdbcType="VARCHAR" property="plNo" />
<result column="pl_name" jdbcType="VARCHAR" property="plName" />
<result column="charger_pwd" jdbcType="VARCHAR" property="chargerPwd" />
<result column="token" jdbcType="VARCHAR" property="token" />
<result column="charger_type" jdbcType="CHAR" property="chargerType" />
<result column="charger_sex" jdbcType="CHAR" property="chargerSex" />
<result column="phone_no" jdbcType="VARCHAR" property="phoneNo" />
<result column="addr" jdbcType="VARCHAR" property="addr" />
<result column="card_id" jdbcType="VARCHAR" property="cardId" />
<result column="status" jdbcType="CHAR" property="status" />
<result column="sign_modify_time" jdbcType="TIMESTAMP" property="signModifyTime" />
<result column="entry_time" jdbcType="DATE" property="entryTime" />
<result column="entry_status" jdbcType="INTEGER" property="entryStatus" />
<result column="account_status" jdbcType="INTEGER" property="accountStatus" />
<result column="auth_status" jdbcType="INTEGER" property="authStatus" />
<result column="data_status" jdbcType="INTEGER" property="dataStatus" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="create_op" jdbcType="BIGINT" property="createOp" />
<result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime" />
<result column="modify_op" jdbcType="BIGINT" property="modifyOp" />
<result column="org_id" jdbcType="BIGINT" property="orgId" />
</resultMap>
<!-- 根据收费员编号修改收费员信息 -->
<update id="updateByChargerCode" parameterType="com.zteits.park.domain.TpEEmployeeCharge">
update tp_e_employee_charge
<set>
<if test="chargerCode != null">
charger_code = #{chargerCode,jdbcType=VARCHAR},
</if>
<if test="chargerName != null">
charger_name = #{chargerName,jdbcType=VARCHAR},
</if>
<if test="chargerNickname != null">
charger_nickname = #{chargerNickname,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="chargerPwd != null">
charger_pwd = #{chargerPwd,jdbcType=VARCHAR},
</if>
<if test="token != null">
token = #{token,jdbcType=VARCHAR},
</if>
<if test="eqpSn != null">
eqp_sn = #{eqpSn,jdbcType=VARCHAR},
</if>
<if test="eqpUserName != null">
eqp_user_name = #{eqpUserName,jdbcType=VARCHAR},
</if>
<if test="eqpName != null">
eqp_name = #{eqpName,jdbcType=VARCHAR},
</if>
<if test="eqpCode != null">
eqp_code = #{eqpCode,jdbcType=VARCHAR},
</if>
<if test="eqpToken != null">
eqp_token = #{eqpToken,jdbcType=VARCHAR},
</if>
<if test="eqpUserPassword != null">
eqp_user_password = #{eqpUserPassword,jdbcType=VARCHAR},
</if>
<if test="chargerType != null">
charger_type = #{chargerType,jdbcType=CHAR},
</if>
<if test="chargerSex != null">
charger_sex = #{chargerSex,jdbcType=CHAR},
</if>
<if test="phoneNo != null">
phone_no = #{phoneNo,jdbcType=VARCHAR},
</if>
<if test="addr != null">
addr = #{addr,jdbcType=VARCHAR},
</if>
<if test="cardId != null">
card_id = #{cardId,jdbcType=VARCHAR},
</if>
<if test="status != null">
status = #{status,jdbcType=CHAR},
</if>
<if test="signModifyTime != null">
sign_modify_time = #{signModifyTime,jdbcType=TIMESTAMP},
</if>
<if test="entryTime != null">
entry_time = #{entryTime,jdbcType=DATE},
</if>
<if test="entryStatus != null">
entry_status = #{entryStatus,jdbcType=INTEGER},
</if>
<if test="accountStatus != null">
account_status = #{accountStatus,jdbcType=INTEGER},
</if>
<if test="authStatus != null">
auth_status = #{authStatus,jdbcType=INTEGER},
</if>
<if test="dataStatus != null">
data_status = #{dataStatus,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="createOp != null">
create_op = #{createOp,jdbcType=BIGINT},
</if>
<if test="modifyTime != null">
modify_time = #{modifyTime,jdbcType=TIMESTAMP},
</if>
<if test="modifyOp != null">
modify_op = #{modifyOp,jdbcType=BIGINT},
</if>
<if test="orgId != null">
org_id = #{orgId,jdbcType=BIGINT},
</if>
</set>
where charger_code = #{chargerCode,jdbcType=VARCHAR}
</update>
<!-- 查询收费员信息 zhaowg 20171107 -->
<select id="queryEmployeesForPage" resultMap="BaseResultGroupMap">
SELECT
e.id,
e.charger_code,
e.charger_name,
e.pl_no,
e.pl_name,
e.charger_type,
e.charger_sex,
e.phone_no,
e.addr,
e.card_id,
e.status,
e.sign_modify_time,
e.entry_status,
e.entry_time,
e.account_status,
e.auth_status,
e.org_id
FROM
tp_e_employee_charge e
WHERE
e.data_status = 1
<if test="chargerType != null">
and e.charger_type = #{chargerType}
</if>
<if test="chargerTypes != null and chargerTypes.size>0">
and e.charger_type in
<foreach collection="chargerTypes" index="index" item="chargerType" open="(" separator="," close=")">
#{chargerType}
</foreach>
</if>
<if test="status != null">
and e.status = #{status}
</if>
<if test="orgId != null">
and e.org_id =#{orgId}
</if>
<if test="chargerCodes != null and chargerCodes.size>0">
and charger_code in
<foreach collection="chargerCodes" index="index" item="chargerCode" open="(" separator="," close=")">
#{chargerCode}
</foreach>
</if>
<if test="nameOrNo != null and nameOrNo !=''">
and (charger_name like concat('%',#{nameOrNo,jdbcType=VARCHAR},'%')
or charger_code like concat('%',#{nameOrNo,jdbcType=VARCHAR},'%'))
</if>
<if test="plNo != null and plNo != ''">
AND exists (select 1 from duty_roster r where r.charger_code = e.charger_code
and r.pl_no = #{plNo,jdbcType=VARCHAR}
<if test="parkAreaCode != null and parkAreaCode != ''">
and r.berth_range_no = #{parkAreaCode,jdbcType=VARCHAR}
</if>
and data_status = 1 and duty_day = date(now())
)
</if>
order by e.entry_status desc,e.entry_time desc,e.id
</select>
<!-- 根据停车场编号统计收费员人数 -->
<select id="queryEmployeeNumByPlNo" resultType="java.lang.Integer">
SELECT
COUNT(e.id)
FROM
tp_e_employee_charge e
WHERE
e.data_status = 1
<if test="status != null">
and e.status = #{status}
</if>
<if test="entryStatus != null">
and e.entry_status = #{entryStatus}
</if>
<if test="orgId != null">
and e.org_id = #{orgId}
</if>
<if test="chargerCodes != null and chargerCodes.size >0">
AND e.charger_code in
<foreach collection="chargerCodes" index="index" item="chargerCode" open="(" separator="," close=")">
#{chargerCode}
</foreach>
</if>
<if test="plNos != null and plNos.size >0">
and e.pl_no in
<foreach collection="plNos" index="index" item="plNo" open="(" separator="," close=")">#{plNo}</foreach>
</if>
<if test="chargerType != null">
and e.charger_type = #{chargerType}
</if>
</select>
<!-- 根据停车场编号统计收费员人数 -->
<select id="queryParkSourceEmployeeSta"
resultType="com.zteits.clouds.api.dto.park.dto.parksource.ParkSouceEmployeeStaDTO"
parameterType="com.zteits.clouds.api.dto.park.param.parksource.QueryParkSourceRequest">
SELECT
e.pl_no as plNo,
ifnull(COUNT(e.id),0) as allTollCollector,
ifnull(count(case when e.status = 0 then e.id end),0) as signInTollCollector,
ifnull(count(case when e.status != 0 then e.id end),0) as unSignInTollCollector
FROM
tp_e_employee_charge e
WHERE
e.data_status = 1 and e.entry_status = 1
<if test="plNos != null and plNos.size >0">
and e.pl_no in
<foreach collection="plNos" index="index" item="plNo" open="(" separator="," close=")">
#{plNo}
</foreach>
</if>
group by e.pl_no
</select>
<!-- 通过停车场外部编码查询停车场总车位数 -->
<!-- 20211221 因为没有接口调用报错,注释
<select id="getOrgIdsByCityIds" parameterType="com.zteits.clouds.api.dto.park.param.parklot.QueryOrgIdsByCityIdsRequest" resultType="java.lang.Long">
select org_id from parking_lot
where data_status = 1
and pl_city_id in
<foreach collection="cityIds" separator="," open="(" close=")" item="cityId" index="index">
#{cityId}
</foreach>
group by org_id
</select>-->
<!-- 根据组织编号List统计收费员人数 -->
<select id="queryEmployeeStaByOrgIds"
resultType="com.zteits.clouds.api.dto.park.dto.parksource.ParkSouceEmployeeStaDTO"
parameterType="com.zteits.clouds.api.dto.park.param.parksource.QueryParkSourceByOrgIdsRequest">
SELECT
ifnull(COUNT(e.id),0) as allTollCollector,
ifnull(COUNT(case when e.status = 0 then e.id end),0) as signInTollCollector,
ifnull(COUNT(case when e.status != 0 then e.id end),0) as unSignInTollCollector
FROM
tp_e_employee_charge e
WHERE
e.data_status = 1 and e.entry_status = 1 and charger_type = 0
and e.org_id in
<foreach collection="orgIds" separator="," open="(" close=")" item="orgId" index="index">
#{orgId}
</foreach>
</select>
<!-- 查询未排班的收费员信息 -->
<select id="queryNotDutyChargerList" resultType="com.zteits.park.domain.TpEEmployeeCharge">
SELECT
e.id id,
e.charger_code chargerCode,
e.charger_name chargerName,
e.pl_no plNo,
e.pl_name plName,
e.charger_sex chargerSex,
e.phone_no phoneNo,
e.addr addr,
e.status status,
e.sign_modify_time signModifyTime,
e.entry_status entryStatus,
e.entry_time entryTime
FROM
tp_e_employee_charge e
LEFT JOIN duty_roster_base b ON e.charger_code = b.charger_code
WHERE
b.charger_code IS NULL
AND e.data_status = 1
and e.charger_type = #{chargerType}
<if test="plNos != null and plNos.size()>0">
and e.pl_no in
<foreach collection="plNos" open="(" close=")" separator="," item="plNo">
#{plNo}
</foreach>
</if>
<if test="orgId != null">
and e.org_id =#{orgId}
</if>
</select>
<!-- 查询未排班和当前计划内的收费员/巡查员信息 -->
<select id="queryNotDutyAndThisPlanChargerList" resultType="com.zteits.park.domain.TpEEmployeeCharge">
SELECT
e.id id,
e.charger_code chargerCode,
e.charger_name chargerName,
e.pl_no plNo,
e.pl_name plName,
e.charger_sex chargerSex,
e.phone_no phoneNo,
e.addr addr,
e.status status,
e.sign_modify_time signModifyTime,
e.entry_status entryStatus,
e.entry_time entryTime
FROM
tp_e_employee_charge e
WHERE charger_code
IN (
SELECT DISTINCT charger_code
FROM
duty_roster_base
WHERE plan_id = #{planId}
<if test="orgId != null">
and e.org_id =#{orgId}
</if>
)
AND e.data_status = 1
and e.charger_type = #{chargerType}
<if test="orgId != null">
and e.org_id =#{orgId}
</if>
</select>
<!-- 查询当前组织下最大的收费员编号(后四位) -->
<select id="queryTheMaxChargerCodeNum" resultType="java.lang.Integer">
SELECT IFNULL(RIGHT(MAX(charger_code),4),0)+0
FROM `tp_e_employee_charge`
WHERE `charger_code` LIKE concat(#{areaCode,jdbcType=VARCHAR},'%')
</select>
<select id="queryOnlineEmployeeChargeList" resultMap="BaseResultMap" parameterType="com.zteits.clouds.api.dto.clouds.param.QueryEmployeeRequest">
SELECT c.* FROM tp_p_pda p
LEFT JOIN tp_e_employee_charge c ON p.charger_code = c.charger_code
WHERE p.online_flg = '0' AND p.data_state = 1 AND p.org_id = #{orgId} AND p.pda_type = #{chargerType}
AND c.data_status = 1 AND c.org_id = #{orgId} AND c.charger_type = #{chargerType} AND token != '' and c.status = 0
</select>
</mapper>