TPersonnelRosterMapper.xml 22.3 KB
Newer Older
fangxinjiang's avatar
fangxinjiang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
<?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">

<mapper namespace="com.yifu.cloud.plus.v1.yifu.archives.mapper.TPersonnelRosterMapper">

  <resultMap id="tPersonnelRosterMap" type="com.yifu.cloud.plus.v1.yifu.archives.entity.TPersonnelRoster">
    <id property="id" column="ID"/>
    <result property="customerName" column="CUSTOMER_NAME"/>
    <result property="departName" column="DEPART_NAME"/>
    <result property="departNo" column="DEPART_NO"/>
    <result property="businessPrimary" column="BUSINESS_PRIMARY"/>
fangxinjiang's avatar
fangxinjiang committed
32
    <result property="businessSecond" column="BUSINESS_SECOND"/>
fangxinjiang's avatar
fangxinjiang committed
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
    <result property="businessThird" column="BUSINESS_THIRD"/>
    <result property="label" column="LABEL"/>
    <result property="businessType" column="BUSINESS_TYPE"/>
    <result property="buBelong" column="BU_BELONG"/>
    <result property="empType" column="EMP_TYPE"/>
    <result property="empName" column="EMP_NAME"/>
    <result property="empSex" column="EMP_SEX"/>
    <result property="empBirthDate" column="EMP_BIRTH_DATE"/>
    <result property="empAge" column="EMP_AGE"/>
    <result property="empIdcard" column="EMP_IDCARD"/>
    <result property="bankNo" column="BANK_NO"/>
    <result property="bankName" column="BANK_NAME"/>
    <result property="bankProvince" column="BANK_PROVINCE"/>
    <result property="bankCity" column="BANK_CITY"/>
    <result property="bankNameSub" column="BANK_NAME_SUB"/>
    <result property="empPhone" column="EMP_PHONE"/>
    <result property="empProvince" column="EMP_PROVINCE"/>
    <result property="empCity" column="EMP_CITY"/>
    <result property="empTown" column="EMP_TOWN"/>
fangxinjiang's avatar
fangxinjiang committed
52 53 54
    <result property="socialProvince" column="SOCIAL_PROVINCE"/>
	<result property="socialCity" column="SOCIAL_CITY"/>
	<result property="socialTown" column="SOCIAL_TOWN"/>
fangxinjiang's avatar
fangxinjiang committed
55 56 57 58 59 60 61 62 63 64 65 66 67 68
    <result property="contractApplyNo" column="CONTRACT_APPLY_NO"/>
    <result property="contractStart" column="CONTRACT_START"/>
    <result property="contractEnd" column="CONTRACT_END"/>
    <result property="contractType" column="CONTRACT_TYPE"/>
    <result property="businessDetail" column="BUSINESS_DETAIL"/>
    <result property="signType" column="SIGN_TYPE"/>
    <result property="signTerm" column="SIGN_TERM"/>
    <result property="contractPartyA" column="CONTRACT_PARTY_A"/>
    <result property="contractPost" column="CONTRACT_POST"/>
    <result property="contractTaskTime" column="CONTRACT_TASK_TIME"/>
    <result property="contractCode" column="CONTRACT_CODE"/>
    <result property="contractCreater" column="CONTRACT_CREATER"/>
    <result property="contractCreateTime" column="CONTRACT_CREATE_TIME"/>
    <result property="dataCreateMonth" column="DATA_CREATE_MONTH"/>
fangxinjiang's avatar
fangxinjiang committed
69 70
	<result property="settleDomain" column="SETTLE_DOMAIN"/>

fangxinjiang's avatar
fangxinjiang committed
71
  </resultMap>
