TPersonnelRosterMapper.xml 17.5 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 69 70 71 72 73 74 75 76
    <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"/>
    <result property="dataCreateMomth" column="DATA_CREATE_MOMTH"/>
  </resultMap>
    <sql id="Base_Column_List">
                a.ID,
                a.CUSTOMER_NAME,
                a.DEPART_NAME,
                a.DEPART_NO,
                a.BUSINESS_PRIMARY,
fangxinjiang's avatar
fangxinjiang committed
77
                a.BUSINESS_SECOND,
fangxinjiang's avatar
fangxinjiang committed
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
                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
97 98 99
                a.SOCIAL_PROVINCE,
				a.SOCIAL_CITY,
				a.SOCIAL_TOWN,
fangxinjiang's avatar
fangxinjiang committed
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
                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.DATA_CREATE_MOMTH
    </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
122
                        AND a.CUSTOMER_NAME like CONCAT(#{tPersonnelRoster.customerName},'%')
fangxinjiang's avatar
fangxinjiang committed
123 124 125 126 127
                    </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
128
                        AND a.DEPART_NO like CONCAT(#{tPersonnelRoster.departNo},'%')
fangxinjiang's avatar
fangxinjiang committed
129 130 131 132
                    </if>
                    <if test="tPersonnelRoster.businessPrimary != null and tPersonnelRoster.businessPrimary.trim() != ''">
                        AND a.BUSINESS_PRIMARY = #{tPersonnelRoster.businessPrimary}
                    </if>
fangxinjiang's avatar
fangxinjiang committed
133 134
                    <if test="tPersonnelRoster.businessSecond != null and tPersonnelRoster.businessSecond.trim() != ''">
                        AND a.BUSINESS_SECOND = #{tPersonnelRoster.businessSecond}
fangxinjiang's avatar
fangxinjiang committed
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
                    </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() != ''">
                        AND a.LABEL = #{tPersonnelRoster.label}
                    </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
152
                        AND a.EMP_NAME like CONCAT(#{tPersonnelRoster.empName},'%')
fangxinjiang's avatar
fangxinjiang committed
153 154 155 156 157 158 159 160 161 162 163
                    </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
164
                        AND a.EMP_IDCARD like CONCAT(#{tPersonnelRoster.empIdcard},'%')
fangxinjiang's avatar
fangxinjiang committed
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
                    </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
193 194 195 196 197 198 199 200 201
					<if test="tPersonnelRoster.socialProvince != null and tPersonnelRoster.socialProvince.trim() != ''">
						AND a.SOCIAL_PROVINCE = #{tPersonnelRoster.empProvince}
					</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
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258
                    <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>
                    <if test="tPersonnelRoster.dataCreateMomth != null and tPersonnelRoster.dataCreateMomth.trim() != ''">
                        AND a.DATA_CREATE_MOMTH = #{tPersonnelRoster.dataCreateMomth}
                    </if>
        </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>
    </select>
fangxinjiang's avatar
fangxinjiang committed
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292
	<select id="getTPersonnelRoster" resultMap="tPersonnelRosterMap">
		select p.UNIT_NAME as 'CUSTOMER_NAME',p.DEPT_NAME as 'DEPART_NAME',p.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',
				e.EMP_NAME as 'EMP_NAME',e.EMP_SEX as 'EMP_SEX',e.EMP_BIRTHDAY as 'EMP_BIRTH_DATE',e.EMP_AGE as 'EMP_AGE',e.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_TERM',c1.CONTRACT_TYPE as 'SIGN_TYPE',
				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'
		from
			(select  MAX(c.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' and c.IS_OBSOLETE='0'
			 GROUP BY c.DEPT_NO,c.EMP_IDCARD) t
				INNER JOIN t_employee_info e on e.EMP_IDCARD=t.EMP_IDCARD
				INNER JOIN t_employee_project p on p.EMP_IDCARD=t.EMP_IDCARD and p.DEPT_NO=t.DEPT_NO
				INNER JOIN t_settle_domain d on d.DEPART_NO=t.DEPT_NO
				INNER JOIN t_employee_contract_info c1 on c1.id=t.id
		<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)
		from
			(select  MAX(c.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' and c.IS_OBSOLETE='0'
			 GROUP BY c.DEPT_NO,c.EMP_IDCARD) t
				INNER JOIN t_employee_info e on e.EMP_IDCARD=t.EMP_IDCARD
				INNER JOIN t_employee_project p on p.EMP_IDCARD=t.EMP_IDCARD and p.DEPT_NO=t.DEPT_NO
				INNER JOIN t_settle_domain d on d.DEPART_NO=t.DEPT_NO
				INNER JOIN t_employee_contract_info c1 on c1.id=t.id
	</select>
fangxinjiang's avatar
fangxinjiang committed
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318
	<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-->
	<select id="noPageDiy" resultMap="tPersonnelRosterMap">
		select
		<include refid="Base_Column_List"/>
		from t_personnel_roster a
		<where>
			a.DELETE_FLAG = '0'
			<include refid="tPersonnelRoster_where"/>
		</where>
		order by a.CREATE_TIME desc
		<if test="tPersonnelRoster != null">
			<if test="tPersonnelRoster.limitStart != null">
				limit #{tPersonnelRoster.limitStart},#{tPersonnelRoster.limitEnd}
			</if>
		</if>
	</select>
fangxinjiang's avatar
fangxinjiang committed
319
</mapper>