TEmployeeInfoMapper.xml 26.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
<?xml version="1.0" encoding="UTF-8"?>

<!--
  ~
  ~      Copyright (c) 2018-2025, lengleng All rights reserved.
  ~
  ~  Redistribution and use in source and binary forms, with or without
  ~  modification, are permitted provided that the following conditions are met:
  ~
  ~ Redistributions of source code must retain the above copyright notice,
  ~  this list of conditions and the following disclaimer.
  ~  Redistributions in binary form must reproduce the above copyright
  ~  notice, this list of conditions and the following disclaimer in the
  ~  documentation and/or other materials provided with the distribution.
  ~  Neither the name of the yifu4cloud.com developer nor the names of its
  ~  contributors may be used to endorse or promote products derived from
  ~  this software without specific prior written permission.
  ~  Author: lengleng (wangiegie@gmail.com)
  ~
  -->

<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

fangxinjiang's avatar
fangxinjiang committed
24
<mapper namespace="com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper">
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
	<resultMap id="tEmployeeInfoMap" type="com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo">
		<id property="id" column="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="validityStart" column="VALIDITY_START"/>
		<result property="validityEnd" column="VALIDITY_END"/>
		<result property="empSex" column="EMP_SEX"/>
		<result property="empBirthday" column="EMP_BIRTHDAY"/>
		<result property="empAge" column="EMP_AGE"/>
		<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="empPhone" column="EMP_PHONE"/>
		<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="fileProvince" column="FILE_PROVINCE"/>
		<result property="fileCity" column="FILE_CITY"/>
		<result property="fileTown" column="FILE_TOWN"/>
		<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="status" column="STATUS"/>
		<result property="fileStatus" column="FILE_STATUS"/>
		<result property="projectNum" column="PROJECT_NUM"/>
		<result property="contractStatus" column="CONTRACT_STATUS"/>
		<result property="insuranceStatus" column="INSURANCE_STATUS"/>
		<result property="socialStatus" column="SOCIAL_STATUS"/>
		<result property="fundStatus" column="FUND_STATUS"/>
		<result property="salaryStatus" column="SALARY_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="leaveUser" column="LEAVE_USER"/>
		<result property="leaveUserName" column="LEAVE_USER_NAME"/>
		<result property="leaveTime" column="LEAVE_TIME"/>
		<result property="leaveReason" column="LEAVE_REASON"/>
		<result property="leaveRemark" column="LEAVE_REMARK"/>
		<result property="contactAddress" column="CONTACT_ADDRESS"/>
	</resultMap>
78

79
	<resultMap id="tEmployeeExportMap" type="com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeExportVO">
hongguangwu's avatar
hongguangwu committed
80
		<id property="id" column="ID"/>
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
		<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="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="empPhone" column="EMP_PHONE"/>
		<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="fileProvince" column="FILE_PROVINCE"/>
		<result property="fileCity" column="FILE_CITY"/>
		<result property="fileTown" column="FILE_TOWN"/>
		<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="isProjects" column="IS_PROJECTS"/>
		<result property="projectNum" column="PROJECT_NUM"/>
		<result property="deptName" column="DEPT_NAME"/>
		<result property="deptNo" column="DEPT_NO"/>
		<result property="contractStatus" column="CONTRACT_STATUS"/>
		<result property="insuranceStatus" column="INSURANCE_STATUS"/>
		<result property="socialStatus" column="SOCIAL_STATUS"/>
		<result property="fundStatus" column="FUND_STATUS"/>
		<result property="salaryStatus" column="SALARY_STATUS"/>
		<result property="createName" column="CREATE_NAME"/>
		<result property="createTime" column="CREATE_TIME"/>
		<result property="contactAddress" column="CONTACT_ADDRESS"/>

		<result property="unitName" column="UNIT_NAME"/>
		<result property="unitNo" column="UNIT_NO"/>
		<result property="leaveUserName" column="LEAVE_USER_NAME"/>
		<result property="leaveTime" column="LEAVE_TIME"/>
		<result property="leaveReason" column="LEAVE_REASON"/>
		<result property="leaveRemark" column="LEAVE_REMARK"/>
hongguangwu's avatar
hongguangwu committed
126
		<result property="status" column="STATUS"/>
