TEmployeeInfoMapper.xml 39.7 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
		<result property="empCode" column="EMP_CODE"/>
		<result property="empNatrue" column="EMP_NATRUE"/>
		<result property="empName" column="EMP_NAME"/>
		<result property="empIdcard" column="EMP_IDCARD"/>
huyuchen's avatar
huyuchen committed
85
		<result property="empAge" column="EMP_AGE"/>
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
		<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
127
		<result property="status" column="STATUS"/>
128
	</resultMap>
fangxinjiang's avatar
fangxinjiang committed
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144

	<resultMap id="tEmployeeLeaveExportMap" type="com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeLeaveExportVO">
		<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="empPhone" column="EMP_PHONE"/>
		<result property="fileProvince" column="FILE_PROVINCE"/>
		<result property="fileCity" column="FILE_CITY"/>
		<result property="fileTown" column="FILE_TOWN"/>
		<result property="deptName" column="DEPT_NAME"/>
		<result property="deptNo" column="DEPT_NO"/>
		<result property="unitName" column="UNIT_NAME"/>
		<result property="leaveUserName" column="LEAVE_USER_NAME"/>
		<result property="leaveTime" column="LEAVE_TIME"/>
	</resultMap>
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
	<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
162 163
		<result property="projectStatus" column="PROJECT_STATUS"/>

164 165 166 167 168 169 170

		<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"/>
171
		<result property="contractId" column="CONTRACT_ID"/>
172

173 174 175 176 177 178
		<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
179 180
		<result property="empNo" column="EMP_NO"/>

181
	</resultMap>
182
	<sql id="baseParam">
183 184 185 186
		a
		.
		ID
		,
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
		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,
231
		a.LEAVE_USER_NAME,
232 233
		a.LEAVE_TIME,
		a.LEAVE_REASON,
hongguangwu's avatar
hongguangwu committed
234 235
		a.LEAVE_REMARK,
		a.CONTACT_ADDRESS
236 237
	</sql>

238
	<sql id="Base_Export_List">
239
		a.EMP_CODE,
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
		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,
		a.PROJECT_NUM,
		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
273
		a.STATUS,
274 275 276
		a.CONTACT_ADDRESS
	</sql>

277 278 279 280
	<update id="updateEducationOfEmp">
		update t_employee_info
		<trim prefix="set" suffixOverrides=",">
			<if test="education.isCollege != null">is_college=#{education.isCollege},</if>
281
			<if test="education.highIdentification != null">hign_education=#{education.highIdentification},</if>
282 283
			<if test="education.school != null">school=#{education.school},</if>
			<if test="education.major != null">major=#{education.major},</if>
284
			<if test="education.entryDate != null">admission_date=#{education.entryDate},</if>
285 286 287 288
			<if test="education.gradutionDate != null">gradution_date=#{education.gradutionDate},</if>
		</trim>
		WHERE id=#{education.empId}
	</update>
289 290

	<sql id="employeeInfo_where">
hongguangwu's avatar
hongguangwu committed
291
		<if test="tEmployeeInfo != null">
292 293 294 295 296
			<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
297
			</if>
298 299 300
			<if test="tEmployeeInfo.idList == null">
				<if test="tEmployeeInfo.id != null and tEmployeeInfo.id.trim() != ''">
					AND a.ID = #{tEmployeeInfo.id}
hongguangwu's avatar
hongguangwu committed
301
				</if>
302 303 304 305
				<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() != ''">
306
					AND a.EMP_NATRUE = #{tEmployeeInfo.empNatrue}
307 308
				</if>
				<if test="tEmployeeInfo.empName != null and tEmployeeInfo.empName.trim() != ''">
