TEmployeeProjectMapper.xml 44.7 KB
Newer Older
1 2 3
<?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">

fangxinjiang's avatar
fangxinjiang committed
4
<mapper namespace="com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeProjectMapper">
5

fangxinjiang's avatar
fangxinjiang committed
6
  <resultMap id="tEmployeeProjectMap" type="com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject">
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
    <id property="id" column="ID"/>
    <result property="empId" column="EMP_ID"/>
    <result property="empCode" column="EMP_CODE"/>
    <result property="empNatrue" column="EMP_NATRUE"/>
    <result property="empName" column="EMP_NAME"/>
    <result property="empIdcard" column="EMP_IDCARD"/>
    <result property="bankName" column="BANK_NAME"/>
    <result property="bankSubName" column="BANK_SUB_NAME"/>
    <result property="bankNo" column="BANK_NO"/>
    <result property="leaveUser" column="LEAVE_USER"/>
    <result property="leaveTime" column="LEAVE_TIME"/>
    <result property="leaveReason" column="LEAVE_REASON"/>
    <result property="leaveRemark" column="LEAVE_REMARK"/>
    <result property="isLeaveEmployee" column="IS_LEAVE_EMPLOYEE"/>
    <result property="empNo" column="EMP_NO"/>
    <result property="unitId" column="UNIT_ID"/>
    <result property="unitName" column="UNIT_NAME"/>
    <result property="unitNo" column="UNIT_NO"/>
    <result property="deptId" column="DEPT_ID"/>
    <result property="deptName" column="DEPT_NAME"/>
    <result property="deptNo" column="DEPT_NO"/>
    <result property="businessPrimaryType" column="BUSINESS_PRIMARY_TYPE"/>
    <result property="businessSecondType" column="BUSINESS_SECOND_TYPE"/>
    <result property="businessThirdType" column="BUSINESS_THIRD_TYPE"/>
    <result property="contractType" column="CONTRACT_TYPE"/>
    <result property="workingHours" column="WORKING_HOURS"/>
    <result property="post" column="POST"/>
    <result property="enjoinDate" column="ENJOIN_DATE"/>
    <result property="tryPeriod" column="TRY_PERIOD"/>
    <result property="projectSource" column="PROJECT_SOURCE"/>
    <result property="taxMonth" column="TAX_MONTH"/>
    <result property="status" column="STATUS"/>
    <result property="projectStatus" column="PROJECT_STATUS"/>
    <result property="deleteFlag" column="DELETE_FLAG"/>
    <result property="createBy" column="CREATE_BY"/>
    <result property="createName" column="CREATE_NAME"/>
    <result property="createTime" column="CREATE_TIME"/>
    <result property="updateBy" column="UPDATE_BY"/>
    <result property="updateTime" column="UPDATE_TIME"/>
    <result property="remark" column="REMARK"/>
47 48 49
    <result property="fileProvince" column="FILE_PROVINCE"/>
    <result property="fileCity" column="FILE_CITY"/>
    <result property="fileTown" column="FILE_TOWN"/>
50 51 52
    <result property="socialProvince" column="SOCIAL_PROVINCE"/>
    <result property="socialCity" column="SOCIAL_CITY"/>
    <result property="socialTown" column="SOCIAL_TOWN"/>
53 54 55 56 57
    <result property="empPhone" column="EMP_PHONE"/>
    <result property="salaryStatus" column="SALARY_STATUS"/>
    <result property="insuranceStatus" column="INSURANCE_STATUS"/>
    <result property="socialStatus" column="SOCIAL_STATUS"/>
    <result property="fundStatus" column="FUND_STATUS"/>
58
    <result property="contractStatus" column="CONTRACT_STATUS"/>
59
	<result property="empLabel" column="EMP_LABEL"/>
60
  </resultMap>
61

62 63
	<resultMap id="tEmployeeProjectExportMap" type="com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectExportVO">
		<result property="empCode" column="EMP_CODE"/>
huyuchen's avatar
huyuchen committed
64
		<result property="projectStatus" column="PROJECT_STATUS"/>
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
		<result property="proEmpNatrue" column="PROEMP_NATRUE"/>
		<result property="empNatrue" column="EMP_NATRUE"/>
		<result property="empName" column="EMP_NAME"/>
		<result property="empIdcard" column="EMP_IDCARD"/>
		<result property="validityStart" column="VALIDITY_START"/>
		<result property="validityEnd" column="VALIDITY_END"/>
		<result property="empMarriStatus" column="EMP_MARRI_STATUS"/>
		<result property="empNational" column="EMP_NATIONAL"/>
		<result property="politicalStatus" column="POLITICAL_STATUS"/>
		<result property="empEmail" column="EMP_EMAIL"/>
		<result property="idProvince" column="ID_PROVINCE"/>
		<result property="idCity" column="ID_CITY"/>
		<result property="idTown" column="ID_TOWN"/>
		<result property="empRegisType" column="EMP_REGIS_TYPE"/>
		<result property="isCollege" column="IS_COLLEGE"/>
		<result property="hignEducation" column="HIGN_EDUCATION"/>
		<result property="school" column="SCHOOL"/>
		<result property="major" column="MAJOR"/>
		<result property="admissionDate" column="ADMISSION_DATE"/>
		<result property="gradutionDate" column="GRADUTION_DATE"/>
		<result property="remark" column="REMARK"/>
		<result property="fileSource" column="FILE_SOURCE"/>
		<result property="proStatus" column="PROSTATUS"/>
		<result property="bankName" column="BANK_NAME"/>
		<result property="bankSubName" column="BANK_SUB_NAME"/>
		<result property="bankNo" column="BANK_NO"/>
		<result property="empNo" column="EMP_NO"/>
		<result property="unitName" column="UNIT_NAME"/>
		<result property="unitNo" column="UNIT_NO"/>
		<result property="deptName" column="DEPT_NAME"/>
		<result property="deptNo" column="DEPT_NO"/>
96 97 98
		<result property="businessPrimaryType" column="BUSINESS_PRIMARY_TYPE"/>
		<result property="businessSecondType" column="BUSINESS_SECOND_TYPE"/>
		<result property="businessThirdType" column="BUSINESS_THIRD_TYPE"/>
99 100 101 102 103 104
		<result property="contractType" column="CONTRACT_TYPE"/>
		<result property="workingHours" column="WORKING_HOURS"/>
		<result property="post" column="POST"/>
		<result property="enjoinDate" column="ENJOIN_DATE"/>
		<result property="tryPeriod" column="TRY_PERIOD"/>
		<result property="projectSource" column="PROJECT_SOURCE"/>
105
		<result property="empNatrue" column="EMP_NATRUE"/>
106 107 108 109 110 111 112 113 114 115 116 117
		<result property="proCreateName" column="PROCREATE_NAME"/>
		<result property="proCreateTime" column="PROCREATE_TIME"/>
		<result property="fileProvince" column="FILE_PROVINCE"/>
		<result property="fileCity" column="FILE_CITY"/>
		<result property="fileTown" column="FILE_TOWN"/>
		<result property="empPhone" column="EMP_PHONE"/>
		<result property="salaryStatus" column="SALARY_STATUS"/>
		<result property="insuranceStatus" column="INSURANCE_STATUS"/>
		<result property="socialStatus" column="SOCIAL_STATUS"/>
		<result property="fundStatus" column="FUND_STATUS"/>
		<result property="createName" column="CREATE_NAME"/>
		<result property="createTime" column="CREATE_TIME"/>
118
		<result property="contractStatus" column="CONTRACT_STATUS"/>
119
		<result property="empLabel" column="EMP_LABEL"/>
wangzb's avatar
wangzb committed
120
		<result property="contractParty" column="CONTRACT_PARTY"/>
121 122 123
		<result property="contactProvince" column="CONTACT_PROVINCE"/>
		<result property="contactCity" column="CONTACT_CITY"/>
		<result property="contactTown" column="CONTACT_TOWN"/>
fangxinjiang's avatar
fangxinjiang committed
124
		<result property="contactAddress" column="contact_address"/>