127
	</resultMap>
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
	<resultMap id="dispatchEmpVoMap" type="com.yifu.cloud.plus.v1.yifu.archives.vo.DispatchEmpVo">
		<id property="id" column="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="empNational" column="EMP_NATIONAL"/>
		<result property="empPhone" column="EMP_PHONE"/>
		<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="fileProvince" column="FILE_PROVINCE"/>
		<result property="fileCity" column="FILE_CITY"/>
		<result property="fileTown" column="FILE_TOWN"/>
		<result property="hignEducation" column="HIGN_EDUCATION"/>
		<result property="fileStatus" column="FILE_STATUS"/>
fangxinjiang's avatar
fangxinjiang committed
145 146
		<result property="projectStatus" column="PROJECT_STATUS"/>

147 148 149 150 151 152 153

		<result property="contractName" column="CONTRACT_NAME"/>
		<result property="contractType" column="CONTRACT_TYPE"/>
		<result property="contractStart" column="CONTRACT_START"/>
		<result property="contractEnd" column="CONTRACT_END"/>
		<result property="contractTerm" column="CONTRACT_TERM"/>
		<result property="contractSubName" column="CONTRACT_SUB_NAME"/>
154
		<result property="contractId" column="CONTRACT_ID"/>
155

156 157 158 159 160 161
		<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="post" column="POST"/>
fangxinjiang's avatar
fangxinjiang committed
162 163
		<result property="empNo" column="EMP_NO"/>

164
	</resultMap>
165
	<sql id="baseParam">
166 167 168 169
		a
		.
		ID
		,
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
		a.EMP_CODE,
		a.EMP_NATRUE,
		a.EMP_NAME,
		a.EMP_IDCARD,
		a.VALIDITY_START,
		a.VALIDITY_END,
		a.EMP_SEX,
		a.EMP_BIRTHDAY,
		a.EMP_AGE,
		a.EMP_MARRI_STATUS,
		a.EMP_NATIONAL,
		a.POLITICAL_STATUS,
		a.EMP_EMAIL,
		a.EMP_PHONE,
		a.ID_PROVINCE,
		a.ID_CITY,
		a.ID_TOWN,
		a.EMP_REGIS_TYPE,
		a.FILE_PROVINCE,
		a.FILE_CITY,
		a.FILE_TOWN,
		a.IS_COLLEGE,
		a.HIGN_EDUCATION,
		a.SCHOOL,
		a.MAJOR,
		a.ADMISSION_DATE,
		a.GRADUTION_DATE,
		a.REMARK,
		a.FILE_SOURCE,
		a.STATUS,
		a.FILE_STATUS,
		a.PROJECT_NUM,
		a.CONTRACT_STATUS,
		a.INSURANCE_STATUS,
		a.SOCIAL_STATUS,
		a.FUND_STATUS,
		a.SALARY_STATUS,
		a.DELETE_FLAG,
		a.CREATE_BY,
		a.CREATE_NAME,
		a.CREATE_TIME,
		a.UPDATE_BY,
		a.UPDATE_TIME,
		a.LEAVE_USER,
214
		a.LEAVE_USER_NAME,
215 216
		a.LEAVE_TIME,
		a.LEAVE_REASON,
hongguangwu's avatar
hongguangwu committed
217 218
		a.LEAVE_REMARK,
		a.CONTACT_ADDRESS
219 220
	</sql>

221
	<sql id="Base_Export_List">
222 223 224 225
		a
		.
		EMP_CODE
		,
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
		a.EMP_NATRUE,
		a.EMP_NAME,
		a.EMP_IDCARD,
		a.VALIDITY_START,
		a.VALIDITY_END,
		a.EMP_MARRI_STATUS,
		a.EMP_NATIONAL,
		a.POLITICAL_STATUS,
		a.EMP_PHONE,
		a.EMP_EMAIL,
		a.ID_PROVINCE,
		a.ID_CITY,
		a.ID_TOWN,
		a.EMP_REGIS_TYPE,
		a.FILE_PROVINCE,
		a.FILE_CITY,
		a.FILE_TOWN,
		a.IS_COLLEGE,
		a.HIGN_EDUCATION,
		a.SCHOOL,
		a.MAJOR,
		a.ADMISSION_DATE,
		a.GRADUTION_DATE,
		a.REMARK,
		a.FILE_SOURCE,
		if(count(b.id)>1,'是','否') IS_PROJECTS,
		a.PROJECT_NUM,