hongguangwu's avatar
hongguangwu committed
309
					AND a.EMP_NAME like concat('%',#{tEmployeeInfo.empName},'%')
310 311
				</if>
				<if test="tEmployeeInfo.empIdcard != null and tEmployeeInfo.empIdcard.trim() != ''">
312
					AND a.EMP_IDCARD like concat('%',#{tEmployeeInfo.empIdcard},'%')
313
				</if>
fangxinjiang's avatar
fangxinjiang committed
314 315
				<if test="tEmployeeInfo.nameOrIdcard != null and tEmployeeInfo.nameOrIdcard.trim() != ''">
					AND (
fangxinjiang's avatar
fangxinjiang committed
316
					a.EMP_NAME  like concat(#{tEmployeeInfo.nameOrIdcard},'%')
fangxinjiang's avatar
fangxinjiang committed
317
					or
fangxinjiang's avatar
fangxinjiang committed
318
					a.EMP_IDCARD  like concat(#{tEmployeeInfo.nameOrIdcard},'%')
fangxinjiang's avatar
fangxinjiang committed
319 320
					)
				</if>
321 322 323 324 325 326 327 328 329 330 331 332
				<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>
huyuchen's avatar
huyuchen committed
333 334 335 336 337
				<if test="tEmployeeInfo.empAgeStart >0">
					AND a.EMP_AGE >= #{tEmployeeInfo.empAgeStart}
				</if>
				<if test="tEmployeeInfo.empAgeEnd >0">
					AND a.EMP_AGE <![CDATA[ <= ]]> #{tEmployeeInfo.empAgeEnd}
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
				</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">
414
					AND a.CONTRACT_STATUS = #{tEmployeeInfo.contractStatus}
415 416
				</if>
				<if test="tEmployeeInfo.insuranceStatus != null">
417
					AND a.INSURANCE_STATUS = #{tEmployeeInfo.insuranceStatus}
418 419
				</if>
				<if test="tEmployeeInfo.socialStatus != null">
420
					AND a.SOCIAL_STATUS = #{tEmployeeInfo.socialStatus}
421 422
				</if>
				<if test="tEmployeeInfo.fundStatus != null">
423
					AND a.FUND_STATUS = #(${tEmployeeInfo.fundStatus}
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453
				</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
454 455 456 457 458 459
				</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}
460 461 462 463 464 465 466 467 468 469
				</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>
470

fangxinjiang's avatar
fangxinjiang committed
471
				<if test="tEmployeeInfo.empNatureArray != null and tEmployeeInfo.empNatureArray.length > 0">
472
					AND a.EMP_NATRUE in
473 474
					<foreach item="idStr" index="index" collection="tEmployeeInfo.empNatureArray" open="(" separator=","
							 close=")">
475 476 477
						#{idStr}
					</foreach>
				</if>
fangxinjiang's avatar
fangxinjiang committed
478
				<if test="tEmployeeInfo.contractStatusArray != null and tEmployeeInfo.contractStatusArray.length > 0">
479
					AND a.CONTRACT_STATUS in
480 481
					<foreach item="idStr" index="index" collection="tEmployeeInfo.contractStatusArray" open="("
							 separator="," close=")">
482 483 484
						#{idStr}
					</foreach>
				</if>
fangxinjiang's avatar
fangxinjiang committed
485
				<if test="tEmployeeInfo.insuranceStatusArray != null and tEmployeeInfo.insuranceStatusArray.length > 0">
486
					AND a.INSURANCE_STATUS in
487 488
					<foreach item="idStr" index="index" collection="tEmployeeInfo.insuranceStatusArray" open="("
							 separator="," close=")">
489 490 491
						#{idStr}
					</foreach>
				</if>
fangxinjiang's avatar
fangxinjiang committed
492
				<if test="tEmployeeInfo.socialStatusArray != null and tEmployeeInfo.socialStatusArray.length > 0">
493
					AND a.SOCIAL_STATUS in
494 495
					<foreach item="idStr" index="index" collection="tEmployeeInfo.socialStatusArray" open="("
							 separator="," close=")">
496 497 498
						#{idStr}
					</foreach>
				</if>
fangxinjiang's avatar
fangxinjiang committed
499
				<if test="tEmployeeInfo.fundStatusArray != null and tEmployeeInfo.fundStatusArray.length > 0">
500
					AND a.FUND_STATUS in
501 502
					<foreach item="idStr" index="index" collection="tEmployeeInfo.fundStatusArray" open="("
							 separator="," close=")">
503 504 505
						#{idStr}
					</foreach>
				</if>
506 507 508 509 510 511 512
			</if>
		</if>
	</sql>

	<!-- hgw 分页查询 -->
	<select id="getPage" resultMap="tEmployeeInfoMap">
		select
513
		<include refid="baseParam"/>
514
		from t_employee_info a
fangxinjiang's avatar
fangxinjiang committed
515
		<!--<if test="tEmployeeInfo.authSql != null and tEmployeeInfo.authSql.contains('b.DEPT_ID') ">
hongguangwu's avatar
hongguangwu committed
516
			left join t_employee_project b on a.id=b.EMP_ID and b.DELETE_FLAG = '0'
fangxinjiang's avatar
fangxinjiang committed
517
		</if>-->
518
		where a.DELETE_FLAG = '0'
519
		<include refid="employeeInfo_where"/>
fangxinjiang's avatar
fangxinjiang committed
520

hongguangwu's avatar
hongguangwu committed
521
		<if test="tEmployeeInfo.authSql != null and tEmployeeInfo.authSql.trim() != ''">
fangxinjiang's avatar
fangxinjiang committed
522
			and
fangxinjiang's avatar
fangxinjiang committed
523
			a.id in (
fangxinjiang's avatar
fangxinjiang committed
524 525 526
				select  b.emp_id from  t_employee_project  b
				where
			b.DELETE_FLAG = '0'
hongguangwu's avatar
hongguangwu committed
527
			${tEmployeeInfo.authSql}
fangxinjiang's avatar
fangxinjiang committed
528
			)
hongguangwu's avatar
hongguangwu committed
529
		</if>
530
		order by a.CREATE_TIME desc
hongguangwu's avatar
hongguangwu committed
531
	</select>
hongguangwu's avatar
hongguangwu committed
532

hongguangwu's avatar
hongguangwu committed
533 534
	<!-- hgw 分页查询 -->
	<select id="getLeavePage" resultMap="tEmployeeExportMap">
huyuchen's avatar
huyuchen committed
535
		SELECT
huyuchen's avatar
huyuchen committed
536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552
		c.ID,
		c.EMP_CODE,
		c.EMP_NATRUE,
		c.EMP_NAME,
		c.EMP_IDCARD,
		c.EMP_PHONE,
		c.FILE_PROVINCE,
		c.FILE_CITY,
		c.FILE_TOWN,
		c.LEAVE_TIME,
		c.LEAVE_USER_NAME,
		c.CREATE_TIME,
		b.DEPT_ID,
		b.EMP_ID,
		b.UNIT_NAME,
		b.DEPT_NAME,
		b.DEPT_NO
huyuchen's avatar
huyuchen committed
553 554
		FROM
		(
555 556
		SELECT
		a.ID,
huyuchen's avatar
huyuchen committed
557 558 559 560 561 562 563 564 565 566
		a.EMP_CODE,
		a.EMP_NATRUE,
		a.EMP_NAME,
		a.EMP_IDCARD,
		a.EMP_PHONE,
		a.FILE_PROVINCE,
		a.FILE_CITY,
		a.FILE_TOWN,
		a.LEAVE_TIME,
		a.LEAVE_USER_NAME,
huyuchen's avatar
huyuchen committed
567
		a.CREATE_TIME
huyuchen's avatar
huyuchen committed
568 569 570 571
		FROM
		t_employee_info a
		WHERE
		a.DELETE_FLAG = '0'
572
		<include refid="employeeInfo_where"/>
huyuchen's avatar
huyuchen committed
573 574 575 576 577 578 579 580
		<if test="null != page and null != size">
			limit #{page},#{size}
		</if>
		) c
		LEFT JOIN (
		SELECT
		f.DEPT_ID,
		f.EMP_ID,
huyuchen's avatar
huyuchen committed
581
		GROUP_CONCAT(DISTINCT f.UNIT_NAME) UNIT_NAME,
huyuchen's avatar
huyuchen committed
582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599
		GROUP_CONCAT(DISTINCT f.DEPT_NAME) DEPT_NAME,
		GROUP_CONCAT(DISTINCT f.DEPT_NO) DEPT_NO
		FROM
		t_employee_project f
		WHERE
		f.DELETE_FLAG = '0'
		GROUP BY f.EMP_ID
		) b ON c.id = b.EMP_ID
		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() != ''">
			AND b.DEPT_NO like concat('%',#{tEmployeeInfo.deptNo},'%')
		</if>
hongguangwu's avatar
hongguangwu committed
600 601 602
		<if test="tEmployeeInfo.authSql != null and tEmployeeInfo.authSql.trim() != ''">
			${tEmployeeInfo.authSql}
		</if>
huyuchen's avatar
huyuchen committed
603 604 605
		ORDER BY c.CREATE_TIME DESC
	</select>

huyuchen's avatar
huyuchen committed
606 607
	<!-- hgw 分页查询 -->
	<select id="getLeaveIPage" resultMap="tEmployeeExportMap">
huyuchen's avatar
huyuchen committed
608
		SELECT
huyuchen's avatar
huyuchen committed
609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644
		c.ID,
		c.EMP_CODE,
		c.EMP_NATRUE,
		c.EMP_NAME,
		c.EMP_IDCARD,
		c.EMP_PHONE,
		c.FILE_PROVINCE,
		c.FILE_CITY,
		c.FILE_TOWN,
		c.LEAVE_TIME,
		c.LEAVE_USER_NAME,
		c.CREATE_TIME,
		b.DEPT_ID,
		b.EMP_ID,
		b.UNIT_NAME,
		b.DEPT_NAME,
		b.DEPT_NO
		FROM
		(
		SELECT
		a.ID,
		a.EMP_CODE,
		a.EMP_NATRUE,
		a.EMP_NAME,
		a.EMP_IDCARD,
		a.EMP_PHONE,
		a.FILE_PROVINCE,
		a.FILE_CITY,
		a.FILE_TOWN,
		a.LEAVE_TIME,
		a.LEAVE_USER_NAME,
		a.CREATE_TIME
		FROM
		t_employee_info a
		WHERE
		a.DELETE_FLAG = '0'
huyuchen's avatar
huyuchen committed
645
		<include refid="employeeInfo_where"/>
huyuchen's avatar
huyuchen committed
646 647 648 649 650 651 652 653 654 655 656 657 658 659 660
		) c
		LEFT JOIN (
		SELECT
		f.DEPT_ID,
		f.EMP_ID,
		GROUP_CONCAT(DISTINCT f.UNIT_NAME) UNIT_NAME,
		GROUP_CONCAT(DISTINCT f.DEPT_NAME) DEPT_NAME,
		GROUP_CONCAT(DISTINCT f.DEPT_NO) DEPT_NO
		FROM
		t_employee_project f
		WHERE
		f.DELETE_FLAG = '0'
		GROUP BY f.EMP_ID
		) b ON c.id = b.EMP_ID
		where 1 = 1
661 662 663 664 665 666 667
		<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() != ''">
668
			AND b.DEPT_NO like concat('%',#{tEmployeeInfo.deptNo},'%')
669
		</if>
huyuchen's avatar
huyuchen committed
670 671 672
		<if test="tEmployeeInfo.authSql != null and tEmployeeInfo.authSql.trim() != ''">
			${tEmployeeInfo.authSql}
		</if>
huyuchen's avatar
huyuchen committed
673 674 675 676 677 678 679 680 681 682
		ORDER BY c.CREATE_TIME DESC
	</select>

	<select id="getLeavePageCount" resultType="java.lang.Long">
		SELECT
		count(1)
		FROM t_employee_info a
		where 1=1
		and a.DELETE_FLAG = '0'
		<include refid="employeeInfo_where"/>
683 684
	</select>

hongguangwu's avatar
hongguangwu committed
685 686 687
	<!-- hgw list查询 -->
	<select id="getList" resultMap="tEmployeeInfoMap">
		select
688
		<include refid="baseParam"/>
hongguangwu's avatar
hongguangwu committed
689
		from t_employee_info a
690
		where a.DELETE_FLAG = '0'
691
		<include refid="employeeInfo_where"/>
692
		order by a.CREATE_TIME desc
hongguangwu's avatar
hongguangwu committed
693 694
	</select>

695 696 697
	<!-- hgw 根据身份证查询 -->
	<select id="getListByIdCard" resultMap="tEmployeeInfoMap">
		select
698
		<include refid="baseParam"/>
699 700
		from t_employee_info a
		where
701 702 703 704
		a.DELETE_FLAG = '0' and a.EMP_IDCARD in
		<foreach item="item" index="index" collection="idCardList" open="(" separator="," close=")">
			#{item}
		</foreach>
705 706 707 708 709
	</select>

	<!-- hgw 根据手机号查询 -->
	<select id="getListByPhone" resultMap="tEmployeeInfoMap">
		select
710
		<include refid="baseParam"/>
711 712
		from t_employee_info a
		where
713 714 715 716
		a.DELETE_FLAG = '0' and a.EMP_PHONE in
		<foreach item="item" index="index" collection="phoneList" open="(" separator="," close=")">
			#{item}
		</foreach>
717 718
	</select>

719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747
	<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>
748 749 750 751 752
			<trim prefix="PROJECT_NUM =case" suffix="end,">
				<foreach collection="list" item="i" index="index">
					when ID=#{i.id} then #{i.projectNum}
				</foreach>
			</trim>
753 754 755 756 757 758 759 760 761 762 763 764 765 766
			<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
767
		<foreach collection="list" separator="or" item="i" index="index">
768 769 770 771
			ID=#{i.id}
		</foreach>
	</update>

772 773 774
	<!--tEmployeeInfo人员档案导出查询-->
	<select id="getTEmployeeExportList" resultMap="tEmployeeExportMap">
		select
fangxinjiang's avatar
fangxinjiang committed
775 776 777 778 779
		<include refid="Base_Export_List"/>,
		p.IS_PROJECTS ,
		p.DEPT_NAME,
		p.DEPT_NO,
		P.PROJECT_NUM
780
		from t_employee_info a
fangxinjiang's avatar
fangxinjiang committed
781
		LEFT JOIN view_project p on a.EMP_IDCARD=p.EMP_IDCARD
fangxinjiang's avatar
fangxinjiang committed
782 783 784 785 786 787 788 789 790
		<!--left join (
		select
			b.EMP_ID,
			GROUP_CONCAT(DISTINCT b.DEPT_NAME) DEPT_NAME,
			GROUP_CONCAT(DISTINCT b.DEPT_NO) DEPT_NO
		    from t_employee_project b where
		    1=1 and b.DELETE_FLAG = '0'
		<if test="tEmployeeInfo.authSql != null and tEmployeeInfo.authSql.trim() != ''">
			${tEmployeeInfo.authSql}
fangxinjiang's avatar
fangxinjiang committed
791 792
		</if>
		) b on a.id = b.EMP_ID-->
793
		<where>
hongguangwu's avatar
hongguangwu committed
794
			a.DELETE_FLAG = '0'
795
			<include refid="employeeInfo_where"/>
fangxinjiang's avatar
fangxinjiang committed
796

hongguangwu's avatar
hongguangwu committed
797
			<if test="tEmployeeInfo.authSql != null and tEmployeeInfo.authSql.trim() != ''">
fangxinjiang's avatar
fangxinjiang committed
798
				and
fangxinjiang's avatar
fangxinjiang committed
799
				a.id in (
fangxinjiang's avatar
fangxinjiang committed
800 801 802
				select  b.emp_id from  t_employee_project  b
				where
				b.DELETE_FLAG = '0'
hongguangwu's avatar
hongguangwu committed
803
				${tEmployeeInfo.authSql}
fangxinjiang's avatar
fangxinjiang committed
804
				)
hongguangwu's avatar
hongguangwu committed
805
			</if>
806
		</where>
fangxinjiang's avatar
fangxinjiang committed
807
		order by a.CREATE_TIME desc
808 809 810 811
	</select>

	<!--tEmployeeInfo离职档案导出查询-->
	<select id="getTEmployeeLeaveExportList" resultMap="tEmployeeExportMap">
812
		select * from (
813
		SELECT
fangxinjiang's avatar
fangxinjiang committed
814
		<include refid="Base_Export_List"/>
815 816 817
		,a.LEAVE_TIME
		,a.LEAVE_USER
		,a.LEAVE_USER_NAME
fangxinjiang's avatar
fangxinjiang committed
818 819 820 821
		,a.LEAVE_REASON,
		p.IS_PROJECTS ,
		p.DEPT_NAME,
		p.DEPT_NO,p.UNIT_NAME
822
		from t_employee_info a
fangxinjiang's avatar
fangxinjiang committed
823
		LEFT JOIN view_project_leave p on a.EMP_IDCARD=p.EMP_IDCARD
fangxinjiang's avatar
fangxinjiang committed
824 825 826 827 828 829 830 831 832 833 834 835 836
		<!--left join (
			select
			b.EMP_ID,
			GROUP_CONCAT(DISTINCT b.DEPT_NAME) DEPT_NAME,
			GROUP_CONCAT(DISTINCT b.DEPT_NO) DEPT_NO,
			GROUP_CONCAT(DISTINCT b.unit_name) UNIT_NAME,
			GROUP_CONCAT(DISTINCT b.unit_no) UNIT_NO
			from t_employee_project b where
			1=1 and b.DELETE_FLAG = '0'
			<if test="tEmployeeInfo.authSql != null and tEmployeeInfo.authSql.trim() != ''">
				${tEmployeeInfo.authSql}
			</if>
		) b on a.id = b.EMP_ID-->
837
		<where>
hongguangwu's avatar
hongguangwu committed
838
			a.DELETE_FLAG = '0'
839
			<include refid="employeeInfo_where"/>
hongguangwu's avatar
hongguangwu committed
840
			<if test="tEmployeeInfo.authSql != null and tEmployeeInfo.authSql.trim() != ''">
fangxinjiang's avatar
fangxinjiang committed
841
				and
fangxinjiang's avatar
fangxinjiang committed
842
				a.id in (
fangxinjiang's avatar
fangxinjiang committed
843 844 845
				select  b.emp_id from  t_employee_project  b
				where
				b.DELETE_FLAG = '0'
hongguangwu's avatar
hongguangwu committed
846
				${tEmployeeInfo.authSql}
fangxinjiang's avatar
fangxinjiang committed
847
				)
hongguangwu's avatar
hongguangwu committed
848
			</if>
849
		</where>
fangxinjiang's avatar
fangxinjiang committed
850
		order by a.CREATE_TIME desc
851 852 853 854 855 856 857 858 859
		) 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() != ''">
860
			AND b.DEPT_NO like concat('%',#{tEmployeeInfo.deptNo},'%')
861
		</if>
862 863
	</select>

hongguangwu's avatar
hongguangwu committed
864 865
	<!-- 获取当日最大的编码 -->
	<select id="getMaxEmpCode" resultType="java.lang.String">
866 867 868 869 870 871 872 873
		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
874
		a.ID,a.EMP_CODE,a.EMP_NAME,
875 876 877 878
		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
879
		b.CONTRACT_START,b.CONTRACT_END,b.CONTRACT_TERM,b.CONTRACT_SUB_NAME,b.CONTRACT_ID,
880 881

		c.UNIT_NAME,
fangxinjiang's avatar
fangxinjiang committed
882
		c.UNIT_NO,c.DEPT_ID,c.DEPT_NAME,c.DEPT_NO,c.POST,c.EMP_NO,c.PROJECT_STATUS,c.EMP_NATRUE
883
		from (
fangxinjiang's avatar
fangxinjiang committed
884
		select e.ID,e.EMP_CODE,e.EMP_NAME,e.EMP_IDCARD,e.EMP_NATIONAL,e.EMP_PHONE,e.ID_PROVINCE,e.ID_CITY,
885 886
		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
fangxinjiang's avatar
fangxinjiang committed
887
		where 1=1 and e.DELETE_FLAG = '0'
888 889 890 891 892 893 894 895 896 897
		<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
898
		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
899
		from t_employee_project p
fangxinjiang's avatar
fangxinjiang committed
900
		where 1=1 and p.DELETE_FLAG = '0'
901 902 903 904 905 906 907 908 909 910 911
		<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
		(
912
		<!-- 取值未删除,审核通过,使用中,未作废的合同数据,按项目分组,有数据即可不要求最新 -->
913 914 915 916 917 918 919
		SELECT
		x.SETTLE_DOMAIN,
		x.CONTRACT_NAME,
		x.CONTRACT_TYPE,
		x.CONTRACT_START,
		x.CONTRACT_END,
		x.CONTRACT_TERM,
920
		x.CONTRACT_SUB_NAME,
fangxinjiang's avatar
fangxinjiang committed
921 922
		x.ID as "CONTRACT_ID",
		x.EMP_IDCARD
923 924 925 926
		FROM
		t_employee_contract_info x
		WHERE
		x.DELETE_FLAG = '0'
927 928 929
		AND (
		(
		x.AUDIT_STATUS = '2'
930
		AND x.IN_USE = '0'
931 932 933 934 935 936
		)
		OR (
		x.AUDIT_STATUS = '1'
		AND x.IN_USE = '1'
		)
		)
fangxinjiang's avatar
fangxinjiang committed
937 938 939 940 941 942 943 944
		<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>
945
		GROUP BY
fangxinjiang's avatar
fangxinjiang committed
946 947
		x.SETTLE_DOMAIN,x.EMP_IDCARD
		) b on c.DEPT_ID= b.SETTLE_DOMAIN and b.EMP_IDCARD=a.EMP_IDCARD
948

hongguangwu's avatar
hongguangwu committed
949 950
	</select>

fangxinjiang's avatar
fangxinjiang committed
951 952 953 954

	<!--tEmployeeInfo人员档案导出查询改造 fxj 2022-11-02-->
	<select id="noPageDiy" resultMap="tEmployeeExportMap">
		select
955 956 957 958
		a.EMP_CODE,
		a.EMP_NATRUE,
		a.EMP_NAME,
		a.EMP_IDCARD,
huyuchen's avatar
huyuchen committed
959
		a.EMP_AGE,
960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 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
		a.VALIDITY_START,
		a.VALIDITY_END,
		a.EMP_MARRI_STATUS,
		a.EMP_NATIONAL,
		a.POLITICAL_STATUS,
		a.EMP_PHONE,
		a.EMP_EMAIL,
		a1.AREA_NAME as "ID_PROVINCE",
		a2.AREA_NAME as "ID_CITY",
		a3.AREA_NAME as "ID_TOWN",
		a.EMP_REGIS_TYPE,
		a4.AREA_NAME as "FILE_PROVINCE",
		a5.AREA_NAME as "FILE_CITY",
		a6.AREA_NAME as "FILE_TOWN",
		CASE WHEN a.IS_COLLEGE=0 THEN "否"
		WHEN a.IS_COLLEGE =1 THEN "是"
		ELSE a.IS_COLLEGE END as "IS_COLLEGE",
		a.HIGN_EDUCATION,
		a.SCHOOL,
		a.MAJOR,
		a.ADMISSION_DATE,
		a.GRADUTION_DATE,
		a.REMARK,
		CASE WHEN a.FILE_SOURCE=1 THEN "社保、公积金派单"
		WHEN a.FILE_SOURCE =2 THEN "人员发薪"
		WHEN a.FILE_SOURCE =3 THEN "商险派单"
		WHEN a.FILE_SOURCE =4 THEN "档案新建"
		WHEN a.FILE_SOURCE =5 THEN "批量导入"
		ELSE a.FILE_SOURCE END as "FILE_SOURCE",  #  1=社保、公积金派单,2=人员发薪,3=商险派单,4=档案新建,5=批量导入
		a.PROJECT_NUM,
		a.CONTRACT_STATUS,
		a.INSURANCE_STATUS,
		a.SOCIAL_STATUS,
		a.FUND_STATUS,
		CASE WHEN a.SALARY_STATUS=0 THEN "无"
		WHEN a.SALARY_STATUS =1 THEN "是"
		WHEN a.SALARY_STATUS =2 THEN "否"
		ELSE a.SALARY_STATUS END as "SALARY_STATUS",#  0=无,1=是,2=否
		a.CREATE_NAME,
		a.CREATE_TIME,
		CASE WHEN a.`STATUS`=0 THEN "草稿"
		WHEN a.`STATUS` =1 THEN "已审核"
		ELSE a.`STATUS` END as  "STATUS",  # 0=草稿,1=已审核
		a.CONTACT_ADDRESS,
fangxinjiang's avatar
fangxinjiang committed
1004 1005 1006 1007 1008
		p.IS_PROJECTS ,
		p.DEPT_NAME,
		p.DEPT_NO,
		P.PROJECT_NUM
		from t_employee_info a
1009 1010 1011 1012 1013 1014
		LEFT JOIN sys_area a1 on a1.id=a.ID_PROVINCE
		LEFT JOIN sys_area a2 on a2.id=a.ID_CITY
		LEFT JOIN sys_area a3 on a3.id=a.ID_TOWN
		LEFT JOIN sys_area a4 on a4.id=a.FILE_PROVINCE
		LEFT JOIN sys_area a5 on a5.id=a.FILE_CITY
		LEFT JOIN sys_area a6 on a6.id=a.FILE_TOWN
fangxinjiang's avatar
fangxinjiang committed
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
		LEFT JOIN view_project p on a.EMP_IDCARD=p.EMP_IDCARD
		<where>
			a.DELETE_FLAG = '0'
			<include refid="employeeInfo_where_export"/>
		</where>
		order by a.CREATE_TIME desc
		<if test="tEmployeeInfo != null">
			<if test="tEmployeeInfo.limitStart != null">
				limit #{tEmployeeInfo.limitStart},#{tEmployeeInfo.limitEnd}
			</if>
		</if>
	</select>

	<!--tEmployeeInfo人员档案导出查询count fxj 2022-11-02-->
	<select id="noPageCountDiy" resultType="java.lang.Integer">
		select
		count(1)
		from t_employee_info a
		LEFT JOIN view_project p on a.EMP_IDCARD=p.EMP_IDCARD
		<where>
			a.DELETE_FLAG = '0'
			<include refid="employeeInfo_where_export"/>
		</where>
	</select>
	<sql id="employeeInfo_where_export">
		<include refid="employeeInfo_where"/>

		<if test="tEmployeeInfo.authSql != null and tEmployeeInfo.authSql.trim() != ''">
			and
			a.id in (
			select  b.emp_id from  t_employee_project  b
			where
			b.DELETE_FLAG = '0'
			${tEmployeeInfo.authSql}
			)
		</if>
	</sql>
fangxinjiang's avatar
fangxinjiang committed
1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139

	<!--tEmployeeInfo离职档案导出查询-->
	<select id="noPageLeaveDiy" resultMap="tEmployeeLeaveExportMap">
		SELECT
		a.EMP_CODE,
		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",
		a.EMP_NAME,
		a.EMP_IDCARD,
		a.EMP_PHONE,
		a.EMP_EMAIL,
		a1.area_name as "FILE_PROVINCE",
		a2.area_name as "FILE_CITY",
		a3.area_name as "FILE_TOWN",
		a.LEAVE_TIME,
		a.LEAVE_USER_NAME,
		p.DEPT_NAME,
		p.DEPT_NO,
		p.UNIT_NAME
		from t_employee_info a
		LEFT JOIN view_project_leave p on a.EMP_IDCARD=p.EMP_IDCARD
		LEFT JOIN sys_area a1 on a1.id=a.FILE_PROVINCE
		LEFT JOIN sys_area a2 on a2.id=a.FILE_CITY
		LEFT JOIN sys_area a3 on a3.id=a.FILE_TOWN
		<where>
			a.DELETE_FLAG = '0'
			<include refid="employeeInfo_where"/>
			<if test="tEmployeeInfo.authSql != null and tEmployeeInfo.authSql.trim() != ''">
				and
				a.id in (
				select  b.emp_id from  t_employee_project  b
				where
				b.DELETE_FLAG = '0'
				${tEmployeeInfo.authSql}
				)
			</if>
			<if test="tEmployeeInfo.unitName != null and tEmployeeInfo.unitName.trim() != ''">
				AND p.UNIT_NAME like concat('%',#{tEmployeeInfo.unitName},'%')
			</if>
			<if test="tEmployeeInfo.deptName != null and tEmployeeInfo.deptName.trim() != ''">
				AND p.DEPT_NAME like concat('%',#{tEmployeeInfo.deptName},'%')
			</if>
			<if test="tEmployeeInfo.deptNo != null and tEmployeeInfo.deptNo.trim() != ''">
				AND p.DEPT_NO like concat('%',#{tEmployeeInfo.deptNo},'%')
			</if>
		</where>
		order by a.CREATE_TIME desc
		<if test="tEmployeeInfo != null">
			<if test="tEmployeeInfo.limitStart != null">
				limit #{tEmployeeInfo.limitStart},#{tEmployeeInfo.limitEnd}
			</if>
		</if>

	</select>

	<!--tEmployeeInfo离职档案导出查询-->
	<select id="noPageCountLeaveDiy" resultType="java.lang.Integer">
		select count(1)
		from t_employee_info a
		LEFT JOIN view_project_leave p on a.EMP_IDCARD=p.EMP_IDCARD
		<where>
			a.DELETE_FLAG = '0'
			<include refid="employeeInfo_where"/>
			<if test="tEmployeeInfo.authSql != null and tEmployeeInfo.authSql.trim() != ''">
				and
				a.id in (
				select  b.emp_id from  t_employee_project  b
				where
				b.DELETE_FLAG = '0'
				${tEmployeeInfo.authSql}
				)
			</if>
			<if test="tEmployeeInfo.unitName != null and tEmployeeInfo.unitName.trim() != ''">
				AND p.UNIT_NAME like concat('%',#{tEmployeeInfo.unitName},'%')
			</if>
			<if test="tEmployeeInfo.deptName != null and tEmployeeInfo.deptName.trim() != ''">
				AND p.DEPT_NAME like concat('%',#{tEmployeeInfo.deptName},'%')
			</if>
			<if test="tEmployeeInfo.deptNo != null and tEmployeeInfo.deptNo.trim() != ''">
				AND p.DEPT_NO like concat('%',#{tEmployeeInfo.deptNo},'%')
			</if>
		</where>
		order by a.CREATE_TIME desc

	</select>
1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157

	<update id="updateSocialInfoById" >
		update t_employee_info a
		<trim prefix="set" suffixOverrides=",">
			<if test="tEmployeeInfo.id != null">a.id=a.id,</if>
			<if test="tEmployeeInfo.socialStatus != null">SOCIAL_STATUS=#{tEmployeeInfo.socialStatus},</if>
			<if test="tEmployeeInfo.fundStatus != null">FUND_STATUS=#{tEmployeeInfo.fundStatus},</if>
			<if test="tEmployeeInfo.fileProvince != null">a.FILE_PROVINCE=#{tEmployeeInfo.fileProvince},</if>
			<if test="tEmployeeInfo.fileCity != null">a.FILE_CITY=#{tEmployeeInfo.fileCity},</if>
			<if test="tEmployeeInfo.fileCity != null">
				<if test="tEmployeeInfo.fileTown != null">a.FILE_TOWN=#{tEmployeeInfo.fileTown},</if>
				<if test="tEmployeeInfo.fileTown == null">a.FILE_TOWN=null,</if>
			</if>

			<if test="tEmployeeInfo.empPhone != null  and tEmployeeInfo.empPhone != ''">a.EMP_PHONE=#{tEmployeeInfo.empPhone},</if>
		</trim>
		WHERE a.id=#{tEmployeeInfo.id}
	</update>
1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183

	<!-- 更新档案商险状态 -->
	<update id="updateEmployeeInfoInsuranceStatus" >
		update t_employee_info a set a.INSURANCE_STATUS = #{emp.status} where a.EMP_IDCARD = #{emp.idCard}
	</update>

	<!-- 更新档案薪资状态 -->
	<update id="updateEmployeeInfoSalaryStatus" >
		update t_employee_info a set a.SALARY_STATUS = #{emp.status} where a.EMP_IDCARD = #{emp.idCard}
	</update>

	<!-- 每月1号更新档案薪资状态为否薪资 -->
	<update id="everyMonthUpdateEmployeeInfoSalaryStatus" >
		update t_employee_info 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
			)
	</update>

	<!-- 每天更新人员档案、项目档案的过期合同为2不在用 -->
	<update id="everyDayUpdateEmployeeInfoContractStatus" >
		update t_employee_info e
		left join t_employee_contract_info c on e.EMP_IDCARD=c.EMP_IDCARD 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")
1184 1185 1186 1187
		and not EXISTS (
			select 1 from t_employee_contract_info ec where ec.EMP_IDCARD=c.EMP_IDCARD and ec.IN_USE='0'
			and (ec.CONTRACT_END is null or ec.CONTRACT_END >= DATE_FORMAT(curdate(),"%Y-%m-%d"))
		)
1188 1189
	</update>

1190
</mapper>