125 126
	</resultMap>

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
	<sql id="Base_Column_List">
				  a.ID,
                  a.EMP_ID,
                  a.EMP_CODE,
                  a.EMP_NATRUE,
                  a.EMP_NAME,
                  a.EMP_IDCARD,
                  a.BANK_NAME,
                  a.BANK_SUB_NAME,
                  a.BANK_NO,
                  a.LEAVE_USER,
                  a.LEAVE_TIME,
                  a.LEAVE_REASON,
                  a.LEAVE_REMARK,
                  a.EMP_NO,
                  a.UNIT_ID,
                  a.UNIT_NAME,
                  a.UNIT_NO,
                  a.DEPT_ID,
                  a.DEPT_NAME,
                  a.DEPT_NO,
                  a.BUSINESS_PRIMARY_TYPE,
                  a.BUSINESS_SECOND_TYPE,
                  a.BUSINESS_THIRD_TYPE,
                  a.CONTRACT_TYPE,
                  a.WORKING_HOURS,
                  a.POST,
                  a.ENJOIN_DATE,
                  a.TRY_PERIOD,
                  a.PROJECT_SOURCE,
                  a.TAX_MONTH,
                  a.STATUS,
                  a.PROJECT_STATUS,
                  a.DELETE_FLAG,
                  a.CREATE_BY,
                  a.CREATE_NAME,
                  a.CREATE_TIME,
                  a.UPDATE_BY,
                  a.UPDATE_TIME,
                  a.REMARK,
167
                  a.CONTRACT_STATUS,
168
				  b.EMP_PHONE,
169 170 171
				  a.INSURANCE_STATUS,
				  a.SOCIAL_STATUS,
				  a.FUND_STATUS,
172 173 174
				  b.FILE_PROVINCE,
				  b.FILE_CITY,
				  b.FILE_TOWN,
175 176 177
				  a.SOCIAL_PROVINCE,
				  a.SOCIAL_CITY,
				  a.SOCIAL_TOWN,
178 179
				  a.SALARY_STATUS,
				  a.EMP_LABEL
180
	</sql>
181 182 183

	<sql id="Base_Export_List">
                  a.EMP_CODE,
184
                  a.EMP_NATRUE,
185 186 187 188 189 190 191 192 193 194
                  a.EMP_NAME,
                  a.EMP_IDCARD,
                  a.BANK_NAME,
                  a.BANK_SUB_NAME,
                  a.BANK_NO,
                  a.EMP_NO,
                  a.UNIT_NAME,
                  a.UNIT_NO,
                  a.DEPT_NAME,
                  a.DEPT_NO,
195 196 197
                  a.BUSINESS_PRIMARY_TYPE,
                  a.BUSINESS_SECOND_TYPE,
                  a.BUSINESS_THIRD_TYPE,
198 199 200 201 202 203
                  a.CONTRACT_TYPE,
                  a.WORKING_HOURS,
                  a.POST,
                  a.ENJOIN_DATE,
                  a.TRY_PERIOD,
                  a.PROJECT_SOURCE,
204
                  a.CONTRACT_STATUS,
hongguangwu's avatar
hongguangwu committed
205
                  if(b.STATUS=0,'草稿','已审核') AS PROSTATUS,
206 207
                  b.CREATE_NAME AS PROCREATE_NAME,
                  b.CREATE_TIME AS PROCREATE_TIME,
208
				  b.EMP_PHONE,
209 210 211
				  a.INSURANCE_STATUS,
				  a.SOCIAL_STATUS,
				  a.FUND_STATUS,
hongguangwu's avatar
hongguangwu committed
212 213 214 215 216 217
				  a4.AREA_NAME FILE_PROVINCE,
				  a5.AREA_NAME FILE_CITY,
				  a6.AREA_NAME FILE_TOWN,
				  a7.AREA_NAME SOCIAL_PROVINCE,
				  a8.AREA_NAME SOCIAL_CITY,
				  a9.AREA_NAME SOCIAL_TOWN,
218
				  a.SALARY_STATUS,
219
				  b.VALIDITY_START,
220
				  b.VALIDITY_END,
221 222 223
				  b.EMP_MARRI_STATUS,
				  b.EMP_NATIONAL,
				  b.POLITICAL_STATUS,
hongguangwu's avatar
hongguangwu committed
224 225 226
				  a1.AREA_NAME ID_PROVINCE,
				  a2.AREA_NAME ID_CITY,
				  a3.AREA_NAME ID_TOWN,
227
				  b.EMP_REGIS_TYPE,
huyuchen's avatar
huyuchen committed
228 229 230 231
				  CASE WHEN b.IS_COLLEGE=0 THEN "否"
				  WHEN b.IS_COLLEGE =1 THEN "是"
				  ELSE b.IS_COLLEGE
				  END as "IS_COLLEGE",
232 233 234 235 236 237
				  b.HIGN_EDUCATION,
				  b.SCHOOL,
				  b.MAJOR,
				  b.ADMISSION_DATE,
				  b.GRADUTION_DATE,
				  b.REMARK,
huyuchen's avatar
huyuchen committed
238
				  if(a.STATUS='0','草稿',IF(a.PROJECT_STATUS=1,'已减项','已审核')) PROJECT_STATUS,
239 240
				  a.CREATE_NAME,
				  a.CREATE_TIME,
241
				  b.EMP_EMAIL,
242
				  b.EMP_NATRUE AS PROEMP_NATRUE,
243 244 245
				  a.EMP_LABEL,
                  t.CONTRACT_PARTY

246 247
	</sql>

248 249 250 251 252 253 254 255 256 257 258 259
	<sql id="tEmployeeProject_where">
		<if test="tEmployeeProject != null">
			<if test="tEmployeeProject.id != null and tEmployeeProject.id.trim() != ''">
				AND a.ID = #{tEmployeeProject.id}
			</if>
			<if test="tEmployeeProject.empId != null and tEmployeeProject.empId.trim() != ''">
				AND a.EMP_ID = #{tEmployeeProject.empId}
			</if>
			<if test="tEmployeeProject.empCode != null and tEmployeeProject.empCode.trim() != ''">
				AND a.EMP_CODE = #{tEmployeeProject.empCode}
			</if>
			<if test="tEmployeeProject.empNatrue != null and tEmployeeProject.empNatrue.trim() != ''">
huyuchen's avatar
huyuchen committed
260
				AND a.EMP_NATRUE in (${tEmployeeProject.empNatrue})
261 262
			</if>
			<if test="tEmployeeProject.empName != null and tEmployeeProject.empName.trim() != ''">