hongguangwu's avatar
hongguangwu committed
253 254
		GROUP_CONCAT(DISTINCT b.DEPT_NAME) DEPT_NAME,
		GROUP_CONCAT(DISTINCT b.DEPT_NO) DEPT_NO,
255 256 257 258 259 260 261
		a.CONTRACT_STATUS,
		a.INSURANCE_STATUS,
		a.SOCIAL_STATUS,
		a.FUND_STATUS,
		a.SALARY_STATUS,
		a.CREATE_NAME,
		a.CREATE_TIME,
hongguangwu's avatar
hongguangwu committed
262
		a.STATUS,
263 264 265
		a.CONTACT_ADDRESS
	</sql>

266 267 268 269
	<update id="updateEducationOfEmp">
		update t_employee_info
		<trim prefix="set" suffixOverrides=",">
			<if test="education.isCollege != null">is_college=#{education.isCollege},</if>
270
			<if test="education.highIdentification != null">hign_education=#{education.highIdentification},</if>
271 272
			<if test="education.school != null">school=#{education.school},</if>
			<if test="education.major != null">major=#{education.major},</if>
273
			<if test="education.entryDate != null">admission_date=#{education.entryDate},</if>
274 275 276 277
			<if test="education.gradutionDate != null">gradution_date=#{education.gradutionDate},</if>
		</trim>
		WHERE id=#{education.empId}
	</update>
278 279

	<sql id="employeeInfo_where">
hongguangwu's avatar
hongguangwu committed
280
		<if test="tEmployeeInfo != null">
281 282 283 284 285
			<if test="tEmployeeInfo.idList != null">
				AND a.id in
				<foreach item="idStr" index="index" collection="tEmployeeInfo.idList" open="(" separator="," close=")">
					#{idStr}
				</foreach>
hongguangwu's avatar
hongguangwu committed
286
			</if>
287 288 289
			<if test="tEmployeeInfo.idList == null">
				<if test="tEmployeeInfo.id != null and tEmployeeInfo.id.trim() != ''">
					AND a.ID = #{tEmployeeInfo.id}
hongguangwu's avatar
hongguangwu committed
290
				</if>
291 292 293 294
				<if test="tEmployeeInfo.empCode != null and tEmployeeInfo.empCode.trim() != ''">
					AND a.EMP_CODE = #{tEmployeeInfo.empCode}
				</if>
				<if test="tEmployeeInfo.empNatrue != null and tEmployeeInfo.empNatrue.trim() != ''">
