<?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.TPreEmployeeInfoMapper">

  <resultMap id="tPreEmployeeInfoMap" type="com.yifu.cloud.plus.v1.yifu.archives.entity.TPreEmployeeInfo">
    <id property="id" column="ID"/>
    <result property="preMainId" column="PRE_MAIN_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"/>
    <result property="firstWorkFlag" column="FIRST_WORK_FLAG"/>
    <result property="haveQualification" column="HAVE_QUALIFICATION"/>
	  <result property="oldId" column="OLD_ID"/>

	  <result property="bankName" column="BANK_NAME"/>
	  <result property="bankSubName" column="BANK_SUB_NAME"/>
	  <result property="bankNo" column="BANK_NO"/>
	  <result property="invoiceTitle" column="INVOICE_TITLE"/>
	  <result property="bankProvince" column="BANK_PROVINCE"/>
	  <result property="bankCity" column="BANK_CITY"/>
	  <result property="taxMonth" column="TAX_MONTH"/>
	  <result property="contactProvince" column="CONTACT_PROVINCE"/>
	  <result property="contactCity" column="CONTACT_CITY"/>
	  <result property="contactTown" column="CONTACT_TOWN"/>
	  <result property="taxMonthFlag" column="TAX_MONTH_FLAG"/>

  </resultMap>
    <sql id="Base_Column_List">
                a.ID,
                a.PRE_MAIN_ID,
                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,
                a.LEAVE_USER_NAME,
                a.LEAVE_TIME,
                a.LEAVE_REASON,
                a.LEAVE_REMARK,
                a.CONTACT_ADDRESS,
                a.FIRST_WORK_FLAG,
                a.OLD_ID,
                a.HAVE_QUALIFICATION,

                a.BANK_NAME,
                a.BANK_SUB_NAME,
                a.BANK_NO,
                a.INVOICE_TITLE,
                a.BANK_PROVINCE,
                a.BANK_CITY,
                a.TAX_MONTH,
                a.CONTACT_PROVINCE,
                a.CONTACT_CITY,
                a.CONTACT_TOWN,
                a.TAX_MONTH_FLAG
    </sql>
    <sql id="tPreEmployeeInfo_where">
        <if test="tPreEmployeeInfo != null">
                    <if test="tPreEmployeeInfo.id != null and tPreEmployeeInfo.id.trim() != ''">
                        AND a.ID = #{tPreEmployeeInfo.id}
                    </if>
                    <if test="tPreEmployeeInfo.preMainId != null and tPreEmployeeInfo.preMainId.trim() != ''">
                        AND a.PRE_MAIN_ID = #{tPreEmployeeInfo.preMainId}
                    </if>
                    <if test="tPreEmployeeInfo.empCode != null and tPreEmployeeInfo.empCode.trim() != ''">
                        AND a.EMP_CODE = #{tPreEmployeeInfo.empCode}
                    </if>
                    <if test="tPreEmployeeInfo.empNatrue != null and tPreEmployeeInfo.empNatrue.trim() != ''">
                        AND a.EMP_NATRUE = #{tPreEmployeeInfo.empNatrue}
                    </if>
                    <if test="tPreEmployeeInfo.empName != null and tPreEmployeeInfo.empName.trim() != ''">
                        AND a.EMP_NAME = #{tPreEmployeeInfo.empName}
                    </if>
                    <if test="tPreEmployeeInfo.empIdcard != null and tPreEmployeeInfo.empIdcard.trim() != ''">
                        AND a.EMP_IDCARD = #{tPreEmployeeInfo.empIdcard}
                    </if>
                    <if test="tPreEmployeeInfo.validityStart != null">
                        AND a.VALIDITY_START = #{tPreEmployeeInfo.validityStart}
                    </if>
                    <if test="tPreEmployeeInfo.validityEnd != null">
                        AND a.VALIDITY_END = #{tPreEmployeeInfo.validityEnd}
                    </if>
                    <if test="tPreEmployeeInfo.empSex != null and tPreEmployeeInfo.empSex.trim() != ''">
                        AND a.EMP_SEX = #{tPreEmployeeInfo.empSex}
                    </if>
                    <if test="tPreEmployeeInfo.empBirthday != null">
                        AND a.EMP_BIRTHDAY = #{tPreEmployeeInfo.empBirthday}
                    </if>
                    <if test="tPreEmployeeInfo.empAge != null">
                        AND a.EMP_AGE = #{tPreEmployeeInfo.empAge}
                    </if>
                    <if test="tPreEmployeeInfo.empMarriStatus != null and tPreEmployeeInfo.empMarriStatus.trim() != ''">
                        AND a.EMP_MARRI_STATUS = #{tPreEmployeeInfo.empMarriStatus}
                    </if>
                    <if test="tPreEmployeeInfo.empNational != null and tPreEmployeeInfo.empNational.trim() != ''">
                        AND a.EMP_NATIONAL = #{tPreEmployeeInfo.empNational}
                    </if>
                    <if test="tPreEmployeeInfo.politicalStatus != null and tPreEmployeeInfo.politicalStatus.trim() != ''">
                        AND a.POLITICAL_STATUS = #{tPreEmployeeInfo.politicalStatus}
                    </if>
                    <if test="tPreEmployeeInfo.empEmail != null and tPreEmployeeInfo.empEmail.trim() != ''">
                        AND a.EMP_EMAIL = #{tPreEmployeeInfo.empEmail}
                    </if>
                    <if test="tPreEmployeeInfo.empPhone != null and tPreEmployeeInfo.empPhone.trim() != ''">
                        AND a.EMP_PHONE = #{tPreEmployeeInfo.empPhone}
                    </if>
                    <if test="tPreEmployeeInfo.idProvince != null">
                        AND a.ID_PROVINCE = #{tPreEmployeeInfo.idProvince}
                    </if>
                    <if test="tPreEmployeeInfo.idCity != null">
                        AND a.ID_CITY = #{tPreEmployeeInfo.idCity}
                    </if>
                    <if test="tPreEmployeeInfo.idTown != null">
                        AND a.ID_TOWN = #{tPreEmployeeInfo.idTown}
                    </if>
                    <if test="tPreEmployeeInfo.empRegisType != null and tPreEmployeeInfo.empRegisType.trim() != ''">
                        AND a.EMP_REGIS_TYPE = #{tPreEmployeeInfo.empRegisType}
                    </if>
                    <if test="tPreEmployeeInfo.fileProvince != null">
                        AND a.FILE_PROVINCE = #{tPreEmployeeInfo.fileProvince}
                    </if>
                    <if test="tPreEmployeeInfo.fileCity != null">
                        AND a.FILE_CITY = #{tPreEmployeeInfo.fileCity}
                    </if>
                    <if test="tPreEmployeeInfo.fileTown != null">
                        AND a.FILE_TOWN = #{tPreEmployeeInfo.fileTown}
                    </if>
                    <if test="tPreEmployeeInfo.isCollege != null">
                        AND a.IS_COLLEGE = #{tPreEmployeeInfo.isCollege}
                    </if>
                    <if test="tPreEmployeeInfo.hignEducation != null and tPreEmployeeInfo.hignEducation.trim() != ''">
                        AND a.HIGN_EDUCATION = #{tPreEmployeeInfo.hignEducation}
                    </if>
                    <if test="tPreEmployeeInfo.school != null and tPreEmployeeInfo.school.trim() != ''">
                        AND a.SCHOOL = #{tPreEmployeeInfo.school}
                    </if>
                    <if test="tPreEmployeeInfo.major != null and tPreEmployeeInfo.major.trim() != ''">
                        AND a.MAJOR = #{tPreEmployeeInfo.major}
                    </if>
                    <if test="tPreEmployeeInfo.admissionDate != null">
                        AND a.ADMISSION_DATE = #{tPreEmployeeInfo.admissionDate}
                    </if>
                    <if test="tPreEmployeeInfo.gradutionDate != null">
                        AND a.GRADUTION_DATE = #{tPreEmployeeInfo.gradutionDate}
                    </if>
                    <if test="tPreEmployeeInfo.remark != null and tPreEmployeeInfo.remark.trim() != ''">
                        AND a.REMARK = #{tPreEmployeeInfo.remark}
                    </if>
                    <if test="tPreEmployeeInfo.fileSource != null and tPreEmployeeInfo.fileSource.trim() != ''">
                        AND a.FILE_SOURCE = #{tPreEmployeeInfo.fileSource}
                    </if>
                    <if test="tPreEmployeeInfo.status != null">
                        AND a.STATUS = #{tPreEmployeeInfo.status}
                    </if>
                    <if test="tPreEmployeeInfo.fileStatus != null">
                        AND a.FILE_STATUS = #{tPreEmployeeInfo.fileStatus}
                    </if>
                    <if test="tPreEmployeeInfo.projectNum != null">
                        AND a.PROJECT_NUM = #{tPreEmployeeInfo.projectNum}
                    </if>
                    <if test="tPreEmployeeInfo.contractStatus != null">
                        AND a.CONTRACT_STATUS = #{tPreEmployeeInfo.contractStatus}
                    </if>
                    <if test="tPreEmployeeInfo.insuranceStatus != null">
                        AND a.INSURANCE_STATUS = #{tPreEmployeeInfo.insuranceStatus}
                    </if>
                    <if test="tPreEmployeeInfo.socialStatus != null">
                        AND a.SOCIAL_STATUS = #{tPreEmployeeInfo.socialStatus}
                    </if>
                    <if test="tPreEmployeeInfo.fundStatus != null">
                        AND a.FUND_STATUS = #{tPreEmployeeInfo.fundStatus}
                    </if>
                    <if test="tPreEmployeeInfo.salaryStatus != null">
                        AND a.SALARY_STATUS = #{tPreEmployeeInfo.salaryStatus}
                    </if>
                    <if test="tPreEmployeeInfo.deleteFlag != null and tPreEmployeeInfo.deleteFlag.trim() != ''">
                        AND a.DELETE_FLAG = #{tPreEmployeeInfo.deleteFlag}
                    </if>
                    <if test="tPreEmployeeInfo.createBy != null and tPreEmployeeInfo.createBy.trim() != ''">
                        AND a.CREATE_BY = #{tPreEmployeeInfo.createBy}
                    </if>
                    <if test="tPreEmployeeInfo.createName != null and tPreEmployeeInfo.createName.trim() != ''">
                        AND a.CREATE_NAME = #{tPreEmployeeInfo.createName}
                    </if>
                    <if test="tPreEmployeeInfo.createTime != null">
                        AND a.CREATE_TIME = #{tPreEmployeeInfo.createTime}
                    </if>
                    <if test="tPreEmployeeInfo.updateBy != null and tPreEmployeeInfo.updateBy.trim() != ''">
                        AND a.UPDATE_BY = #{tPreEmployeeInfo.updateBy}
                    </if>
                    <if test="tPreEmployeeInfo.updateTime != null">
                        AND a.UPDATE_TIME = #{tPreEmployeeInfo.updateTime}
                    </if>
                    <if test="tPreEmployeeInfo.leaveUser != null and tPreEmployeeInfo.leaveUser.trim() != ''">
                        AND a.LEAVE_USER = #{tPreEmployeeInfo.leaveUser}
                    </if>
                    <if test="tPreEmployeeInfo.leaveUserName != null and tPreEmployeeInfo.leaveUserName.trim() != ''">
                        AND a.LEAVE_USER_NAME = #{tPreEmployeeInfo.leaveUserName}
                    </if>
                    <if test="tPreEmployeeInfo.leaveTime != null">
                        AND a.LEAVE_TIME = #{tPreEmployeeInfo.leaveTime}
                    </if>
                    <if test="tPreEmployeeInfo.leaveReason != null and tPreEmployeeInfo.leaveReason.trim() != ''">
                        AND a.LEAVE_REASON = #{tPreEmployeeInfo.leaveReason}
                    </if>
                    <if test="tPreEmployeeInfo.leaveRemark != null and tPreEmployeeInfo.leaveRemark.trim() != ''">
                        AND a.LEAVE_REMARK = #{tPreEmployeeInfo.leaveRemark}
                    </if>
                    <if test="tPreEmployeeInfo.contactAddress != null and tPreEmployeeInfo.contactAddress.trim() != ''">
                        AND a.CONTACT_ADDRESS = #{tPreEmployeeInfo.contactAddress}
                    </if>
        </if>
    </sql>
    <!--tPreEmployeeInfo简单分页查询-->
    <select id="getTPreEmployeeInfoList" resultMap="tPreEmployeeInfoMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_pre_employee_info a
		where PRE_MAIN_ID = #{preMainId} order by a.create_time desc
		limit 1
    </select>
</mapper>