fangxinjiang's avatar
fangxinjiang committed
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
	<resultMap id="tPersonnelRosterExportMap" type="com.yifu.cloud.plus.v1.yifu.archives.vo.TPersonnelRosterExportVo">
		<id property="id" column="ID"/>
		<result property="customerName" column="CUSTOMER_NAME"/>
		<result property="departName" column="DEPART_NAME"/>
		<result property="departNo" column="DEPART_NO"/>
		<result property="businessPrimary" column="BUSINESS_PRIMARY"/>
		<result property="businessSecond" column="BUSINESS_SECOND"/>
		<result property="businessThird" column="BUSINESS_THIRD"/>
		<result property="label" column="LABEL"/>
		<result property="businessType" column="BUSINESS_TYPE"/>
		<result property="buBelong" column="BU_BELONG"/>
		<result property="empType" column="EMP_TYPE"/>
		<result property="empName" column="EMP_NAME"/>
		<result property="empSex" column="EMP_SEX"/>
		<result property="empBirthDate" column="EMP_BIRTH_DATE"/>
		<result property="empAge" column="EMP_AGE"/>
		<result property="empIdcard" column="EMP_IDCARD"/>
		<result property="bankNo" column="BANK_NO"/>
		<result property="bankName" column="BANK_NAME"/>
		<result property="bankProvince" column="BANK_PROVINCE"/>
		<result property="bankCity" column="BANK_CITY"/>
		<result property="bankNameSub" column="BANK_NAME_SUB"/>
		<result property="empPhone" column="EMP_PHONE"/>
		<result property="empProvince" column="EMP_PROVINCE"/>
		<result property="empCity" column="EMP_CITY"/>
		<result property="empTown" column="EMP_TOWN"/>
		<result property="socialProvince" column="SOCIAL_PROVINCE"/>
		<result property="socialCity" column="SOCIAL_CITY"/>
		<result property="socialTown" column="SOCIAL_TOWN"/>
		<result property="contractApplyNo" column="CONTRACT_APPLY_NO"/>
		<result property="contractStart" column="CONTRACT_START"/>
		<result property="contractEnd" column="CONTRACT_END"/>
		<result property="contractType" column="CONTRACT_TYPE"/>
		<result property="businessDetail" column="BUSINESS_DETAIL"/>
		<result property="signType" column="SIGN_TYPE"/>
		<result property="signTerm" column="SIGN_TERM"/>
		<result property="contractPartyA" column="CONTRACT_PARTY_A"/>
		<result property="contractPost" column="CONTRACT_POST"/>
		<result property="contractTaskTime" column="CONTRACT_TASK_TIME"/>
		<result property="contractCode" column="CONTRACT_CODE"/>
		<result property="contractCreater" column="CONTRACT_CREATER"/>
		<result property="contractCreateTime" column="CONTRACT_CREATE_TIME"/>
		<result property="dataCreateMonth" column="DATA_CREATE_MONTH"/>

	</resultMap>
fangxinjiang's avatar
fangxinjiang committed
117 118 119 120 121 122
    <sql id="Base_Column_List">
                a.ID,
                a.CUSTOMER_NAME,
                a.DEPART_NAME,
                a.DEPART_NO,
                a.BUSINESS_PRIMARY,
fangxinjiang's avatar
fangxinjiang committed
123
                a.BUSINESS_SECOND,
fangxinjiang's avatar
fangxinjiang committed
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
                a.BUSINESS_THIRD,
                a.LABEL,
                a.BUSINESS_TYPE,
                a.BU_BELONG,
                a.EMP_TYPE,
                a.EMP_NAME,
                a.EMP_SEX,
                a.EMP_BIRTH_DATE,
                a.EMP_AGE,
                a.EMP_IDCARD,
                a.BANK_NO,
                a.BANK_NAME,
                a.BANK_PROVINCE,
                a.BANK_CITY,
                a.BANK_NAME_SUB,
                a.EMP_PHONE,
                a.EMP_PROVINCE,
                a.EMP_CITY,
                a.EMP_TOWN,
fangxinjiang's avatar
fangxinjiang committed
143 144 145
                a.SOCIAL_PROVINCE,
				a.SOCIAL_CITY,
				a.SOCIAL_TOWN,