295
					AND a.EMP_NATRUE = #{tEmployeeInfo.empNatrue}
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
				</if>
				<if test="tEmployeeInfo.empName != null and tEmployeeInfo.empName.trim() != ''">
					AND a.EMP_NAME = #{tEmployeeInfo.empName}
				</if>
				<if test="tEmployeeInfo.empIdcard != null and tEmployeeInfo.empIdcard.trim() != ''">
					AND a.EMP_IDCARD = #{tEmployeeInfo.empIdcard}
				</if>
				<if test="tEmployeeInfo.validityStart != null">
					AND a.VALIDITY_START = #{tEmployeeInfo.validityStart}
				</if>
				<if test="tEmployeeInfo.validityEnd != null">
					AND a.VALIDITY_END = #{tEmployeeInfo.validityEnd}
				</if>
				<if test="tEmployeeInfo.empSex != null and tEmployeeInfo.empSex.trim() != ''">
					AND a.EMP_SEX = #{tEmployeeInfo.empSex}
				</if>
				<if test="tEmployeeInfo.empBirthday != null">
					AND a.EMP_BIRTHDAY = #{tEmployeeInfo.empBirthday}
				</if>
				<if test="tEmployeeInfo.empAge != null">
					AND a.EMP_AGE = #{tEmployeeInfo.empAge}
				</if>
				<if test="tEmployeeInfo.empMarriStatus != null and tEmployeeInfo.empMarriStatus.trim() != ''">
					AND a.EMP_MARRI_STATUS = #{tEmployeeInfo.empMarriStatus}
				</if>
				<if test="tEmployeeInfo.empNational != null and tEmployeeInfo.empNational.trim() != ''">
					AND a.EMP_NATIONAL = #{tEmployeeInfo.empNational}
				</if>
				<if test="tEmployeeInfo.politicalStatus != null and tEmployeeInfo.politicalStatus.trim() != ''">
					AND a.POLITICAL_STATUS = #{tEmployeeInfo.politicalStatus}
				</if>
				<if test="tEmployeeInfo.empEmail != null and tEmployeeInfo.empEmail.trim() != ''">
					AND a.EMP_EMAIL = #{tEmployeeInfo.empEmail}
				</if>
				<if test="tEmployeeInfo.empPhone != null and tEmployeeInfo.empPhone.trim() != ''">
					AND a.EMP_PHONE = #{tEmployeeInfo.empPhone}
				</if>
				<if test="tEmployeeInfo.idProvince != null">
					AND a.ID_PROVINCE = #{tEmployeeInfo.idProvince}
				</if>
				<if test="tEmployeeInfo.idCity != null">
					AND a.ID_CITY = #{tEmployeeInfo.idCity}
				</if>
				<if test="tEmployeeInfo.idTown != null">
					AND a.ID_TOWN = #{tEmployeeInfo.idTown}
				</if>
				<if test="tEmployeeInfo.empRegisType != null and tEmployeeInfo.empRegisType.trim() != ''">
					AND a.EMP_REGIS_TYPE = #{tEmployeeInfo.empRegisType}
				</if>
				<if test="tEmployeeInfo.fileProvince != null">
					AND a.FILE_PROVINCE = #{tEmployeeInfo.fileProvince}
				</if>
				<if test="tEmployeeInfo.fileCity != null">
					AND a.FILE_CITY = #{tEmployeeInfo.fileCity}
				</if>
				<if test="tEmployeeInfo.fileTown != null">
					AND a.FILE_TOWN = #{tEmployeeInfo.fileTown}
				</if>
				<if test="tEmployeeInfo.isCollege != null">
					AND a.IS_COLLEGE = #{tEmployeeInfo.isCollege}
				</if>
				<if test="tEmployeeInfo.hignEducation != null and tEmployeeInfo.hignEducation.trim() != ''">
					AND a.HIGN_EDUCATION = #{tEmployeeInfo.hignEducation}
				</if>
				<if test="tEmployeeInfo.school != null and tEmployeeInfo.school.trim() != ''">
					AND a.SCHOOL = #{tEmployeeInfo.school}
				</if>
				<if test="tEmployeeInfo.major != null and tEmployeeInfo.major.trim() != ''">
					AND a.MAJOR = #{tEmployeeInfo.major}
				</if>
				<if test="tEmployeeInfo.admissionDate != null">
					AND a.ADMISSION_DATE = #{tEmployeeInfo.admissionDate}
				</if>
				<if test="tEmployeeInfo.gradutionDate != null">
					AND a.GRADUTION_DATE = #{tEmployeeInfo.gradutionDate}
				</if>
				<if test="tEmployeeInfo.remark != null and tEmployeeInfo.remark.trim() != ''">
					AND a.REMARK = #{tEmployeeInfo.remark}
				</if>
				<if test="tEmployeeInfo.fileSource != null and tEmployeeInfo.fileSource.trim() != ''">
					AND a.FILE_SOURCE = #{tEmployeeInfo.fileSource}
				</if>
				<if test="tEmployeeInfo.status != null">
					AND a.STATUS = #{tEmployeeInfo.status}
				</if>
				<if test="tEmployeeInfo.fileStatus != null">
					AND a.FILE_STATUS = #{tEmployeeInfo.fileStatus}
				</if>
				<if test="tEmployeeInfo.projectNum != null">
					<if test="tEmployeeInfo.projectNum == 1">
						AND (a.PROJECT_NUM is null or a.PROJECT_NUM <![CDATA[ <= ]]> 1)
					</if>
					<if test="tEmployeeInfo.projectNum == 2">
						AND a.PROJECT_NUM > 1
					</if>
				</if>
				<if test="tEmployeeInfo.contractStatus != null">
393
					AND a.CONTRACT_STATUS = #{tEmployeeInfo.contractStatus}
394 395
				</if>
				<if test="tEmployeeInfo.insuranceStatus != null">
396
					AND a.INSURANCE_STATUS = #{tEmployeeInfo.insuranceStatus}