263
				AND a.EMP_NAME like concat('%',#{tEmployeeProject.empName},'%')
264 265
			</if>
			<if test="tEmployeeProject.empIdcard != null and tEmployeeProject.empIdcard.trim() != ''">
266
				AND a.EMP_IDCARD like concat('%',#{tEmployeeProject.empIdcard},'%')
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
			</if>
			<if test="tEmployeeProject.bankName != null and tEmployeeProject.bankName.trim() != ''">
				AND a.BANK_NAME = #{tEmployeeProject.bankName}
			</if>
			<if test="tEmployeeProject.bankSubName != null and tEmployeeProject.bankSubName.trim() != ''">
				AND a.BANK_SUB_NAME = #{tEmployeeProject.bankSubName}
			</if>
			<if test="tEmployeeProject.bankNo != null and tEmployeeProject.bankNo.trim() != ''">
				AND a.BANK_NO = #{tEmployeeProject.bankNo}
			</if>
			<if test="tEmployeeProject.leaveUser != null and tEmployeeProject.leaveUser.trim() != ''">
				AND a.LEAVE_USER = #{tEmployeeProject.leaveUser}
			</if>
			<if test="tEmployeeProject.leaveTime != null">
				AND a.LEAVE_TIME = #{tEmployeeProject.leaveTime}
			</if>
			<if test="tEmployeeProject.leaveReason != null and tEmployeeProject.leaveReason.trim() != ''">
				AND a.LEAVE_REASON = #{tEmployeeProject.leaveReason}
			</if>
			<if test="tEmployeeProject.leaveRemark != null and tEmployeeProject.leaveRemark.trim() != ''">
				AND a.LEAVE_REMARK = #{tEmployeeProject.leaveRemark}
			</if>
			<if test="tEmployeeProject.empNo != null and tEmployeeProject.empNo.trim() != ''">
				AND a.EMP_NO = #{tEmployeeProject.empNo}
			</if>
			<if test="tEmployeeProject.unitId != null and tEmployeeProject.unitId.trim() != ''">
				AND a.UNIT_ID = #{tEmployeeProject.unitId}
			</if>
			<if test="tEmployeeProject.unitName != null and tEmployeeProject.unitName.trim() != ''">
296
				AND a.UNIT_NAME like concat('%',#{tEmployeeProject.unitName},'%')
297 298 299 300 301 302 303 304
			</if>
			<if test="tEmployeeProject.unitNo != null and tEmployeeProject.unitNo.trim() != ''">
				AND a.UNIT_NO = #{tEmployeeProject.unitNo}
			</if>
			<if test="tEmployeeProject.deptId != null and tEmployeeProject.deptId.trim() != ''">
				AND a.DEPT_ID = #{tEmployeeProject.deptId}
			</if>
			<if test="tEmployeeProject.deptName != null and tEmployeeProject.deptName.trim() != ''">
305
				AND a.DEPT_NAME like concat('%',#{tEmployeeProject.deptName},'%')
306 307 308 309 310 311 312 313 314 315 316
			</if>
			<if test="tEmployeeProject.deptNo != null and tEmployeeProject.deptNo.trim() != ''">
				AND a.DEPT_NO = #{tEmployeeProject.deptNo}
			</if>
			<if test="tEmployeeProject.businessPrimaryType != null and tEmployeeProject.businessPrimaryType.trim() != ''">
				AND a.BUSINESS_PRIMARY_TYPE = #{tEmployeeProject.businessPrimaryType}
			</if>
			<if test="tEmployeeProject.businessSecondType != null and tEmployeeProject.businessSecondType.trim() != ''">
				AND a.BUSINESS_SECOND_TYPE = #{tEmployeeProject.businessSecondType}
			</if>
			<if test="tEmployeeProject.businessThirdType != null and tEmployeeProject.businessThirdType.trim() != ''">
317
				AND a.BUSINESS_THIRD_TYPE like CONCAT('%',#{tEmployeeProject.businessThirdType},'%')
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
			</if>
			<if test="tEmployeeProject.contractType != null and tEmployeeProject.contractType.trim() != ''">
				AND a.CONTRACT_TYPE = #{tEmployeeProject.contractType}
			</if>
			<if test="tEmployeeProject.workingHours != null and tEmployeeProject.workingHours.trim() != ''">
				AND a.WORKING_HOURS = #{tEmployeeProject.workingHours}
			</if>
			<if test="tEmployeeProject.post != null and tEmployeeProject.post.trim() != ''">
				AND a.POST = #{tEmployeeProject.post}
			</if>
			<if test="tEmployeeProject.enjoinDate != null">
				AND a.ENJOIN_DATE = #{tEmployeeProject.enjoinDate}
			</if>
			<if test="tEmployeeProject.tryPeriod != null and tEmployeeProject.tryPeriod.trim() != ''">
				AND a.TRY_PERIOD = #{tEmployeeProject.tryPeriod}
			</if>
			<if test="tEmployeeProject.projectSource != null and tEmployeeProject.projectSource.trim() != ''">
				AND a.PROJECT_SOURCE = #{tEmployeeProject.projectSource}
			</if>
			<if test="tEmployeeProject.taxMonth != null and tEmployeeProject.taxMonth.trim() != ''">
				AND a.TAX_MONTH = #{tEmployeeProject.taxMonth}
			</if>
			<if test="tEmployeeProject.status != null">
				AND a.STATUS = #{tEmployeeProject.status}
			</if>
			<if test="tEmployeeProject.projectStatus != null">
				AND a.PROJECT_STATUS = #{tEmployeeProject.projectStatus}
			</if>
			<if test="tEmployeeProject.createBy != null and tEmployeeProject.createBy.trim() != ''">
				AND a.CREATE_BY = #{tEmployeeProject.createBy}
			</if>
			<if test="tEmployeeProject.createName != null and tEmployeeProject.createName.trim() != ''">
				AND a.CREATE_NAME = #{tEmployeeProject.createName}
			</if>
			<if test="tEmployeeProject.createTime != null">
				AND a.CREATE_TIME = #{tEmployeeProject.createTime}
			</if>
			<if test="tEmployeeProject.updateBy != null and tEmployeeProject.updateBy.trim() != ''">
				AND a.UPDATE_BY = #{tEmployeeProject.updateBy}
			</if>
			<if test="tEmployeeProject.updateTime != null">
				AND a.UPDATE_TIME = #{tEmployeeProject.updateTime}
			</if>
			<if test="tEmployeeProject.remark != null and tEmployeeProject.remark.trim() != ''">
				AND a.REMARK = #{tEmployeeProject.remark}
			</if>
364 365 366
			<if test="tEmployeeProject.contractStatus != null">
				AND a.CONTRACT_STATUS = #{tEmployeeProject.contractStatus}
			</if>
367 368 369 370
			<if test="tEmployeeProject.empPhone != null and tEmployeeProject.empPhone.trim() != ''">
				AND b.EMP_PHONE = #{tEmployeeProject.empPhone}
			</if>
			<if test="tEmployeeProject.insuranceStatus != null">
371
				AND a.INSURANCE_STATUS = #{tEmployeeProject.insuranceStatus}
372 373
			</if>
			<if test="tEmployeeProject.socialStatus != null">
374
			    AND a.SOCIAL_STATUS = #{tEmployeeProject.socialStatus}
375 376
		    </if>
			<if test="tEmployeeProject.fundStatus != null">
377
				AND a.FUND_STATUS = #{tEmployeeProject.fundStatus}
378 379
		    </if>
			<if test="tEmployeeProject.salaryStatus != null">
380
				AND a.SALARY_STATUS = #{tEmployeeProject.salaryStatus}
381 382 383 384 385 386 387 388 389 390
			</if>
			<if test="tEmployeeProject.fileProvince != null">
				AND b.FILE_PROVINCE = #{tEmployeeProject.fileProvince}
			</if>
			<if test="tEmployeeProject.fileCity != null">
				AND b.FILE_CITY = #{tEmployeeProject.fileCity}
			</if>
			<if test="tEmployeeProject.fileTown != null">
				AND b.FILE_TOWN = #{tEmployeeProject.fileTown}
			</if>
391 392 393
			<if test="tEmployeeProject.socialProvince != null">
				AND a.SOCIAL_PROVINCE = #{tEmployeeProject.socialProvince}
			</if>
huyuchen's avatar
huyuchen committed
394
			<if test="tEmployeeProject.socialCity != null">
395 396
				AND a.SOCIAL_CITY = #{tEmployeeProject.socialCity}
			</if>
huyuchen's avatar
huyuchen committed
397
			<if test="tEmployeeProject.socialTown != null">
398 399
				AND a.SOCIAL_TOWN = #{tEmployeeProject.socialTown}
			</if>
400
			<if test="tEmployeeProject.empNatureArray != null and tEmployeeProject.empNatureArray.length > 0">
huyuchen's avatar
huyuchen committed
401 402 403 404 405 406
				AND a.EMP_NATRUE in
				<foreach item="idStr" index="index" collection="tEmployeeProject.empNatureArray" open="(" separator=","
						 close=")">
					#{idStr}
				</foreach>
			</if>
407
			<if test="tEmployeeProject.contractStatusArray != null and tEmployeeProject.contractStatusArray.length > 0">
huyuchen's avatar
huyuchen committed
408 409 410 411 412 413
				AND a.CONTRACT_STATUS in
				<foreach item="idStr" index="index" collection="tEmployeeProject.contractStatusArray" open="("
						 separator="," close=")">
					#{idStr}
				</foreach>
			</if>
414
			<if test="tEmployeeProject.insuranceStatusArray != null and tEmployeeProject.insuranceStatusArray.length > 0">
huyuchen's avatar
huyuchen committed
415 416 417 418 419 420
				AND a.INSURANCE_STATUS in
				<foreach item="idStr" index="index" collection="tEmployeeProject.insuranceStatusArray" open="("
						 separator="," close=")">
					#{idStr}
				</foreach>
			</if>
421
			<if test="tEmployeeProject.socialStatusArray != null and tEmployeeProject.socialStatusArray.length > 0">
huyuchen's avatar
huyuchen committed
422 423 424 425 426 427
				AND a.SOCIAL_STATUS in
				<foreach item="idStr" index="index" collection="tEmployeeProject.socialStatusArray" open="("
						 separator="," close=")">
					#{idStr}
				</foreach>
			</if>
428
			<if test="tEmployeeProject.fundStatusArray != null and tEmployeeProject.fundStatusArray.length > 0">
huyuchen's avatar
huyuchen committed
429 430 431 432 433 434
				AND a.FUND_STATUS in
				<foreach item="idStr" index="index" collection="tEmployeeProject.fundStatusArray" open="("
						 separator="," close=")">
					#{idStr}
				</foreach>
			</if>
435 436 437
			<if test="tEmployeeProject.empLabel != null">
				AND a.EMP_LABEL = #{tEmployeeProject.empLabel}
			</if>
438 439 440 441 442 443 444

			<if test="tEmployeeProject.createTimeStart != null">
				AND a.CREATE_TIME <![CDATA[ >= ]]> #{tEmployeeProject.createTimeStart}
			</if>
			<if test="tEmployeeProject.createTimeEnd != null">
				AND a.CREATE_TIME <![CDATA[ <= ]]> #{tEmployeeProject.createTimeEnd}
			</if>
445 446 447
		</if>
	</sql>

448 449 450 451 452 453
	<sql id="exportTEmployeeProject_where">
		<if test="tEmployeeProject != null">
			<if test="tEmployeeProject.empCode != null and tEmployeeProject.empCode.trim() != ''">
				AND a.EMP_CODE = #{tEmployeeProject.empCode}
			</if>
			<if test="tEmployeeProject.empNatrue != null and tEmployeeProject.empNatrue.trim() != ''">
huyuchen's avatar
huyuchen committed
454
				AND a.EMP_NATRUE in (${tEmployeeProject.empNatrue})
455 456
			</if>
			<if test="tEmployeeProject.empName != null and tEmployeeProject.empName.trim() != ''">
457
				AND a.EMP_NAME like concat('%',#{tEmployeeProject.empName},'%')
458 459
			</if>
			<if test="tEmployeeProject.empIdcard != null and tEmployeeProject.empIdcard.trim() != ''">
460
				AND a.EMP_IDCARD like concat('%',#{tEmployeeProject.empIdcard},'%')
461
			</if>
huyuchen's avatar
huyuchen committed
462 463 464
			<if test="tEmployeeProject.projectStatusReplace != null and tEmployeeProject.projectStatusReplace.trim() != ''">
				AND a.PROJECT_STATUS = #{tEmployeeProject.projectStatusReplace}
			</if>
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527
			<if test="tEmployeeProject.bankName != null and tEmployeeProject.bankName.trim() != ''">
				AND a.BANK_NAME = #{tEmployeeProject.bankName}
			</if>
			<if test="tEmployeeProject.bankSubName != null and tEmployeeProject.bankSubName.trim() != ''">
				AND a.BANK_SUB_NAME = #{tEmployeeProject.bankSubName}
			</if>
			<if test="tEmployeeProject.bankNo != null and tEmployeeProject.bankNo.trim() != ''">
				AND a.BANK_NO = #{tEmployeeProject.bankNo}
			</if>
			<if test="tEmployeeProject.empNo != null and tEmployeeProject.empNo.trim() != ''">
				AND a.EMP_NO = #{tEmployeeProject.empNo}
			</if>
			<if test="tEmployeeProject.unitName != null and tEmployeeProject.unitName.trim() != ''">
				AND a.UNIT_NAME like concat('%',#{tEmployeeProject.unitName},'%')
			</if>
			<if test="tEmployeeProject.unitNo != null and tEmployeeProject.unitNo.trim() != ''">
				AND a.UNIT_NO = #{tEmployeeProject.unitNo}
			</if>
			<if test="tEmployeeProject.deptName != null and tEmployeeProject.deptName.trim() != ''">
				AND a.DEPT_NAME like concat('%',#{tEmployeeProject.deptName},'%')
			</if>
			<if test="tEmployeeProject.deptNo != null and tEmployeeProject.deptNo.trim() != ''">
				AND a.DEPT_NO = #{tEmployeeProject.deptNo}
			</if>
			<if test="tEmployeeProject.businessPrimaryType != null and tEmployeeProject.businessPrimaryType.trim() != ''">
				AND a.BUSINESS_PRIMARY_TYPE = #{tEmployeeProject.businessPrimaryType}
			</if>
			<if test="tEmployeeProject.businessSecondType != null and tEmployeeProject.businessSecondType.trim() != ''">
				AND a.BUSINESS_SECOND_TYPE = #{tEmployeeProject.businessSecondType}
			</if>
			<if test="tEmployeeProject.businessThirdType != null and tEmployeeProject.businessThirdType.trim() != ''">
				AND a.BUSINESS_THIRD_TYPE = #{tEmployeeProject.businessThirdType}
			</if>
			<if test="tEmployeeProject.contractType != null and tEmployeeProject.contractType.trim() != ''">
				AND a.CONTRACT_TYPE = #{tEmployeeProject.contractType}
			</if>
			<if test="tEmployeeProject.workingHours != null and tEmployeeProject.workingHours.trim() != ''">
				AND a.WORKING_HOURS = #{tEmployeeProject.workingHours}
			</if>
			<if test="tEmployeeProject.post != null and tEmployeeProject.post.trim() != ''">
				AND a.POST = #{tEmployeeProject.post}
			</if>
			<if test="tEmployeeProject.enjoinDate != null">
				AND a.ENJOIN_DATE = #{tEmployeeProject.enjoinDate}
			</if>
			<if test="tEmployeeProject.tryPeriod != null and tEmployeeProject.tryPeriod.trim() != ''">
				AND a.TRY_PERIOD = #{tEmployeeProject.tryPeriod}
			</if>
			<if test="tEmployeeProject.projectSource != null and tEmployeeProject.projectSource.trim() != ''">
				AND a.PROJECT_SOURCE = #{tEmployeeProject.projectSource}
			</if>
			<if test="tEmployeeProject.proStatus != null">
				AND a.STATUS = #{tEmployeeProject.proStatus}
			</if>
			<if test="tEmployeeProject.createName != null and tEmployeeProject.createName.trim() != ''">
				AND a.CREATE_NAME = #{tEmployeeProject.createName}
			</if>
			<if test="tEmployeeProject.createTime != null">
				AND a.CREATE_TIME = #{tEmployeeProject.createTime}
			</if>
			<if test="tEmployeeProject.remark != null and tEmployeeProject.remark.trim() != ''">
				AND a.REMARK = #{tEmployeeProject.remark}
			</if>
528 529 530
			<if test="tEmployeeProject.contractStatus != null">
				AND a.CONTRACT_STATUS = #{tEmployeeProject.contractStatus}
			</if>
531 532 533 534
			<if test="tEmployeeProject.empPhone != null and tEmployeeProject.empPhone.trim() != ''">
				AND b.EMP_PHONE = #{tEmployeeProject.empPhone}
			</if>
			<if test="tEmployeeProject.insuranceStatus != null">
535
				AND a.INSURANCE_STATUS = #{tEmployeeProject.insuranceStatus}
536 537
			</if>
			<if test="tEmployeeProject.socialStatus != null">
538
				AND a.SOCIAL_STATUS = #{tEmployeeProject.socialStatus}
539 540
			</if>
			<if test="tEmployeeProject.fundStatus != null">
541
				AND a.FUND_STATUS = #{tEmployeeProject.fundStatus}
542 543
			</if>
			<if test="tEmployeeProject.salaryStatus != null">
544
				AND a.SALARY_STATUS = #{tEmployeeProject.salaryStatus}
545 546 547 548 549 550 551 552 553 554
			</if>
			<if test="tEmployeeProject.fileProvince != null">
				AND b.FILE_PROVINCE = #{tEmployeeProject.fileProvince}
			</if>
			<if test="tEmployeeProject.fileCity != null">
				AND b.FILE_CITY = #{tEmployeeProject.fileCity}
			</if>
			<if test="tEmployeeProject.fileTown != null">
				AND b.FILE_TOWN = #{tEmployeeProject.fileTown}
			</if>
555 556 557
			<if test="tEmployeeProject.socialProvince != null">
				AND a.SOCIAL_PROVINCE = #{tEmployeeProject.socialProvince}
			</if>
huyuchen's avatar
huyuchen committed
558
			<if test="tEmployeeProject.socialCity != null">
559 560
				AND a.SOCIAL_CITY = #{tEmployeeProject.socialCity}
			</if>
huyuchen's avatar
huyuchen committed
561
			<if test="tEmployeeProject.socialTown != null">
562 563
				AND a.SOCIAL_TOWN = #{tEmployeeProject.socialTown}
			</if>
564
			<if test="tEmployeeProject.idList != null">
565
				AND a.id in
566
				<foreach item="idStr" index="index" collection="tEmployeeProject.idList" open="(" separator="," close=")">
567 568 569
					#{idStr}
				</foreach>
			</if>
570
			<if test="tEmployeeProject.empNatureArray != null and tEmployeeProject.empNatureArray.length > 0">
huyuchen's avatar
huyuchen committed
571 572 573 574 575 576
				AND a.EMP_NATRUE in
				<foreach item="idStr" index="index" collection="tEmployeeProject.empNatureArray" open="(" separator=","
						 close=")">
					#{idStr}
				</foreach>
			</if>
577
			<if test="tEmployeeProject.contractStatusArray != null and tEmployeeProject.contractStatusArray.length > 0">
huyuchen's avatar
huyuchen committed
578 579 580 581 582 583
				AND a.CONTRACT_STATUS in
				<foreach item="idStr" index="index" collection="tEmployeeProject.contractStatusArray" open="("
						 separator="," close=")">
					#{idStr}
				</foreach>
			</if>
584
			<if test="tEmployeeProject.insuranceStatusArray != null and tEmployeeProject.insuranceStatusArray.length > 0">
huyuchen's avatar
huyuchen committed
585 586 587 588 589 590
				AND a.INSURANCE_STATUS in
				<foreach item="idStr" index="index" collection="tEmployeeProject.insuranceStatusArray" open="("
						 separator="," close=")">
					#{idStr}
				</foreach>
			</if>
591
			<if test="tEmployeeProject.socialStatusArray != null and tEmployeeProject.socialStatusArray.length > 0">
huyuchen's avatar
huyuchen committed
592 593 594 595 596 597
				AND a.SOCIAL_STATUS in
				<foreach item="idStr" index="index" collection="tEmployeeProject.socialStatusArray" open="("
						 separator="," close=")">
					#{idStr}
				</foreach>
			</if>
598
			<if test="tEmployeeProject.fundStatusArray != null and tEmployeeProject.fundStatusArray.length > 0">
huyuchen's avatar
huyuchen committed
599 600 601 602 603 604
				AND a.FUND_STATUS in
				<foreach item="idStr" index="index" collection="tEmployeeProject.fundStatusArray" open="("
						 separator="," close=")">
					#{idStr}
				</foreach>
			</if>
605 606 607
			<if test="tEmployeeProject.empLabel != null">
				AND a.EMP_LABEL = #{tEmployeeProject.empLabel}
			</if>
608 609 610 611 612 613 614
			<if test="tEmployeeProject.createTimeStart != null">
				AND a.CREATE_TIME <![CDATA[ >= ]]> #{tEmployeeProject.createTimeStart}
			</if>
			<if test="tEmployeeProject.createTimeEnd != null">
				AND a.CREATE_TIME <![CDATA[ <= ]]> #{tEmployeeProject.createTimeEnd}
			</if>

615 616 617
		</if>
	</sql>

618 619 620
	<update id="updateExcelEmpProject" parameterType="java.util.List">
		update t_employee_project
		<trim prefix="set" suffixOverrides=",">
621 622 623 624 625 626 627
			<trim prefix="EMP_LABEL =case" suffix="end,">
				<foreach collection="list" item="i" index="index">
					<if test="i.empLabel!=null">
						when ID=#{i.id} then #{i.empLabel}
					</if>
				</foreach>
			</trim>
628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729
			<trim prefix="EMP_NATRUE =case" suffix="end,">
				<foreach collection="list" item="i" index="index">
					<if test="i.empNatrue!=null">
						when ID=#{i.id} then #{i.empNatrue}
					</if>
				</foreach>
			</trim>
			<trim prefix="EMP_IDCARD =case" suffix="end,">
				<foreach collection="list" item="i" index="index">
					<if test="i.empIdcard!=null">
						when ID=#{i.id} then #{i.empIdcard}
					</if>
				</foreach>
			</trim>
			<trim prefix="PROJECT_STATUS =case" suffix="end,">
				<foreach collection="list" item="i" index="index">
					when ID=#{i.id} then 0
				</foreach>
			</trim>
			<trim prefix="UPDATE_TIME =case" suffix="end,">
				<foreach collection="list" item="i" index="index">
					when ID=#{i.id} then now()
				</foreach>
			</trim>
			<trim prefix="UPDATE_BY =case" suffix="end,">
				<foreach collection="list" item="i" index="index">
					<if test="i.updateBy!=null">
						when ID=#{i.id} then #{i.updateBy}
					</if>
				</foreach>
			</trim>
			<trim prefix="DEPT_NO =case" suffix="end,">
				<foreach collection="list" item="i" index="index">
					<if test="i.deptNo!=null">
						when ID=#{i.id} then #{i.deptNo}
					</if>
				</foreach>
			</trim>
			<trim prefix="CONTRACT_TYPE =case" suffix="end,">
				<foreach collection="list" item="i" index="index">
					<if test="i.contractType!=null">
						when ID=#{i.id} then #{i.contractType}
					</if>
				</foreach>
			</trim>
			<trim prefix="WORKING_HOURS =case" suffix="end,">
				<foreach collection="list" item="i" index="index">
					<if test="i.workingHours!=null">
						when ID=#{i.id} then #{i.workingHours}
					</if>
				</foreach>
			</trim>
			<trim prefix="POST =case" suffix="end,">
				<foreach collection="list" item="i" index="index">
					<if test="i.post!=null">
						when ID=#{i.id} then #{i.post}
					</if>
				</foreach>
			</trim>
			<trim prefix="TRY_PERIOD =case" suffix="end,">
				<foreach collection="list" item="i" index="index">
					<if test="i.tryPeriod!=null">
						when ID=#{i.id} then #{i.tryPeriod}
					</if>
				</foreach>
			</trim>
			<trim prefix="ENJOIN_DATE =case" suffix="end,">
				<foreach collection="list" item="i" index="index">
					<if test="i.enjoinDate!=null">
						when ID=#{i.id} then #{i.enjoinDate}
					</if>
				</foreach>
			</trim>
			<trim prefix="BANK_NAME =case" suffix="end,">
				<foreach collection="list" item="i" index="index">
					<if test="i.bankName!=null">
						when ID=#{i.id} then #{i.bankName}
					</if>
				</foreach>
			</trim>
			<trim prefix="BANK_NO =case" suffix="end,">
				<foreach collection="list" item="i" index="index">
					<if test="i.bankNo!=null">
						when ID=#{i.id} then #{i.bankNo}
					</if>
				</foreach>
			</trim>
			<trim prefix="BANK_SUB_NAME =case" suffix="end,">
				<foreach collection="list" item="i" index="index">
					<if test="i.bankSubName!=null">
						when ID=#{i.id} then #{i.bankSubName}
					</if>
				</foreach>
			</trim>
		</trim>
		where
		<foreach collection="list" separator="or" item="i" index="index" >
			ID=#{i.id}
		</foreach>
	</update>
	<insert id="insertExcelEmpProject" parameterType="java.util.List">
		insert into t_employee_project
730 731
		(ID,EMP_ID,EMP_NATRUE,EMP_NAME,EMP_IDCARD,STATUS,PROJECT_STATUS,EMP_CODE,DEPT_NO,CONTRACT_TYPE,POST,
		DEPT_ID,DEPT_NAME,UNIT_ID,UNIT_NAME,UNIT_NO,EMP_NO,TRY_PERIOD,ENJOIN_DATE,BANK_NAME,BANK_NO,BANK_SUB_NAME,
huyuchen's avatar
huyuchen committed
732
		BUSINESS_PRIMARY_TYPE,BUSINESS_SECOND_TYPE,BUSINESS_THIRD_TYPE,WORKING_HOURS,PROJECT_SOURCE,DELETE_FLAG,
733
		CREATE_BY,CREATE_NAME,CREATE_TIME,INSURANCE_STATUS,SOCIAL_STATUS,FUND_STATUS,EMP_LABEL)
734 735 736 737 738 739 740 741 742 743 744 745 746 747
		VALUES
		<foreach collection="list" item="item" index="index" separator=",">
			(
			#{item.id,jdbcType=VARCHAR},
			#{item.empId,jdbcType=VARCHAR},
			#{item.empNatrue,jdbcType=VARCHAR},
			#{item.empName,jdbcType=VARCHAR},
			#{item.empIdcard,jdbcType=VARCHAR},
			#{item.status,jdbcType=VARCHAR},
			0,
			#{item.empCode,jdbcType=VARCHAR},
			#{item.deptNo,jdbcType=VARCHAR},
			#{item.contractType,jdbcType=VARCHAR},
			#{item.post,jdbcType=VARCHAR},
748 749 750 751 752
			#{item.deptId,jdbcType=VARCHAR},
			#{item.deptName,jdbcType=VARCHAR},
			#{item.unitId,jdbcType=VARCHAR},
			#{item.unitName,jdbcType=VARCHAR},
			#{item.unitNo,jdbcType=VARCHAR},
753 754 755 756 757 758
			#{item.empNo,jdbcType=VARCHAR},
			#{item.tryPeriod,jdbcType=VARCHAR},
			#{item.enjoinDate,jdbcType=DATE},
			#{item.bankName,jdbcType=VARCHAR},
			#{item.bankNo,jdbcType=VARCHAR},
			#{item.bankSubName,jdbcType=VARCHAR},
huyuchen's avatar
huyuchen committed
759 760 761
			#{item.businessPrimaryType,jdbcType=VARCHAR},
			#{item.businessSecondType,jdbcType=VARCHAR},
			#{item.businessThirdType,jdbcType=VARCHAR},
huyuchen's avatar
huyuchen committed
762
			#{item.workingHours,jdbcType=VARCHAR},
huyuchen's avatar
huyuchen committed
763
			#{item.projectSource,jdbcType=VARCHAR},
764 765 766
			#{item.deleteFlag,jdbcType=VARCHAR},
			#{item.createBy,jdbcType=VARCHAR},
			#{item.createName,jdbcType=VARCHAR},
767 768 769
			now(),
			0,
			0,
770 771
			0,
			#{item.empLabel,jdbcType=VARCHAR}
772 773 774
			)
		</foreach>
	</insert>
775 776 777
	<update id="updateReduceEmpProject" parameterType="java.util.List">
		update t_employee_project
		<trim prefix="set" suffixOverrides=",">
778 779 780 781 782
			<trim prefix="EMP_LABEL =case" suffix="end,">
				<foreach collection="list" item="i" index="index">
					when ID=#{i.id} then #{i.empLabel}
				</foreach>
			</trim>
783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812
			<trim prefix="LEAVE_TIME =case" suffix="end,">
				<foreach collection="list" item="i" index="index">
					when ID=#{i.id} then now()
				</foreach>
			</trim>
			<trim prefix="LEAVE_REASON =case" suffix="end,">
				<foreach collection="list" item="i" index="index">
					<if test="i.leaveReason!=null">
						when ID=#{i.id} then #{i.leaveReason}
					</if>
				</foreach>
			</trim>
			<trim prefix="LEAVE_REMARK =case" suffix="end,">
				<foreach collection="list" item="i" index="index">
					<if test="i.leaveRemark!=null">
						when ID=#{i.id} then #{i.leaveRemark}
					</if>
				</foreach>
			</trim>
			<trim prefix="PROJECT_STATUS =case" suffix="end,">
				<foreach collection="list" item="i" index="index">
					when ID=#{i.id} then 1
				</foreach>
			</trim>
		</trim>
		where
		<foreach collection="list" separator="or" item="i" index="index" >
			ID=#{i.id}
		</foreach>
	</update>
813
	<!--查询部门编码和最大员工数-->
814
	<select id="findEmployeeMaxOnlyNoByDepId" resultType="java.lang.String">
815 816
		select MAX(EMP_NO) from t_employee_project where
			id not like '%abc' and
817
			EMP_NO like concat(#{deptNo},'%')
818 819 820 821
	</select>

	<update id="updateEmpIdById" parameterType="java.util.List">
		update t_employee_project
822 823 824 825 826 827 828 829 830
		<trim prefix="set" suffixOverrides=",">
		<trim prefix="EMP_ID =case" suffix="end,">
			<foreach collection="list" item="i" index="index">
				<if test="i.id!=null">
					when EMP_IDCARD=#{i.empIdcard} then #{i.id}
				</if>
			</foreach>
		</trim>
		</trim>
831 832
		where
		<foreach collection="list" separator="or" item="i" index="index" >
833
			EMP_IDCARD=#{i.empIdcard}
834 835
		</foreach>
	</update>
836 837 838 839

	<!--tEmployeeInfo简单分页查询-->
	<select id="getTEmployeeProjectInfoPage" resultMap="tEmployeeProjectMap">
	SELECT
840
		<include refid="Base_Column_List"/>
841 842 843
		FROM t_employee_project a
		left join t_employee_info b on a.EMP_ID = b.id
		<where>
844
			a.DELETE_FLAG = '0'
hongguangwu's avatar
hongguangwu committed
845 846 847 848
			<include refid="tEmployeeProject_where"/>
			<if test="tEmployeeProject.authSql != null and tEmployeeProject.authSql.trim() != ''">
				${tEmployeeProject.authSql}
			</if>
849
		</where>
850
		order by a.CREATE_TIME desc
851
	</select>
fangxinjiang's avatar
fangxinjiang committed
852 853 854 855

	<!--tEmployeeInfo导出查询改造 fxj 2022-11-03-->
	<select id="noPageDiy" resultMap="tEmployeeProjectExportMap">
		SELECT
856 857 858 859 860
		<include refid="Base_Export_List"/>,
		a10.AREA_NAME as "CONTACT_PROVINCE",
		a11.AREA_NAME as "CONTACT_CITY",
		a12.AREA_NAME as "CONTACT_TOWN",
		b.contact_address
fangxinjiang's avatar
fangxinjiang committed
861 862
		FROM t_employee_project a
		left join t_employee_info b on a.EMP_ID = b.id
863 864
		LEFT JOIN (
		SELECT
wangzb's avatar
wangzb committed
865
		t1.EMP_ID ,t1.CONTRACT_PARTY,t1.IN_USE,t1.DEPT_NO
866 867
		FROM
		t_employee_contract_info t1
huyuchen's avatar
huyuchen committed
868 869
<!--		INNER JOIN ( SELECT EMP_ID, MAX( CREATE_TIME ) CREATE_TIME FROM t_employee_contract_info GROUP BY EMP_ID ) t2 ON t2.EMP_ID = t1.EMP_ID-->
<!--		AND t2.CREATE_TIME = t1.CREATE_TIME-->
wangzb's avatar
wangzb committed
870
		WHERE t1.IN_USE='0'
wangzb's avatar
wangzb committed
871
		) AS t ON t.EMP_ID = a.EMP_ID AND a.DEPT_NO =t.DEPT_NO
hongguangwu's avatar
hongguangwu committed
872 873 874 875 876 877 878 879 880
		LEFT JOIN sys_area a1 on a1.id=b.ID_PROVINCE
		LEFT JOIN sys_area a2 on a2.id=b.ID_CITY
		LEFT JOIN sys_area a3 on a3.id=b.ID_TOWN
		LEFT JOIN sys_area a4 on a4.id=b.FILE_PROVINCE
		LEFT JOIN sys_area a5 on a5.id=b.FILE_CITY
		LEFT JOIN sys_area a6 on a6.id=b.FILE_TOWN
		LEFT JOIN sys_area a7 on a7.id=a.SOCIAL_PROVINCE
		LEFT JOIN sys_area a8 on a8.id=a.SOCIAL_CITY
		LEFT JOIN sys_area a9 on a9.id=a.SOCIAL_TOWN
881 882 883
		LEFT JOIN sys_area a10 on a10.id=b.CONTACT_PROVINCE
		LEFT JOIN sys_area a11 on a11.id=b.CONTACT_CITY
		LEFT JOIN sys_area a12 on a12.id=b.CONTACT_TOWN
fangxinjiang's avatar
fangxinjiang committed
884 885 886 887 888 889
		<where>
			a.DELETE_FLAG = '0'
			<include refid="exportTEmployeeProject_where"/>
			<if test="tEmployeeProject.authSql != null and tEmployeeProject.authSql.trim() != ''">
				${tEmployeeProject.authSql}
			</if>
890

fangxinjiang's avatar
fangxinjiang committed
891
		</where>
892

fangxinjiang's avatar
fangxinjiang committed
893 894 895 896 897 898 899 900 901 902 903 904 905
		order by a.CREATE_TIME desc
		<if test="tEmployeeProject != null">
			<if test="tEmployeeProject.limitStart != null">
				limit #{tEmployeeProject.limitStart},#{tEmployeeProject.limitEnd}
			</if>
		</if>
	</select>
	<!--tEmployeeInfo导出查询count改造 fxj 2022-11-03-->
	<select id="noPageCountDiy" resultType="java.lang.Integer">
		SELECT
		count(1)
		FROM t_employee_project a
		left join t_employee_info b on a.EMP_ID = b.id
wangzb's avatar
wangzb committed
906 907
		LEFT JOIN (
		SELECT
wangzb's avatar
wangzb committed
908
		t1.EMP_ID ,t1.CONTRACT_PARTY,t1.IN_USE,t1.DEPT_NO
wangzb's avatar
wangzb committed
909 910 911 912 913 914
		FROM
		t_employee_contract_info t1
		INNER JOIN ( SELECT EMP_ID, MAX( CREATE_TIME ) CREATE_TIME FROM t_employee_contract_info GROUP BY EMP_ID ) t2 ON t2.EMP_ID = t1.EMP_ID
		AND t2.CREATE_TIME = t1.CREATE_TIME
		WHERE
		t1.IN_USE='0'
wangzb's avatar
wangzb committed
915
		) AS t ON t.EMP_ID = a.EMP_ID AND a.DEPT_NO=t.DEPT_NO
fangxinjiang's avatar
fangxinjiang committed
916 917 918 919 920 921
		<where>
			a.DELETE_FLAG = '0'
			<include refid="exportTEmployeeProject_where"/>
			<if test="tEmployeeProject.authSql != null and tEmployeeProject.authSql.trim() != ''">
				${tEmployeeProject.authSql}
			</if>
wangzb's avatar
wangzb committed
922

fangxinjiang's avatar
fangxinjiang committed
923 924
		</where>
	</select>
925 926 927

	<!-- 更新项目档案商险状态 -->
	<update id="updateEmployeeInsuranceStatus" >
928
		update t_employee_project a set a.INSURANCE_STATUS = #{emp.status} where a.EMP_IDCARD = #{emp.idCard} and a.DEPT_NO = #{emp.deptNo}
929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952
	</update>

	<!-- 更新项目档案薪资状态 -->
	<update id="updateEmployeeSalaryStatus" >
		update t_employee_project a set a.SALARY_STATUS = #{emp.status} where a.EMP_IDCARD = #{emp.idCard} and a.DEPT_NO = #{emp.deptNo}
	</update>

	<!-- 每月1号更新项目档案薪资状态 -->
	<update id="everyMonthUpdateEmployeeSalaryStatus" >
		update t_employee_project e set e.SALARY_STATUS = 2
		where e.SALARY_STATUS = 1
			and NOT EXISTS (
				select 1 from view_salary_account_3month a where a.emp_idcard = e.EMP_IDCARD and a.dept_id=e.DEPT_ID
			)
	</update>

	<!-- 每天更新人员档案、项目档案的过期合同为2不在用 -->
	<update id="everyDayUpdateEmployeContractStatus" >
		update t_employee_project e
		join t_employee_contract_info c on e.EMP_IDCARD=c.EMP_IDCARD and e.DEPT_NO=c.DEPT_NO and c.IN_USE='0'
		set e.CONTRACT_STATUS=2
		where e.CONTRACT_STATUS != 2 and c.CONTRACT_END <![CDATA[ < ]]> DATE_FORMAT(curdate(),"%Y-%m-%d")
	</update>

hongguangwu's avatar
hongguangwu committed
953 954 955 956 957
	<resultMap id="businessEmployeeExtendListVO" type="com.yifu.cloud.plus.v1.yifu.archives.vo.BusinessEmployeeExtendListVO">
	</resultMap>
	<select id="getTEmployeeBusinessPage" resultMap="businessEmployeeExtendListVO">
		SELECT
		a.ID,
hongguangwu's avatar
hongguangwu committed
958
		a.EMP_ID as empId,
hongguangwu's avatar
hongguangwu committed
959 960 961 962 963 964 965
		b.ID as extendId,
		a.EMP_NAME,
		a.EMP_IDCARD,
		if(b.BUSINESS_ENJOIN_DATE is not null, b.BUSINESS_ENJOIN_DATE, a.ENJOIN_DATE) as BUSINESS_ENJOIN_DATE,
		a.DEPT_ID SETTLE_DOMAIN,
		b.DEPART_NAME,
		b.DEPART_ID,
966
		if(b.BUSINESS_POST is not null, b.BUSINESS_POST, a.POST) as BUSINESS_POST,
hongguangwu's avatar
hongguangwu committed
967 968 969 970 971
		b.BUSINESS_TELECOM_NUMBER,
		b.EMPLOYEE_TAGS,
		if(b.BUSINESS_WORKING_STATUS is not null, b.BUSINESS_WORKING_STATUS, a.PROJECT_STATUS) as BUSINESS_WORKING_STATUS,
		a.PROJECT_STATUS WORK_FLAG,
		a.STATUS WORKING_STATUS_SUB,
972
		b.BUSINESS_LEAVE_DATE,
hongguangwu's avatar
hongguangwu committed
973 974 975 976 977
		b.DOCUMENT_TYPE,
		c.DEPART_NAME as SETTLE_DOMAIN_NAME
		FROM t_employee_project a
		left join t_business_employee_extend_info b on a.EMP_IDCARD = b.EMP_IDCARD
		left join t_settle_domain c on a.DEPT_ID = c.ID
hongguangwu's avatar
hongguangwu committed
978
		where a.DELETE_FLAG = '0' and c.DELETE_FLAG = '0' and a.PROJECT_STATUS = '0'
hongguangwu's avatar
hongguangwu committed
979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008
		<include refid="BusinessQuery"/>
		order by a.ENJOIN_DATE DESC
	</select>

	<sql id="BusinessQuery">
		<if test="query.empIdcard != null and query.empIdcard.trim() != ''">
			AND a.EMP_IDCARD like CONCAT('%', #{query.empIdcard},'%')
		</if>
		<if test="query.empName != null and query.empName.trim() != ''">
			AND a.EMP_NAME like CONCAT('%',#{query.empName},'%')
		</if>
		<if test="query.settleDomainId != null and query.settleDomainId.trim() != ''">
			AND a.DEPT_ID = #{query.settleDomainId}
		</if>
		<if test="query.businessPost != null and query.businessPost != ''">
			AND b.BUSINESS_POST like CONCAT('%',#{query.businessPost},'%')
		</if>
		<if test="query.departName != null and query.departName.trim() != ''">
			AND b.DEPART_NAME like CONCAT(#{query.departName},'%')
		</if>
		<if test="query.departId != null and query.departId != 1">
			AND (b.DEPART_ID = #{query.departId} or b.DEPART_CODE like concat('%-', #{query.departId},'-%'))
		</if>
		<if test="query.businessTelecomNumber != null and query.businessTelecomNumber.trim() != ''">
			AND b.BUSINESS_TELECOM_NUMBER like CONCAT('%',#{query.businessTelecomNumber} ,'%')
		</if>
		<!-- businessWorkingStatus: 0 在职  1 离职  -->
		<if test="query.businessWorkingStatus != null and query.businessWorkingStatus.trim() != ''">
			<!-- 0查询在职 -->
			<if test="query.businessWorkingStatus == '0'.toString()">
hongguangwu's avatar
hongguangwu committed
1009
				AND (b.BUSINESS_WORKING_STATUS is null or b.BUSINESS_WORKING_STATUS = '0')
hongguangwu's avatar
hongguangwu committed
1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061
			</if>
			<!-- 1查询离职 -->
			<if test="query.businessWorkingStatus == '1'.toString()">
				AND b.BUSINESS_WORKING_STATUS = '1'
			</if>
		</if>
		<if test="query.employeeTagName != null and query.employeeTagName.trim() != ''">
			AND b.EMPLOYEE_TAGS like CONCAT('%',#{query.employeeTagName},'%')
		</if>
		<!-- 是否持证 0否 1是 -->
		<if test="query.documentStatus != null and query.documentStatus.trim() != '' and query.documentStatus == '0'.toString()">
			AND if(b.DOCUMENT_TYPE = '', b.DOCUMENT_TYPE = '', b.DOCUMENT_TYPE is null)
		</if>
		<if test="query.documentStatus != null and query.documentStatus.trim() != '' and query.documentStatus == '1'.toString()">
			AND b.DOCUMENT_TYPE is NOT NULL AND b.DOCUMENT_TYPE <![CDATA[<>]]> ''
		</if>
		<if test="query.settleDomainIds != null  and query.settleDomainIds.size >0">
			and a.DEPT_ID in
			<foreach item="settleDomainId" index="index" collection="query.settleDomainIds" open="(" separator="," close=")">
				#{settleDomainId}
			</foreach>
		</if>
	</sql>

	<resultMap id="businessEmployeeExtentExcelVO" type="com.yifu.cloud.plus.v1.yifu.archives.vo.BusinessEmployeeExtentExcelVO">
	</resultMap>
	<select id="getTEmployeeBusinessList" resultMap="businessEmployeeExtentExcelVO">
		SELECT
			a.EMP_NAME,
			a.EMP_IDCARD,
			b.BUSINESS_TELECOM_NUMBER,
			b.DEPART_NAME,
			b.DEPART_ID,
			a.DEPT_ID SETTLE_DOMAIN,
			b.BUSINESS_POST,
			b.FIRST_DEGREE_AND_MAJOR,
			b.FIRST_DEGREE_GRADUATE_SCHOOL,
			b.HIGHEST_DEGREE_AND_MAJOR,
			b.HIGHEST_DEGREE_GRADUATE_SCHOOL,
			b.CONTACT_INFO,
			b.ARCHIVES_ADDR,
			if(b.BUSINESS_ENJOIN_DATE is not null, b.BUSINESS_ENJOIN_DATE, a.ENJOIN_DATE) as BUSINESS_ENJOIN_DATE,
			b.EMPLOYEE_TAGS,
			if(b.BUSINESS_WORKING_STATUS is not null, b.BUSINESS_WORKING_STATUS, a.PROJECT_STATUS) as BUSINESS_WORKING_STATUS,
			a.PROJECT_STATUS WORK_FLAG,
			a.STATUS WORKING_STATUS_SUB,
			if(b.BUSINESS_LEAVE_DATE is not null, b.BUSINESS_LEAVE_DATE, a.LEAVE_TIME) as BUSINESS_LEAVE_DATE,
			b.DOCUMENT_TYPE,
			c.DEPART_NAME as SETTLE_DOMAIN_NAME
		FROM t_employee_project a
		left join t_business_employee_extend_info b on a.EMP_IDCARD = b.EMP_IDCARD
		left join t_settle_domain c on a.DEPT_ID = c.ID
hongguangwu's avatar
hongguangwu committed
1062
		where a.DELETE_FLAG = '0' and c.DELETE_FLAG = '0' and a.PROJECT_STATUS = '0'
hongguangwu's avatar
hongguangwu committed
1063 1064 1065
		    <include refid="BusinessQuery"/>
		order by a.ENJOIN_DATE DESC
	</select>
1066 1067 1068 1069 1070 1071 1072 1073 1074
	<update id="updateSocialAndFundStatusById" >
		update t_employee_project a
		<trim prefix="set" suffixOverrides=",">
			<if test="project.id != null">a.id=a.id,</if>
			<if test="project.socialStatus != null">SOCIAL_STATUS=#{project.socialStatus},</if>
			<if test="project.fundStatus != null">FUND_STATUS=#{project.fundStatus},</if>
		</trim>
		WHERE a.id=#{project.id}
	</update>
fangxinjiang's avatar
fangxinjiang committed
1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088

	<update id="updateChangeById" >
		update t_employee_project a
		<trim prefix="set" suffixOverrides=",">
			<if test="project.socialStatus != null">SOCIAL_STATUS=#{project.socialStatus},</if>
			<if test="project.fundStatus != null">FUND_STATUS=#{project.fundStatus},</if>
			<if test="project.socialProvince == null">SOCIAL_PROVINCE= null,</if>
			<if test="project.socialCity == null">SOCIAL_CITY=null,</if>
			<if test="project.socialTown == null">SOCIAL_TOWN=null,</if>
			<if test="project.contractStatus != null">CONTRACT_STATUS=#{project.contractStatus},</if>
			<if test="project.contractType == null">CONTRACT_TYPE=null,</if>
		</trim>
		WHERE a.id=#{project.id}
	</update>
1089 1090 1091
	<update id="updateContractStatus" >
		update t_employee_project a
		set CONTRACT_STATUS = #{status}
1092
		WHERE a.EMP_ID=#{empId} and a.DEPT_ID=#{deptId}
1093
	</update>
1094 1095
	<update id="updatePostByEmpDeptNo" >
		update t_employee_project a
1096 1097 1098
		set
		    <if test="post != null and post !=''">
				a.POST = #{post}
1099 1100 1101
			<if test="tryPeriod != null and tryPeriod !=''">
				,
			</if>
1102 1103 1104 1105
			</if>
			<if test="tryPeriod != null and tryPeriod !=''">
				a.TRY_PERIOD = #{tryPeriod}
			</if>
1106
		WHERE a.DEPT_NO=#{deptNo}  and a.EMP_IDCARD=#{empIdcard} and a.DELETE_FLAG ='0'
1107
	</update>
huyuchen's avatar
huyuchen committed
1108 1109 1110

	<!-- 批量刷新项目档案的是否完整状态 -->
	<update id="batchUpdateEmpProjectCompleteStatus">
hongguangwu's avatar
hongguangwu committed
1111
		update t_employee_project a set a.IS_COMPLETE = #{isComplete} where a.id in
huyuchen's avatar
huyuchen committed
1112 1113 1114 1115
		<foreach item="item" index="index" collection="idList" open="(" separator="," close=")">
			#{item}
		</foreach>
	</update>
1116
</mapper>