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
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
<?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.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeRetirementMapper">
<resultMap id="BaseResultMap" type="com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeRetirement">
<id property="id" column="ID" jdbcType="VARCHAR"/>
<result property="empName" column="EMP_NAME" jdbcType="VARCHAR"/>
<result property="empIdcard" column="EMP_IDCARD" jdbcType="VARCHAR"/>
<result property="empPhone" column="EMP_PHONE" jdbcType="VARCHAR"/>
<result property="empSex" column="EMP_SEX" jdbcType="VARCHAR"/>
<result property="empAge" column="EMP_AGE" jdbcType="INTEGER"/>
<result property="empNatrue" column="EMP_NATRUE" jdbcType="VARCHAR"/>
<result property="fileProvince" column="FILE_PROVINCE" jdbcType="INTEGER"/>
<result property="fileCity" column="FILE_CITY" jdbcType="INTEGER"/>
<result property="fileTown" column="FILE_TOWN" jdbcType="INTEGER"/>
<result property="socialProvince" column="SOCIAL_PROVINCE" jdbcType="INTEGER"/>
<result property="socialCity" column="SOCIAL_CITY" jdbcType="INTEGER"/>
<result property="socialTown" column="SOCIAL_TOWN" jdbcType="INTEGER"/>
<result property="unitName" column="UNIT_NAME" jdbcType="VARCHAR"/>
<result property="unitNo" column="UNIT_NO" jdbcType="VARCHAR"/>
<result property="deptName" column="DEPT_NAME" jdbcType="VARCHAR"/>
<result property="deptNo" column="DEPT_NO" jdbcType="VARCHAR"/>
<result property="handleFlag" column="HANDLE_FLAG" jdbcType="INTEGER"/>
<result property="createBy" column="CREATE_BY" jdbcType="VARCHAR"/>
<result property="createName" column="CREATE_NAME" jdbcType="VARCHAR"/>
<result property="createTime" column="CREATE_TIME" jdbcType="TIMESTAMP"/>
<result property="updateBy" column="UPDATE_BY" jdbcType="VARCHAR"/>
<result property="updateTime" column="UPDATE_TIME" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
ID,EMP_NAME,EMP_IDCARD,
EMP_PHONE,EMP_SEX,EMP_AGE,
EMP_NATRUE,FILE_PROVINCE,FILE_CITY,
FILE_TOWN,SOCIAL_PROVINCE,SOCIAL_CITY,
SOCIAL_TOWN,UNIT_NAME,
UNIT_NO,DEPT_NAME,DEPT_NO,HANDLE_FLAG,
CREATE_BY,CREATE_NAME,CREATE_TIME,
UPDATE_BY,UPDATE_TIME
</sql>
<sql id="tEmployeeRetirement_pageWhere">
<if test="searchVo.empName != null and searchVo.empName.trim() != ''">
AND a.EMP_NAME like concat('%',#{searchVo.empName},'%')
</if>
<if test="searchVo.empIdcard != null and searchVo.empIdcard.trim() != ''">
AND a.EMP_IDCARD like concat('%',#{searchVo.empIdcard},'%')
</if>
<if test="searchVo.fileProvince != null">
AND a.FILE_PROVINCE = #{searchVo.fileProvince}
</if>
<if test="searchVo.fileCity != null">
AND a.FILE_CITY = #{searchVo.fileCity}
</if>
<if test="searchVo.fileTown != null">
AND a.FILE_TOWN = #{searchVo.fileTown}
</if>
<if test="searchVo.socialProvince != null">
AND a.SOCIAL_PROVINCE = #{searchVo.socialProvince}
</if>
<if test="searchVo.socialCity != null">
AND a.SOCIAL_CITY = #{searchVo.socialCity}
</if>
<if test="searchVo.socialTown != null">
AND a.SOCIAL_TOWN = #{searchVo.socialTown}
</if>
<if test="searchVo.unitName!= null">
AND a.UNIT_NAME = #{searchVo.unitName}
</if>
<if test="searchVo.unitNo!= null and searchVo.unitNo!=''" >
AND a.UNIT_NO = #{searchVo.unitNo}
</if>
<if test="searchVo.deptName!= null">
AND a.DEPT_NAME like concat('%',#{searchVo.deptName},'%')
</if>
<if test="searchVo.deptNo!= null and searchVo.deptNo!=''">
AND a.DEPT_NO =#{searchVo.deptNo}
</if>
<if test="searchVo.handleFlag!= null">
AND a.HANDLE_FLAG =#{searchVo.handleFlag}
</if>
<if test="searchVo.empTypeList != null and searchVo.empTypeList.length>0">
AND a.EMP_NATRUE IN
<foreach collection="searchVo.empTypeList" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="searchVo.idList != null and searchVo.idList.length > 0">
and a.ID in
<foreach collection="searchVo.idList" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</sql>
<sql id="tEmployeeRetirement_where">
<if test="searchVo.empName != null and searchVo.empName.trim() != ''">
AND a.EMP_NAME like concat('%',#{searchVo.empName},'%')
</if>
<if test="searchVo.empIdcard != null and searchVo.empIdcard.trim() != ''">
AND a.EMP_IDCARD like concat('%',#{searchVo.empIdcard},'%')
</if>
<if test="searchVo.fileProvince != null">
AND b.FILE_PROVINCE = #{searchVo.fileProvince}
</if>
<if test="searchVo.fileCity != null">
AND b.FILE_CITY = #{searchVo.fileCity}
</if>
<if test="searchVo.fileTown != null">
AND b.FILE_TOWN = #{searchVo.fileTown}
</if>
<if test="searchVo.socialProvince != null">
AND a.SOCIAL_PROVINCE = #{searchVo.socialProvince}
</if>
<if test="searchVo.socialCity != null">
AND a.SOCIAL_CITY = #{searchVo.socialCity}
</if>
<if test="searchVo.socialTown != null">
AND a.SOCIAL_TOWN = #{searchVo.socialTown}
</if>
<if test="searchVo.unitName!= null">
AND a.UNIT_NAME = #{searchVo.unitName}
</if>
<if test="searchVo.unitNo!= null">
AND a.UNIT_NO = #{searchVo.unitNo}
</if>
<if test="searchVo.deptName!= null">
AND a.DEPT_NAME like concat('%',#{searchVo.deptName},'%')
</if>
<if test="searchVo.deptNo!= null">
AND a.DEPT_NO =#{searchVo.deptNo}
</if>
<if test="searchVo.handleFlag!= null">
AND a.HANDLE_FLAG =#{searchVo.handleFlag}
</if>
<if test="searchVo.empTypeList != null and searchVo.empTypeList.length>0">
AND a.EMP_NATRUE IN
<foreach collection="searchVo.empTypeList" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</sql>
<select id="getTEmployeeRetirementPage" resultMap="BaseResultMap">
SELECT
a.ID,a.EMP_NAME,a.EMP_IDCARD,
a.EMP_PHONE,a.EMP_SEX,a.EMP_AGE,
a.EMP_NATRUE,a.FILE_PROVINCE,a.FILE_CITY,
a.FILE_TOWN,a.SOCIAL_PROVINCE,a.SOCIAL_CITY,
a.SOCIAL_TOWN,a.UNIT_NAME,
a.UNIT_NO,a.DEPT_NAME,a.DEPT_NO,a.HANDLE_FLAG,
a.CREATE_BY,a.CREATE_NAME,a.CREATE_TIME,
a.UPDATE_BY,a.UPDATE_TIME
FROM t_employee_retirement a
LEFT JOIN t_cutsomer_data_permisson b ON b.SETTLE_DOMAIN_NO = a.DEPT_NO
WHERE
b.USER_ID = #{userId}
<if test="searchVo.empName != null and searchVo.empName.trim() != ''">
AND a.EMP_NAME like concat('%',#{searchVo.empName},'%')
</if>
<if test="searchVo.empIdcard != null and searchVo.empIdcard.trim() != ''">
AND a.EMP_IDCARD like concat('%',#{searchVo.empIdcard},'%')
</if>
<if test="searchVo.fileProvince != null">
AND a.FILE_PROVINCE = #{searchVo.fileProvince}
</if>
<if test="searchVo.fileCity != null">
AND a.FILE_CITY = #{searchVo.fileCity}
</if>
<if test="searchVo.fileTown != null">
AND a.FILE_TOWN = #{searchVo.fileTown}
</if>
<if test="searchVo.socialProvince != null">
AND a.SOCIAL_PROVINCE = #{searchVo.socialProvince}
</if>
<if test="searchVo.socialCity != null">
AND a.SOCIAL_CITY = #{searchVo.socialCity}
</if>
<if test="searchVo.socialTown != null">
AND a.SOCIAL_TOWN = #{searchVo.socialTown}
</if>
<if test="searchVo.unitName!= null">
AND a.UNIT_NAME = #{searchVo.unitName}
</if>
<if test="searchVo.unitNo!= null and searchVo.unitNo!=''" >
AND a.UNIT_NO = #{searchVo.unitNo}
</if>
<if test="searchVo.deptName!= null">
AND a.DEPT_NAME like concat('%',#{searchVo.deptName},'%')
</if>
<if test="searchVo.deptNo!= null and searchVo.deptNo!=''">
AND a.DEPT_NO =#{searchVo.deptNo}
</if>
<if test="searchVo.handleFlag!= null">
AND a.HANDLE_FLAG =#{searchVo.handleFlag}
</if>
<if test="searchVo.empTypeList != null and searchVo.empTypeList.length>0">
AND a.EMP_NATRUE IN
<foreach collection="searchVo.empTypeList" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="searchVo.idList != null and searchVo.idList.length > 0">
and a.ID in
<foreach collection="searchVo.idList" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
ORDER BY
field(a.HANDLE_FLAG,0,1) asc,
CREATE_TIME asc
</select>
<select id="selectByEmpIdcard" resultType="Integer">
SELECT count(*)
FROM t_employee_retirement a
where EMP_IDCARD=#{empIdCard}
and DEPT_NO=#{deptNo}
</select>
<select id="getBirthday" parameterType="String" resultMap="BaseResultMap">
SELECT a.EMP_NAME,
a.EMP_IDCARD,
b.EMP_SEX,
(substring(now(),1,4)-substring(a.EMP_IDCARD,7,4))-(substring(a.EMP_IDCARD,11,4)-date_format(now(),'%m%d')>0) EMP_AGE,
b.EMP_PHONE,
CASE
WHEN MAX(a.EMP_NATRUE)=3 THEN "3"
WHEN MIN(a.EMP_NATRUE)=0 THEN "0"
WHEN MIN(a.EMP_NATRUE)=1 THEN "1"
ELSE a.EMP_NATRUE END as EMP_NATRUE,
a.UNIT_NAME,
a.UNIT_NO,
a.DEPT_NAME,
a.DEPT_NO,
b.FILE_PROVINCE,
b.FILE_CITY,
b.FILE_TOWN,
a.SOCIAL_PROVINCE,
a.SOCIAL_CITY,
a.SOCIAL_TOWN,
b.EMP_BIRTHDAY
FROM t_employee_project a
LEFT JOIN t_employee_info b ON a.EMP_IDCARD = b.EMP_IDCARD
where ((datediff(#{oo}, b.EMP_BIRTHDAY) = 0 and b.EMP_SEX = '1')
or (datediff(#{pp}, b.EMP_BIRTHDAY) = 0 and b.EMP_SEX = '2'))
and b.FILE_STATUS = 0 and a.EMP_NATRUE in ('0','1','3')
and a.PROJECT_STATUS = 0
and a.DELETE_FLAG=0
GROUP BY a.EMP_IDCARD,
a.DEPT_NO
</select>
<update id="changeHandleFlagAll" parameterType="com.yifu.cloud.plus.v1.yifu.archives.vo.ChangeHandleFlagAllVo">
update t_employee_retirement a
set a.HANDLE_FLAG=#{changeHandleFlagAllVo.handleFlag}
where a.ID in
<foreach item="idStr" index="index" collection="changeHandleFlagAllVo.ids" open="(" separator="," close=")">
#{idStr}
</foreach>
</update>
<update id="changeHandleFlag" parameterType="com.yifu.cloud.plus.v1.yifu.archives.vo.ChangeHandleFlagVo">
update t_employee_retirement a
set a.HANDLE_FLAG=#{changeHandleFlagVo.handleFlag}
where a.ID = #{changeHandleFlagVo.id}
</update>
<insert id="add">
insert into t_employee_retirement (EMP_NAME)
value (#{tEmployeeRetirement.empName})
</insert>
<select id="selectExportCount" resultType="java.lang.Long">
SELECT
count(1)
from t_employee_retirement a
<where>
<include refid="tEmployeeRetirement_pageWhere"/>
</where>
</select>
<select id="noPageDiy" resultType="com.yifu.cloud.plus.v1.yifu.archives.vo.TEmployeeRetirementExportVo">
SELECT a.ID,
EMP_NAME,
EMP_IDCARD,
EMP_PHONE,
CASE WHEN a.EMP_SEX=1 THEN "男"
WHEN a.EMP_SEX =2 THEN "女"
ELSE "" END as "EMP_SEX",
EMP_AGE,
CASE WHEN a.EMP_NATRUE='0' THEN "外包"
WHEN a.EMP_NATRUE='1' THEN "派遣"
WHEN a.EMP_NATRUE='2' THEN "代理"
WHEN a.EMP_NATRUE='3' THEN "内部员工"
ELSE "" END as "EMP_NATRUE",
FILE_PROVINCE,
CASE WHEN a.HANDLE_FLAG=0 THEN "未处理"
WHEN a.HANDLE_FLAG =1 THEN "已处理"
ELSE "" END as "HANDLE_FLAG",
FILE_CITY, FILE_TOWN, SOCIAL_PROVINCE, SOCIAL_CITY, SOCIAL_TOWN,
DEPT_NAME, UNIT_NAME, UNIT_NO, DEPT_NO
FROM t_employee_retirement a
LEFT JOIN t_cutsomer_data_permisson b ON b.SETTLE_DOMAIN_NO = a.DEPT_NO
WHERE
b.USER_ID = #{userId}
<if test="searchVo.empName != null and searchVo.empName.trim() != ''">
AND a.EMP_NAME like concat('%',#{searchVo.empName},'%')
</if>
<if test="searchVo.empIdcard != null and searchVo.empIdcard.trim() != ''">
AND a.EMP_IDCARD like concat('%',#{searchVo.empIdcard},'%')
</if>
<if test="searchVo.fileProvince != null">
AND a.FILE_PROVINCE = #{searchVo.fileProvince}
</if>
<if test="searchVo.fileCity != null">
AND a.FILE_CITY = #{searchVo.fileCity}
</if>
<if test="searchVo.fileTown != null">
AND a.FILE_TOWN = #{searchVo.fileTown}
</if>
<if test="searchVo.socialProvince != null">
AND a.SOCIAL_PROVINCE = #{searchVo.socialProvince}
</if>
<if test="searchVo.socialCity != null">
AND a.SOCIAL_CITY = #{searchVo.socialCity}
</if>
<if test="searchVo.socialTown != null">
AND a.SOCIAL_TOWN = #{searchVo.socialTown}
</if>
<if test="searchVo.unitName!= null">
AND a.UNIT_NAME = #{searchVo.unitName}
</if>
<if test="searchVo.unitNo!= null and searchVo.unitNo!=''" >
AND a.UNIT_NO = #{searchVo.unitNo}
</if>
<if test="searchVo.deptName!= null">
AND a.DEPT_NAME like concat('%',#{searchVo.deptName},'%')
</if>
<if test="searchVo.deptNo!= null and searchVo.deptNo!=''">
AND a.DEPT_NO =#{searchVo.deptNo}
</if>
<if test="searchVo.handleFlag!= null">
AND a.HANDLE_FLAG =#{searchVo.handleFlag}
</if>
<if test="searchVo.empTypeList != null and searchVo.empTypeList.length>0">
AND a.EMP_NATRUE IN
<foreach collection="searchVo.empTypeList" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="searchVo.idList != null and searchVo.idList.length > 0">
and a.ID in
<foreach collection="searchVo.idList" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
ORDER BY
field(a.HANDLE_FLAG,0,1) asc,
a.CREATE_TIME asc
</select>
<!--tEmployeeInfo导出查询count改造 fxj 2022-11-03-->
<select id="noPageCountDiy" resultType="java.lang.Integer">
SELECT
count(1)
from t_employee_retirement a
LEFT JOIN t_cutsomer_data_permisson b ON b.SETTLE_DOMAIN_NO = a.DEPT_NO
WHERE
b.USER_ID = #{userId}
<if test="searchVo.empName != null and searchVo.empName.trim() != ''">
AND a.EMP_NAME like concat('%',#{searchVo.empName},'%')
</if>
<if test="searchVo.empIdcard != null and searchVo.empIdcard.trim() != ''">
AND a.EMP_IDCARD like concat('%',#{searchVo.empIdcard},'%')
</if>
<if test="searchVo.fileProvince != null">
AND a.FILE_PROVINCE = #{searchVo.fileProvince}
</if>
<if test="searchVo.fileCity != null">
AND a.FILE_CITY = #{searchVo.fileCity}
</if>
<if test="searchVo.fileTown != null">
AND a.FILE_TOWN = #{searchVo.fileTown}
</if>
<if test="searchVo.socialProvince != null">
AND a.SOCIAL_PROVINCE = #{searchVo.socialProvince}
</if>
<if test="searchVo.socialCity != null">
AND a.SOCIAL_CITY = #{searchVo.socialCity}
</if>
<if test="searchVo.socialTown != null">
AND a.SOCIAL_TOWN = #{searchVo.socialTown}
</if>
<if test="searchVo.unitName!= null">
AND a.UNIT_NAME = #{searchVo.unitName}
</if>
<if test="searchVo.unitNo!= null and searchVo.unitNo!=''" >
AND a.UNIT_NO = #{searchVo.unitNo}
</if>
<if test="searchVo.deptName!= null">
AND a.DEPT_NAME like concat('%',#{searchVo.deptName},'%')
</if>
<if test="searchVo.deptNo!= null and searchVo.deptNo!=''">
AND a.DEPT_NO =#{searchVo.deptNo}
</if>
<if test="searchVo.handleFlag!= null">
AND a.HANDLE_FLAG =#{searchVo.handleFlag}
</if>
<if test="searchVo.empTypeList != null and searchVo.empTypeList.length>0">
AND a.EMP_NATRUE IN
<foreach collection="searchVo.empTypeList" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="searchVo.idList != null and searchVo.idList.length > 0">
and a.ID in
<foreach collection="searchVo.idList" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
ORDER BY
field(a.HANDLE_FLAG,0,1) asc,
a.CREATE_TIME asc
</select>
<select id="selectByIdd" resultType="String">
SELECT a.AREA_NAME
from mvp_salary.sys_area a
where id = #{id}
</select>
</mapper>