397 398
				</if>
				<if test="tEmployeeInfo.socialStatus != null">
399
					AND a.SOCIAL_STATUS = #{tEmployeeInfo.socialStatus}
400 401
				</if>
				<if test="tEmployeeInfo.fundStatus != null">
402
					AND a.FUND_STATUS = #(${tEmployeeInfo.fundStatus}
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 430 431 432
				</if>
				<if test="tEmployeeInfo.salaryStatus != null">
					AND a.SALARY_STATUS = #{tEmployeeInfo.salaryStatus}
				</if>
				<if test="tEmployeeInfo.deleteFlag != null and tEmployeeInfo.deleteFlag.trim() != ''">
					AND a.DELETE_FLAG = #{tEmployeeInfo.deleteFlag}
				</if>
				<if test="tEmployeeInfo.createBy != null and tEmployeeInfo.createBy.trim() != ''">
					AND a.CREATE_BY = #{tEmployeeInfo.createBy}
				</if>
				<if test="tEmployeeInfo.createName != null and tEmployeeInfo.createName.trim() != ''">
					AND a.CREATE_NAME = #{tEmployeeInfo.createName}
				</if>
				<if test="tEmployeeInfo.createTime != null">
					AND a.CREATE_TIME = #{tEmployeeInfo.createTime}
				</if>
				<if test="tEmployeeInfo.updateBy != null and tEmployeeInfo.updateBy.trim() != ''">
					AND a.UPDATE_BY = #{tEmployeeInfo.updateBy}
				</if>
				<if test="tEmployeeInfo.updateTime != null">
					AND a.UPDATE_TIME = #{tEmployeeInfo.updateTime}
				</if>
				<if test="tEmployeeInfo.leaveUser != null and tEmployeeInfo.leaveUser.trim() != ''">
					AND a.LEAVE_USER = #{tEmployeeInfo.leaveUser}
				</if>
				<if test="tEmployeeInfo.leaveUserName != null and tEmployeeInfo.leaveUserName.trim() != ''">
					AND a.LEAVE_USER_NAME = #{tEmployeeInfo.leaveUserName}
				</if>
				<if test="tEmployeeInfo.leaveTime != null">
					AND a.LEAVE_TIME = #{tEmployeeInfo.leaveTime}
hongguangwu's avatar
hongguangwu committed
433 434 435 436 437 438
				</if>
				<if test="tEmployeeInfo.leaveTimeStart != null">
					AND a.LEAVE_TIME >= #{tEmployeeInfo.leaveTimeStart}
				</if>
				<if test="tEmployeeInfo.leaveTimeEnd != null">
					AND a.LEAVE_TIME <![CDATA[ <= ]]> #{tEmployeeInfo.leaveTimeEnd}
439 440 441 442 443 444 445 446 447 448
				</if>
				<if test="tEmployeeInfo.leaveReason != null and tEmployeeInfo.leaveReason.trim() != ''">
					AND a.LEAVE_REASON = #{tEmployeeInfo.leaveReason}
				</if>
				<if test="tEmployeeInfo.leaveRemark != null and tEmployeeInfo.leaveRemark.trim() != ''">
					AND a.LEAVE_REMARK = #{tEmployeeInfo.leaveRemark}
				</if>
				<if test="tEmployeeInfo.contactAddress != null and tEmployeeInfo.contactAddress.trim() != ''">
					AND a.CONTACT_ADDRESS = #{tEmployeeInfo.contactAddress}
				</if>
449 450 451

				<if test="tEmployeeInfo.empNatureArray != null">
					AND a.EMP_NATRUE in
452 453
					<foreach item="idStr" index="index" collection="tEmployeeInfo.empNatureArray" open="(" separator=","
							 close=")">
454 455 456 457 458
						#{idStr}
					</foreach>
				</if>
				<if test="tEmployeeInfo.contractStatusArray != null">
					AND a.CONTRACT_STATUS in
459 460
					<foreach item="idStr" index="index" collection="tEmployeeInfo.contractStatusArray" open="("
							 separator="," close=")">
461 462 463 464 465
						#{idStr}
					</foreach>
				</if>
				<if test="tEmployeeInfo.insuranceStatusArray != null">
					AND a.INSURANCE_STATUS in