fangxinjiang's avatar
fangxinjiang committed
146 147 148 149 150 151 152 153 154 155 156 157 158
                a.CONTRACT_APPLY_NO,
                a.CONTRACT_START,
                a.CONTRACT_END,
                a.CONTRACT_TYPE,
                a.BUSINESS_DETAIL,
                a.SIGN_TYPE,
                a.SIGN_TERM,
                a.CONTRACT_PARTY_A,
                a.CONTRACT_POST,
                a.CONTRACT_TASK_TIME,
                a.CONTRACT_CODE,
                a.CONTRACT_CREATER,
                a.CONTRACT_CREATE_TIME,
fangxinjiang's avatar
fangxinjiang committed
159 160
                a.DATA_CREATE_MONTH,
				a.SETTLE_DOMAIN
fangxinjiang's avatar
fangxinjiang committed
161 162 163 164 165 166 167
    </sql>
    <sql id="tPersonnelRoster_where">
        <if test="tPersonnelRoster != null">
                    <if test="tPersonnelRoster.id != null and tPersonnelRoster.id.trim() != ''">
                        AND a.ID = #{tPersonnelRoster.id}
                    </if>
                    <if test="tPersonnelRoster.customerName != null and tPersonnelRoster.customerName.trim() != ''">
fangxinjiang's avatar
fangxinjiang committed
168
                        AND a.CUSTOMER_NAME like CONCAT(#{tPersonnelRoster.customerName},'%')
fangxinjiang's avatar
fangxinjiang committed
169 170 171 172 173
                    </if>
                    <if test="tPersonnelRoster.departName != null and tPersonnelRoster.departName.trim() != ''">
                        AND a.DEPART_NAME = #{tPersonnelRoster.departName}
                    </if>
                    <if test="tPersonnelRoster.departNo != null and tPersonnelRoster.departNo.trim() != ''">
fangxinjiang's avatar
fangxinjiang committed
174
                        AND a.DEPART_NO like CONCAT(#{tPersonnelRoster.departNo},'%')
fangxinjiang's avatar
fangxinjiang committed
175 176 177 178
                    </if>
                    <if test="tPersonnelRoster.businessPrimary != null and tPersonnelRoster.businessPrimary.trim() != ''">
                        AND a.BUSINESS_PRIMARY = #{tPersonnelRoster.businessPrimary}
                    </if>
fangxinjiang's avatar
fangxinjiang committed
179 180
                    <if test="tPersonnelRoster.businessSecond != null and tPersonnelRoster.businessSecond.trim() != ''">
                        AND a.BUSINESS_SECOND = #{tPersonnelRoster.businessSecond}
fangxinjiang's avatar
fangxinjiang committed
181 182 183 184 185
                    </if>
                    <if test="tPersonnelRoster.businessThird != null and tPersonnelRoster.businessThird.trim() != ''">
                        AND a.BUSINESS_THIRD = #{tPersonnelRoster.businessThird}
                    </if>
                    <if test="tPersonnelRoster.label != null and tPersonnelRoster.label.trim() != ''">
fangxinjiang's avatar
fangxinjiang committed
186
                        AND a.LABEL like CONCAT(#{tPersonnelRoster.label},'%')
fangxinjiang's avatar
fangxinjiang committed
187 188 189 190 191 192 193 194 195 196 197
                    </if>
                    <if test="tPersonnelRoster.businessType != null and tPersonnelRoster.businessType.trim() != ''">
                        AND a.BUSINESS_TYPE = #{tPersonnelRoster.businessType}
                    </if>
                    <if test="tPersonnelRoster.buBelong != null and tPersonnelRoster.buBelong.trim() != ''">
                        AND a.BU_BELONG = #{tPersonnelRoster.buBelong}
                    </if>
                    <if test="tPersonnelRoster.empType != null and tPersonnelRoster.empType.trim() != ''">
                        AND a.EMP_TYPE = #{tPersonnelRoster.empType}
                    </if>
                    <if test="tPersonnelRoster.empName != null and tPersonnelRoster.empName.trim() != ''">
fangxinjiang's avatar
fangxinjiang committed
198
                        AND a.EMP_NAME like CONCAT(#{tPersonnelRoster.empName},'%')
fangxinjiang's avatar
fangxinjiang committed
199 200 201 202 203 204 205 206 207 208 209
                    </if>
                    <if test="tPersonnelRoster.empSex != null and tPersonnelRoster.empSex.trim() != ''">
                        AND a.EMP_SEX = #{tPersonnelRoster.empSex}
                    </if>
                    <if test="tPersonnelRoster.empBirthDate != null">
                        AND a.EMP_BIRTH_DATE = #{tPersonnelRoster.empBirthDate}
                    </if>
                    <if test="tPersonnelRoster.empAge != null and tPersonnelRoster.empAge.trim() != ''">
                        AND a.EMP_AGE = #{tPersonnelRoster.empAge}
                    </if>
                    <if test="tPersonnelRoster.empIdcard != null and tPersonnelRoster.empIdcard.trim() != ''">
fangxinjiang's avatar
fangxinjiang committed
210
                        AND a.EMP_IDCARD like CONCAT(#{tPersonnelRoster.empIdcard},'%')
fangxinjiang's avatar
fangxinjiang committed
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238
                    </if>
                    <if test="tPersonnelRoster.bankNo != null and tPersonnelRoster.bankNo.trim() != ''">
                        AND a.BANK_NO = #{tPersonnelRoster.bankNo}
                    </if>
                    <if test="tPersonnelRoster.bankName != null and tPersonnelRoster.bankName.trim() != ''">
                        AND a.BANK_NAME = #{tPersonnelRoster.bankName}
                    </if>
                    <if test="tPersonnelRoster.bankProvince != null and tPersonnelRoster.bankProvince.trim() != ''">
                        AND a.BANK_PROVINCE = #{tPersonnelRoster.bankProvince}
                    </if>
                    <if test="tPersonnelRoster.bankCity != null and tPersonnelRoster.bankCity.trim() != ''">
                        AND a.BANK_CITY = #{tPersonnelRoster.bankCity}
                    </if>
                    <if test="tPersonnelRoster.bankNameSub != null and tPersonnelRoster.bankNameSub.trim() != ''">
                        AND a.BANK_NAME_SUB = #{tPersonnelRoster.bankNameSub}
                    </if>
                    <if test="tPersonnelRoster.empPhone != null and tPersonnelRoster.empPhone.trim() != ''">
                        AND a.EMP_PHONE = #{tPersonnelRoster.empPhone}
                    </if>
                    <if test="tPersonnelRoster.empProvince != null and tPersonnelRoster.empProvince.trim() != ''">
                        AND a.EMP_PROVINCE = #{tPersonnelRoster.empProvince}
                    </if>
                    <if test="tPersonnelRoster.empCity != null and tPersonnelRoster.empCity.trim() != ''">
                        AND a.EMP_CITY = #{tPersonnelRoster.empCity}
                    </if>
                    <if test="tPersonnelRoster.empTown != null and tPersonnelRoster.empTown.trim() != ''">
                        AND a.EMP_TOWN = #{tPersonnelRoster.empTown}
                    </if>
fangxinjiang's avatar
fangxinjiang committed
239
					<if test="tPersonnelRoster.socialProvince != null and tPersonnelRoster.socialProvince.trim() != ''">
fangxinjiang's avatar
fangxinjiang committed
240
						AND a.SOCIAL_PROVINCE = #{tPersonnelRoster.socialProvince}
fangxinjiang's avatar
fangxinjiang committed
241 242 243 244 245 246 247
					</if>
					<if test="tPersonnelRoster.socialCity != null and tPersonnelRoster.socialCity.trim() != ''">
						AND a.SOCIAL_CITY = #{tPersonnelRoster.socialCity}
					</if>
					<if test="tPersonnelRoster.socialTown != null and tPersonnelRoster.socialTown.trim() != ''">
						AND a.SOCIAL_TOWN = #{tPersonnelRoster.socialTown}
					</if>
fangxinjiang's avatar
fangxinjiang committed
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
                    <if test="tPersonnelRoster.contractApplyNo != null and tPersonnelRoster.contractApplyNo.trim() != ''">
                        AND a.CONTRACT_APPLY_NO = #{tPersonnelRoster.contractApplyNo}
                    </if>
                    <if test="tPersonnelRoster.contractStart != null and tPersonnelRoster.contractStart.trim() != ''">
                        AND a.CONTRACT_START = #{tPersonnelRoster.contractStart}
                    </if>
                    <if test="tPersonnelRoster.contractEnd != null and tPersonnelRoster.contractEnd.trim() != ''">
                        AND a.CONTRACT_END = #{tPersonnelRoster.contractEnd}
                    </if>
                    <if test="tPersonnelRoster.contractType != null and tPersonnelRoster.contractType.trim() != ''">
                        AND a.CONTRACT_TYPE = #{tPersonnelRoster.contractType}
                    </if>
                    <if test="tPersonnelRoster.businessDetail != null and tPersonnelRoster.businessDetail.trim() != ''">
                        AND a.BUSINESS_DETAIL = #{tPersonnelRoster.businessDetail}
                    </if>
                    <if test="tPersonnelRoster.signType != null and tPersonnelRoster.signType.trim() != ''">
                        AND a.SIGN_TYPE = #{tPersonnelRoster.signType}
                    </if>
                    <if test="tPersonnelRoster.signTerm != null and tPersonnelRoster.signTerm.trim() != ''">
                        AND a.SIGN_TERM = #{tPersonnelRoster.signTerm}
                    </if>
                    <if test="tPersonnelRoster.contractPartyA != null and tPersonnelRoster.contractPartyA.trim() != ''">
                        AND a.CONTRACT_PARTY_A = #{tPersonnelRoster.contractPartyA}
                    </if>
                    <if test="tPersonnelRoster.contractPost != null and tPersonnelRoster.contractPost.trim() != ''">
                        AND a.CONTRACT_POST = #{tPersonnelRoster.contractPost}
                    </if>
                    <if test="tPersonnelRoster.contractTaskTime != null and tPersonnelRoster.contractTaskTime.trim() != ''">
                        AND a.CONTRACT_TASK_TIME = #{tPersonnelRoster.contractTaskTime}
                    </if>
                    <if test="tPersonnelRoster.contractCode != null and tPersonnelRoster.contractCode.trim() != ''">
                        AND a.CONTRACT_CODE = #{tPersonnelRoster.contractCode}
                    </if>
                    <if test="tPersonnelRoster.contractCreater != null and tPersonnelRoster.contractCreater.trim() != ''">
                        AND a.CONTRACT_CREATER = #{tPersonnelRoster.contractCreater}
                    </if>
                    <if test="tPersonnelRoster.contractCreateTime != null and tPersonnelRoster.contractCreateTime.trim() != ''">
                        AND a.CONTRACT_CREATE_TIME = #{tPersonnelRoster.contractCreateTime}
                    </if>
                    <if test="tPersonnelRoster.dataCreateMonth != null and tPersonnelRoster.dataCreateMonth.trim() != ''">
                        AND a.DATA_CREATE_MONTH = #{tPersonnelRoster.dataCreateMonth}
                    </if>
fangxinjiang's avatar
fangxinjiang committed
290 291 292
					<if test="tPersonnelRoster.authSql != null and tPersonnelRoster.authSql.trim() != ''">
						${tPersonnelRoster.authSql}
					</if>
fangxinjiang's avatar
fangxinjiang committed
293

fangxinjiang's avatar
fangxinjiang committed
294 295 296 297 298 299 300 301 302 303 304 305 306
					<if test="tPersonnelRoster.businessTypes != null and tPersonnelRoster.businessTypes.size() > 0">
						AND a.BUSINESS_TYPE in
						<foreach item="item" index="index" collection="tPersonnelRoster.businessTypes" open="(" separator="," close=")">
							#{item}
						</foreach>
					</if>

					<if test="tPersonnelRoster.buBelongs != null and tPersonnelRoster.buBelongs.size() > 0">
						AND a.BU_BELONG in
						<foreach item="item" index="index" collection="tPersonnelRoster.buBelongs" open="(" separator="," close=")">
							#{item}
						</foreach>
					</if>
fangxinjiang's avatar
fangxinjiang committed
307 308 309 310 311 312
					<if test="tPersonnelRoster.empTypes != null and tPersonnelRoster.empTypes.size() > 0">
						AND a.EMP_TYPE in
						<foreach item="item" index="index" collection="tPersonnelRoster.empTypes" open="(" separator="," close=")">
							#{item}
						</foreach>
					</if>
fangxinjiang's avatar
fangxinjiang committed
313

fangxinjiang's avatar
fangxinjiang committed
314 315 316 317 318 319 320 321 322 323 324
        </if>
    </sql>
    <!--tPersonnelRoster简单分页查询-->
    <select id="getTPersonnelRosterPage" resultMap="tPersonnelRosterMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_personnel_roster a
        <where>
            1=1
            <include refid="tPersonnelRoster_where"/>
        </where>
fangxinjiang's avatar
fangxinjiang committed
325
		order by a.CONTRACT_CREATE_TIME ASC
fangxinjiang's avatar
fangxinjiang committed
326
    </select>
fangxinjiang's avatar
fangxinjiang committed
327
	<select id="getTPersonnelRoster" resultMap="tPersonnelRosterMap">
fangxinjiang's avatar
fangxinjiang committed
328 329 330 331 332 333 334 335 336 337 338
		select c1.SUBJECT_UNIT as 'CUSTOMER_NAME',c1.SUBJECT_DEPART as 'DEPART_NAME',c1.DEPT_NO as 'DEPART_NO',
		d.BUSINESS_PRIMARY_TYPE as 'BUSINESS_PRIMARY',d.BUSINESS_SECOND_TYPE as 'BUSINESS_SECOND',d.BUSINESS_THIRD_TYPE as 'BUSINESS_THIRD',
		p.EMP_LABEL as 'LABEL',d.LINE_TYPE as 'BUSINESS_TYPE',d.BU_BELONG as 'BU_BELONG',c1.EMP_NATRUE as 'EMP_TYPE',
		c1.EMP_NAME as 'EMP_NAME',e.EMP_SEX as 'EMP_SEX',DATE_FORMAT(e.EMP_BIRTHDAY ,"%Y-%m-%d")  as 'EMP_BIRTH_DATE',e.EMP_AGE as 'EMP_AGE',c1.EMP_IDCARD as 'EMP_IDCARD',
		e.EMP_PHONE as 'EMP_PHONE',c1.FILE_PROVINCE as 'EMP_PROVINCE',c1.FILE_CITY as 'EMP_CITY',c1.FILE_TOWN as 'EMP_TOWN',
		p.SOCIAL_PROVINCE as 'SOCIAL_PROVINCE',p.SOCIAL_CITY as 'SOCIAL_CITY',p.SOCIAL_TOWN as 'SOCIAL_TOWN',c1.APPLY_NO as 'CONTRACT_APPLY_NO',
		c1.CONTRACT_START as 'CONTRACT_START',c1.CONTRACT_END as 'CONTRACT_END',c1.CONTRACT_NAME as 'CONTRACT_TYPE',c1.CONTRACT_SUB_NAME as 'BUSINESS_DETAIL',
		c1.SITUATION as 'SIGN_TYPE',c1.CONTRACT_TYPE as 'SIGN_TERM',
		c1.CONTRACT_PARTY as 'CONTRACT_PARTY_A',c1.POST as 'CONTRACT_POST',c1.WORKING_HOURS as 'CONTRACT_TASK_TIME',
		c1.CONTRACT_NO as 'CONTRACT_CODE',c1.CREATE_NAME as 'CONTRACT_CREATER',c1.CREATE_TIME as 'CONTRACT_CREATE_TIME',
		d.id as "SETTLE_DOMAIN"
fangxinjiang's avatar
fangxinjiang committed
339
		from
fangxinjiang's avatar
fangxinjiang committed
340
		(select  MAX(c.CREATE_TIME) as "CREATE_TIME",c.id,c.EMP_IDCARD,c.DEPT_NO from t_employee_contract_info c WHERE c.IN_USE = 0 and c.DELETE_FLAG='0'
fangxinjiang's avatar
fangxinjiang committed
341 342 343 344
		GROUP BY c.DEPT_NO,c.EMP_IDCARD) t
		LEFT JOIN t_employee_info e on e.EMP_IDCARD=t.EMP_IDCARD
		LEFT JOIN t_employee_project p on p.EMP_IDCARD=t.EMP_IDCARD and p.DEPT_NO=t.DEPT_NO
		LEFT JOIN t_settle_domain d on d.DEPART_NO=t.DEPT_NO
fangxinjiang's avatar
fangxinjiang committed
345 346
		INNER JOIN t_employee_contract_info c1 on c1.EMP_IDCARD=t.EMP_IDCARD and c1.DEPT_NO=t.DEPT_NO and c1.CREATE_TIME=t.CREATE_TIME
		GROUP BY t.DEPT_NO,t.EMP_IDCARD
fangxinjiang's avatar
fangxinjiang committed
347 348 349 350 351 352 353 354
		<if test="tPersonnelRoster != null">
			<if test="tPersonnelRoster.limitStart != null">
				limit #{tPersonnelRoster.limitStart},#{tPersonnelRoster.limitEnd}
			</if>
		</if>
	</select>
	<select id="getTPersonnelRosterCount" resultType="java.lang.Integer">
		select count(1)
fangxinjiang's avatar
fangxinjiang committed
355 356
		from (
				 select count(1)
fangxinjiang's avatar
fangxinjiang committed
357
				 from (select MAX(c.CREATE_TIME) as "CREATE_TIME", c.id, c.EMP_IDCARD, c.DEPT_NO
fangxinjiang's avatar
fangxinjiang committed
358 359 360 361 362 363 364
					   from t_employee_contract_info c
					   WHERE c.IN_USE = 0
						 and c.DELETE_FLAG = '0'
					   GROUP BY c.DEPT_NO, c.EMP_IDCARD) t
						  LEFT JOIN t_employee_info e on e.EMP_IDCARD = t.EMP_IDCARD
						  LEFT JOIN t_employee_project p on p.EMP_IDCARD = t.EMP_IDCARD and p.DEPT_NO = t.DEPT_NO
						  LEFT JOIN t_settle_domain d on d.DEPART_NO = t.DEPT_NO
fangxinjiang's avatar
fangxinjiang committed
365
						  INNER JOIN t_employee_contract_info c1 on c1.EMP_IDCARD=t.EMP_IDCARD and c1.DEPT_NO=t.DEPT_NO and c1.CREATE_TIME=t.CREATE_TIME
fangxinjiang's avatar
fangxinjiang committed
366 367
				 GROUP BY t.DEPT_NO, t.EMP_IDCARD
			 ) a
fangxinjiang's avatar
fangxinjiang committed
368
	</select>
fangxinjiang's avatar
fangxinjiang committed
369 370 371 372 373 374 375 376 377 378 379
	<select id="noPageCountDiy" resultType="java.lang.Integer">
		select
		count(1)
		from t_personnel_roster a
		<where>
			1=1
			<include refid="tPersonnelRoster_where"/>
		</where>
	</select>

	<!--tEmployeeInfo人员档案导出查询改造 fxj 2022-11-02-->
fangxinjiang's avatar
fangxinjiang committed
380
	<select id="noPageDiy" resultMap="tPersonnelRosterExportMap">
fangxinjiang's avatar
fangxinjiang committed
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435
		SELECT
		a.ID,
		a.CUSTOMER_NAME,
		a.DEPART_NAME,
		a.DEPART_NO,
		a.BUSINESS_PRIMARY,
		a.BUSINESS_SECOND,
		a.BUSINESS_THIRD,
		a.LABEL,
		a.BUSINESS_TYPE,
		a.BU_BELONG,
		a.EMP_TYPE,
		a.EMP_NAME,
		CASE WHEN a.EMP_SEX=1 THEN "男" WHEN a.EMP_SEX=2 THEN "女" ELSE "" END as "EMP_SEX",
		a.EMP_BIRTH_DATE,
		a.EMP_AGE,
		a.EMP_IDCARD,
		a.BANK_NO,
		a.BANK_NAME,
		a1.AREA_NAME as "BANK_PROVINCE",
		a1.AREA_NAME as "BANK_CITY",
		a.BANK_NAME_SUB,
		a.EMP_PHONE,
		a6.AREA_NAME as "EMP_PROVINCE",
		a7.AREA_NAME as "EMP_CITY",
		a8.AREA_NAME as "EMP_TOWN",
		a3.AREA_NAME as "SOCIAL_PROVINCE",
		a4.AREA_NAME as "SOCIAL_CITY",
		a5.AREA_NAME as "SOCIAL_TOWN",
		a.CONTRACT_APPLY_NO,
		a.CONTRACT_START,
		a.CONTRACT_END,
		a.CONTRACT_TYPE,
		a.BUSINESS_DETAIL,
		a.SIGN_TYPE,
		a.SIGN_TERM,
		a.CONTRACT_PARTY_A,
		a.CONTRACT_POST,
		a.CONTRACT_TASK_TIME,
		a.CONTRACT_CODE,
		a.CONTRACT_CREATER,
		a.CONTRACT_CREATE_TIME,
		a.DATA_CREATE_MONTH,
		a.SETTLE_DOMAIN
		FROM
		t_personnel_roster a
		LEFT JOIN sys_area a1 on a1.id=a.BANK_PROVINCE
		LEFT JOIN sys_area a2 on a2.id=a.BANK_CITY

		LEFT JOIN sys_area a3 on a3.id=a.SOCIAL_PROVINCE
		LEFT JOIN sys_area a4 on a4.id=a.SOCIAL_CITY
		LEFT JOIN sys_area a5 on a5.id=a.SOCIAL_TOWN
		LEFT JOIN sys_area a6 on a6.id=a.EMP_PROVINCE
		LEFT JOIN sys_area a7 on a7.id=a.EMP_CITY
		LEFT JOIN sys_area a8 on a8.id=a.EMP_TOWN
fangxinjiang's avatar
fangxinjiang committed
436
		<where>
fangxinjiang's avatar
fangxinjiang committed
437
			1=1
fangxinjiang's avatar
fangxinjiang committed
438 439
			<include refid="tPersonnelRoster_where"/>
		</where>
fangxinjiang's avatar
fangxinjiang committed
440
		order by a.CONTRACT_CREATE_TIME ASC
fangxinjiang's avatar
fangxinjiang committed
441 442 443 444 445 446
		<if test="tPersonnelRoster != null">
			<if test="tPersonnelRoster.limitStart != null">
				limit #{tPersonnelRoster.limitStart},#{tPersonnelRoster.limitEnd}
			</if>
		</if>
	</select>
fangxinjiang's avatar
fangxinjiang committed
447
</mapper>