466 467
					<foreach item="idStr" index="index" collection="tEmployeeInfo.insuranceStatusArray" open="("
							 separator="," close=")">
468 469 470 471 472
						#{idStr}
					</foreach>
				</if>
				<if test="tEmployeeInfo.socialStatusArray != null">
					AND a.SOCIAL_STATUS in
473 474
					<foreach item="idStr" index="index" collection="tEmployeeInfo.socialStatusArray" open="("
							 separator="," close=")">
475 476 477 478 479
						#{idStr}
					</foreach>
				</if>
				<if test="tEmployeeInfo.fundStatusArray != null">
					AND a.FUND_STATUS in
480 481
					<foreach item="idStr" index="index" collection="tEmployeeInfo.fundStatusArray" open="("
							 separator="," close=")">
482 483 484
						#{idStr}
					</foreach>
				</if>
485 486 487 488 489 490 491
			</if>
		</if>
	</sql>

	<!-- hgw 分页查询 -->
	<select id="getPage" resultMap="tEmployeeInfoMap">
		select
492
		<include refid="baseParam"/>
493
		from t_employee_info a
494
		where a.DELETE_FLAG = '0'
495
		<include refid="employeeInfo_where"/>
496
		${sql}
497
		order by a.CREATE_TIME desc
hongguangwu's avatar
hongguangwu committed
498
	</select>
hongguangwu's avatar
hongguangwu committed
499

hongguangwu's avatar
hongguangwu committed
500 501
	<!-- hgw 分页查询 -->
	<select id="getLeavePage" resultMap="tEmployeeExportMap">
502
		SELECT * from (
503 504 505 506 507 508 509 510 511 512 513 514 515 516 517
		SELECT
		a.ID,
		<include refid="Base_Export_List"/>
		,GROUP_CONCAT(DISTINCT b.unit_name) UNIT_NAME
		,GROUP_CONCAT(DISTINCT b.unit_no) UNIT_NO
		,a.LEAVE_TIME
		,a.LEAVE_USER_NAME
		,a.LEAVE_USER
		,a.LEAVE_REASON
		from t_employee_info a
		left join t_employee_project b on a.id = b.EMP_ID
		where a.DELETE_FLAG = '0' and b.DELETE_FLAG = '0'
		<include refid="employeeInfo_where"/>
		${sql}
		group by a.id order by a.CREATE_TIME desc
518 519 520 521 522 523 524 525 526
		) b
		where 1=1
		<if test="tEmployeeInfo.unitName != null and tEmployeeInfo.unitName.trim() != ''">
			AND b.UNIT_NAME like concat('%',#{tEmployeeInfo.unitName},'%')
		</if>
		<if test="tEmployeeInfo.deptName != null and tEmployeeInfo.deptName.trim() != ''">
			AND b.DEPT_NAME like concat('%',#{tEmployeeInfo.deptName},'%')
		</if>
		<if test="tEmployeeInfo.deptNo != null and tEmployeeInfo.deptNo.trim() != ''">
527
			AND b.DEPT_NO like concat('%',#{tEmployeeInfo.deptNo},'%')
528
		</if>
529 530
	</select>

hongguangwu's avatar
hongguangwu committed
531 532 533
	<!-- hgw list查询 -->
	<select id="getList" resultMap="tEmployeeInfoMap">
		select
534
		<include refid="baseParam"/>
hongguangwu's avatar
hongguangwu committed
535
		from t_employee_info a
536
		where a.DELETE_FLAG = '0'
537
		<include refid="employeeInfo_where"/>
538
		order by a.CREATE_TIME desc
hongguangwu's avatar
hongguangwu committed
539 540
	</select>

541 542 543
	<!-- hgw 根据身份证查询 -->
	<select id="getListByIdCard" resultMap="tEmployeeInfoMap">
		select
544
		<include refid="baseParam"/>
545 546
		from t_employee_info a
		where
547 548 549 550
		a.DELETE_FLAG = '0' and a.EMP_IDCARD in
		<foreach item="item" index="index" collection="idCardList" open="(" separator="," close=")">
			#{item}
		</foreach>
551 552 553 554 555
	</select>

	<!-- hgw 根据手机号查询 -->
	<select id="getListByPhone" resultMap="tEmployeeInfoMap">
		select
556
		<include refid="baseParam"/>
557 558
		from t_employee_info a
		where
559 560 561 562
		a.DELETE_FLAG = '0' and a.EMP_PHONE in
		<foreach item="item" index="index" collection="phoneList" open="(" separator="," close=")">
			#{item}
		</foreach>
563 564
	</select>

565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593
	<update id="updateExcelEmployeeInfo" parameterType="java.util.List">
		update t_employee_info
		<trim prefix="set" suffixOverrides=",">
			<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_NAME =case" suffix="end,">
				<foreach collection="list" item="i" index="index">
					<if test="i.empName!=null">
						when ID=#{i.id} then #{i.empName}
					</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="FILE_STATUS =case" suffix="end,">
				<foreach collection="list" item="i" index="index">
					when ID=#{i.id} then 0
				</foreach>
			</trim>
594 595 596 597 598
			<trim prefix="PROJECT_NUM =case" suffix="end,">
				<foreach collection="list" item="i" index="index">
					when ID=#{i.id} then #{i.projectNum}
				</foreach>
			</trim>
599 600 601 602 603 604 605 606 607 608 609 610 611 612
			<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>
		where
613
		<foreach collection="list" separator="or" item="i" index="index">
614 615 616 617
			ID=#{i.id}
		</foreach>
	</update>

618 619 620
	<!--tEmployeeInfo人员档案导出查询-->
	<select id="getTEmployeeExportList" resultMap="tEmployeeExportMap">
		select
621
		<include refid="Base_Export_List"/>
622 623 624
		from t_employee_info a
		left join t_employee_project b on a.id = b.EMP_ID
		<where>
625
			a.DELETE_FLAG = '0' and b.DELETE_FLAG = '0'
626 627
			<include refid="employeeInfo_where"/>
		</where>
628
		GROUP BY a.id order by a.CREATE_TIME desc
629 630 631 632
	</select>

	<!--tEmployeeInfo离职档案导出查询-->
	<select id="getTEmployeeLeaveExportList" resultMap="tEmployeeExportMap">
633
		select * from (
634
		SELECT
635 636 637 638 639 640 641
		<include refid="Base_Export_List"/>,GROUP_CONCAT(DISTINCT b.unit_name) UNIT_NAME
		,
		GROUP_CONCAT(DISTINCT b.unit_no) UNIT_NO
		,a.LEAVE_TIME
		,a.LEAVE_USER
		,a.LEAVE_USER_NAME
		,a.LEAVE_REASON
642 643 644
		from t_employee_info a
		left join t_employee_project b on a.id = b.EMP_ID
		<where>
645
			a.DELETE_FLAG = '0' and b.DELETE_FLAG = '0'
646 647
			<include refid="employeeInfo_where"/>
		</where>
648
		GROUP BY a.id order by a.CREATE_TIME desc
649 650 651 652 653 654 655 656 657
		) b
		where 1=1
		<if test="tEmployeeInfo.unitName != null and tEmployeeInfo.unitName.trim() != ''">
			AND b.UNIT_NAME like concat('%',#{tEmployeeInfo.unitName},'%')
		</if>
		<if test="tEmployeeInfo.deptName != null and tEmployeeInfo.deptName.trim() != ''">
			AND b.DEPT_NAME like concat('%',#{tEmployeeInfo.deptName},'%')
		</if>
		<if test="tEmployeeInfo.deptNo != null and tEmployeeInfo.deptNo.trim() != ''">
658
			AND b.DEPT_NO like concat('%',#{tEmployeeInfo.deptNo},'%')
659
		</if>
660 661
	</select>

hongguangwu's avatar
hongguangwu committed
662 663
	<!-- 获取当日最大的编码 -->
	<select id="getMaxEmpCode" resultType="java.lang.String">
664 665 666 667 668 669 670 671
		SELECT ifnull(max(right (e.EMP_CODE, 5)), 0) EMP_CODE
		FROM t_employee_info e
		where e.DELETE_FLAG = '0'
		  and e.CREATE_TIME > DATE_FORMAT(now(), '%Y-%m-%d')
	</select>

	<select id="getDispatchEmpVo" resultMap="dispatchEmpVoMap">
		select
fangxinjiang's avatar
fangxinjiang committed
672
		a.ID,a.EMP_CODE,a.EMP_NAME,
673 674 675 676
		a.EMP_IDCARD,a.EMP_NATIONAL,a.EMP_PHONE,a.ID_PROVINCE,a.ID_CITY,
		a.ID_TOWN,a.EMP_REGIS_TYPE,a.FILE_PROVINCE,a.FILE_CITY,a.FILE_TOWN,a.HIGN_EDUCATION,a.FILE_STATUS,

		b.CONTRACT_NAME,b.CONTRACT_TYPE,
fangxinjiang's avatar
fangxinjiang committed
677
		b.CONTRACT_START,b.CONTRACT_END,b.CONTRACT_TERM,b.CONTRACT_SUB_NAME,b.CONTRACT_ID,
678 679

		c.UNIT_NAME,
fangxinjiang's avatar
fangxinjiang committed
680
		c.UNIT_NO,c.DEPT_ID,c.DEPT_NAME,c.DEPT_NO,c.POST,c.EMP_NO,c.PROJECT_STATUS,c.EMP_NATRUE
681
		from (
fangxinjiang's avatar
fangxinjiang committed
682
		select e.ID,e.EMP_CODE,e.EMP_NAME,e.EMP_IDCARD,e.EMP_NATIONAL,e.EMP_PHONE,e.ID_PROVINCE,e.ID_CITY,
683 684
		e.ID_TOWN,e.EMP_REGIS_TYPE,e.FILE_PROVINCE,e.FILE_CITY,e.FILE_TOWN,e.HIGN_EDUCATION,e.FILE_STATUS
		from t_employee_info e
685
		where 1=1
686 687 688 689 690 691 692 693 694 695
		<if test="checkVo != null">
			<if test="checkVo.idCards != null">
				AND e.EMP_IDCARD in
				<foreach item="idStr" index="index" collection="checkVo.idCards" open="(" separator="," close=")">
					#{idStr}
				</foreach>
			</if>
		</if>
		) a
		left join (
fangxinjiang's avatar
fangxinjiang committed
696
		select p.UNIT_NAME,p.UNIT_NO,p.DEPT_ID,p.DEPT_NAME,p.DEPT_NO,p.POST,p.EMP_ID,p.EMP_NO,P.PROJECT_STATUS,p.EMP_NATRUE
697
		from t_employee_project p
698
		where 1=1
699 700 701 702 703 704 705 706 707 708 709
		<if test="checkVo != null">
			<if test="checkVo.codes != null">
				AND p.DEPT_NO in
				<foreach item="code" index="index" collection="checkVo.codes" open="(" separator="," close=")">
					#{code}
				</foreach>
			</if>
		</if>
		) c on a.ID=c.EMP_ID
		left join
		(
710
		<!-- 取值未删除,审核通过,使用中,未作废的合同数据,按项目分组,有数据即可不要求最新 -->
711 712 713 714 715 716 717
		SELECT
		x.SETTLE_DOMAIN,
		x.CONTRACT_NAME,
		x.CONTRACT_TYPE,
		x.CONTRACT_START,
		x.CONTRACT_END,
		x.CONTRACT_TERM,
718
		x.CONTRACT_SUB_NAME,
fangxinjiang's avatar
fangxinjiang committed
719 720
		x.ID as "CONTRACT_ID",
		x.EMP_IDCARD
721 722 723 724
		FROM
		t_employee_contract_info x
		WHERE
		x.DELETE_FLAG = '0'
fangxinjiang's avatar
fangxinjiang committed
725
		AND x.AUDIT_STATUS != '3'
726 727
		AND x.IS_OBSOLETE = '0'
		AND x.IN_USE = '0'
fangxinjiang's avatar
fangxinjiang committed
728 729 730 731 732 733 734 735
		<if test="checkVo != null">
			<if test="checkVo.idCards != null">
				AND x.EMP_IDCARD in
				<foreach item="idStr" index="index" collection="checkVo.idCards" open="(" separator="," close=")">
					#{idStr}
				</foreach>
			</if>
		</if>
736
		GROUP BY
fangxinjiang's avatar
fangxinjiang committed
737 738
		x.SETTLE_DOMAIN,x.EMP_IDCARD
		) b on c.DEPT_ID= b.SETTLE_DOMAIN and b.EMP_IDCARD=a.EMP_IDCARD
739

hongguangwu's avatar
hongguangwu committed
740 741
	</select>

742
</mapper>