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

  <resultMap id="tPreEmployeeProjectMap" type="com.yifu.cloud.plus.v1.yifu.archives.entity.TPreEmployeeProject">
    <id property="id" column="ID"/>
    <result property="preMainId" column="PRE_MAIN_ID"/>
    <result property="empId" column="EMP_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="bankName" column="BANK_NAME"/>
    <result property="bankSubName" column="BANK_SUB_NAME"/>
    <result property="bankNo" column="BANK_NO"/>
    <result property="leaveUser" column="LEAVE_USER"/>
    <result property="leaveTime" column="LEAVE_TIME"/>
    <result property="leaveReason" column="LEAVE_REASON"/>
    <result property="leaveRemark" column="LEAVE_REMARK"/>
    <result property="empNo" column="EMP_NO"/>
    <result property="unitId" column="UNIT_ID"/>
    <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="businessPrimaryType" column="BUSINESS_PRIMARY_TYPE"/>
    <result property="businessSecondType" column="BUSINESS_SECOND_TYPE"/>
    <result property="businessThirdType" column="BUSINESS_THIRD_TYPE"/>
    <result property="contractType" column="CONTRACT_TYPE"/>
    <result property="workingHours" column="WORKING_HOURS"/>
    <result property="post" column="POST"/>
    <result property="enjoinDate" column="ENJOIN_DATE"/>
    <result property="tryPeriod" column="TRY_PERIOD"/>
    <result property="projectSource" column="PROJECT_SOURCE"/>
    <result property="taxMonth" column="TAX_MONTH"/>
    <result property="status" column="STATUS"/>
    <result property="projectStatus" column="PROJECT_STATUS"/>
    <result property="contractStatus" column="CONTRACT_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="remark" column="REMARK"/>
    <result property="insuranceStatus" column="INSURANCE_STATUS"/>
    <result property="socialStatus" column="SOCIAL_STATUS"/>
    <result property="fundStatus" column="FUND_STATUS"/>
    <result property="isLeaveEmployee" column="IS_LEAVE_EMPLOYEE"/>
    <result property="socialProvince" column="SOCIAL_PROVINCE"/>
    <result property="socialCity" column="SOCIAL_CITY"/>
    <result property="socialTown" column="SOCIAL_TOWN"/>
    <result property="empLabel" column="EMP_LABEL"/>
	<result property="oldId" column="OLD_ID"/>
  </resultMap>
    <sql id="Base_Column_List">
                a.ID,
                a.PRE_MAIN_ID,
                a.EMP_ID,
                a.EMP_CODE,
                a.EMP_NATRUE,
                a.EMP_NAME,
                a.EMP_IDCARD,
                a.BANK_NAME,
                a.BANK_SUB_NAME,
                a.BANK_NO,
                a.LEAVE_USER,
                a.LEAVE_TIME,
                a.LEAVE_REASON,
                a.LEAVE_REMARK,
                a.EMP_NO,
                a.UNIT_ID,
                a.UNIT_NAME,
                a.UNIT_NO,
                a.DEPT_ID,
                a.DEPT_NAME,
                a.DEPT_NO,
                a.BUSINESS_PRIMARY_TYPE,
                a.BUSINESS_SECOND_TYPE,
                a.BUSINESS_THIRD_TYPE,
                a.CONTRACT_TYPE,
                a.WORKING_HOURS,
                a.POST,
                a.ENJOIN_DATE,
                a.TRY_PERIOD,
                a.PROJECT_SOURCE,
                a.TAX_MONTH,
                a.STATUS,
                a.PROJECT_STATUS,
                a.CONTRACT_STATUS,
                a.SALARY_STATUS,
                a.DELETE_FLAG,
                a.CREATE_BY,
                a.CREATE_NAME,
                a.CREATE_TIME,
                a.UPDATE_BY,
                a.UPDATE_TIME,
                a.REMARK,
                a.INSURANCE_STATUS,
                a.SOCIAL_STATUS,
                a.FUND_STATUS,
                a.IS_LEAVE_EMPLOYEE,
                a.SOCIAL_PROVINCE,
                a.SOCIAL_CITY,
                a.SOCIAL_TOWN,
                a.OLD_ID,
                a.EMP_LABEL
    </sql>
    <sql id="tPreEmployeeProject_where">
        <if test="tPreEmployeeProject != null">
                    <if test="tPreEmployeeProject.id != null and tPreEmployeeProject.id.trim() != ''">
                        AND a.ID = #{tPreEmployeeProject.id}
                    </if>
                    <if test="tPreEmployeeProject.preMainId != null and tPreEmployeeProject.preMainId.trim() != ''">
                        AND a.PRE_MAIN_ID = #{tPreEmployeeProject.preMainId}
                    </if>
                    <if test="tPreEmployeeProject.empId != null and tPreEmployeeProject.empId.trim() != ''">
                        AND a.EMP_ID = #{tPreEmployeeProject.empId}
                    </if>
                    <if test="tPreEmployeeProject.empCode != null and tPreEmployeeProject.empCode.trim() != ''">
                        AND a.EMP_CODE = #{tPreEmployeeProject.empCode}
                    </if>
                    <if test="tPreEmployeeProject.empNatrue != null and tPreEmployeeProject.empNatrue.trim() != ''">
                        AND a.EMP_NATRUE = #{tPreEmployeeProject.empNatrue}
                    </if>
                    <if test="tPreEmployeeProject.empName != null and tPreEmployeeProject.empName.trim() != ''">
                        AND a.EMP_NAME = #{tPreEmployeeProject.empName}
                    </if>
                    <if test="tPreEmployeeProject.empIdcard != null and tPreEmployeeProject.empIdcard.trim() != ''">
                        AND a.EMP_IDCARD = #{tPreEmployeeProject.empIdcard}
                    </if>
                    <if test="tPreEmployeeProject.bankName != null and tPreEmployeeProject.bankName.trim() != ''">
                        AND a.BANK_NAME = #{tPreEmployeeProject.bankName}
                    </if>
                    <if test="tPreEmployeeProject.bankSubName != null and tPreEmployeeProject.bankSubName.trim() != ''">
                        AND a.BANK_SUB_NAME = #{tPreEmployeeProject.bankSubName}
                    </if>
                    <if test="tPreEmployeeProject.bankNo != null and tPreEmployeeProject.bankNo.trim() != ''">
                        AND a.BANK_NO = #{tPreEmployeeProject.bankNo}
                    </if>
                    <if test="tPreEmployeeProject.leaveUser != null and tPreEmployeeProject.leaveUser.trim() != ''">
                        AND a.LEAVE_USER = #{tPreEmployeeProject.leaveUser}
                    </if>
                    <if test="tPreEmployeeProject.leaveTime != null">
                        AND a.LEAVE_TIME = #{tPreEmployeeProject.leaveTime}
                    </if>
                    <if test="tPreEmployeeProject.leaveReason != null and tPreEmployeeProject.leaveReason.trim() != ''">
                        AND a.LEAVE_REASON = #{tPreEmployeeProject.leaveReason}
                    </if>
                    <if test="tPreEmployeeProject.leaveRemark != null and tPreEmployeeProject.leaveRemark.trim() != ''">
                        AND a.LEAVE_REMARK = #{tPreEmployeeProject.leaveRemark}
                    </if>
                    <if test="tPreEmployeeProject.empNo != null and tPreEmployeeProject.empNo.trim() != ''">
                        AND a.EMP_NO = #{tPreEmployeeProject.empNo}
                    </if>
                    <if test="tPreEmployeeProject.unitId != null and tPreEmployeeProject.unitId.trim() != ''">
                        AND a.UNIT_ID = #{tPreEmployeeProject.unitId}
                    </if>
                    <if test="tPreEmployeeProject.unitName != null and tPreEmployeeProject.unitName.trim() != ''">
                        AND a.UNIT_NAME = #{tPreEmployeeProject.unitName}
                    </if>
                    <if test="tPreEmployeeProject.unitNo != null and tPreEmployeeProject.unitNo.trim() != ''">
                        AND a.UNIT_NO = #{tPreEmployeeProject.unitNo}
                    </if>
                    <if test="tPreEmployeeProject.deptId != null and tPreEmployeeProject.deptId.trim() != ''">
                        AND a.DEPT_ID = #{tPreEmployeeProject.deptId}
                    </if>
                    <if test="tPreEmployeeProject.deptName != null and tPreEmployeeProject.deptName.trim() != ''">
                        AND a.DEPT_NAME = #{tPreEmployeeProject.deptName}
                    </if>
                    <if test="tPreEmployeeProject.deptNo != null and tPreEmployeeProject.deptNo.trim() != ''">
                        AND a.DEPT_NO = #{tPreEmployeeProject.deptNo}
                    </if>
                    <if test="tPreEmployeeProject.businessPrimaryType != null and tPreEmployeeProject.businessPrimaryType.trim() != ''">
                        AND a.BUSINESS_PRIMARY_TYPE = #{tPreEmployeeProject.businessPrimaryType}
                    </if>
                    <if test="tPreEmployeeProject.businessSecondType != null and tPreEmployeeProject.businessSecondType.trim() != ''">
                        AND a.BUSINESS_SECOND_TYPE = #{tPreEmployeeProject.businessSecondType}
                    </if>
                    <if test="tPreEmployeeProject.businessThirdType != null and tPreEmployeeProject.businessThirdType.trim() != ''">
                        AND a.BUSINESS_THIRD_TYPE = #{tPreEmployeeProject.businessThirdType}
                    </if>
                    <if test="tPreEmployeeProject.contractType != null and tPreEmployeeProject.contractType.trim() != ''">
                        AND a.CONTRACT_TYPE = #{tPreEmployeeProject.contractType}
                    </if>
                    <if test="tPreEmployeeProject.workingHours != null and tPreEmployeeProject.workingHours.trim() != ''">
                        AND a.WORKING_HOURS = #{tPreEmployeeProject.workingHours}
                    </if>
                    <if test="tPreEmployeeProject.post != null and tPreEmployeeProject.post.trim() != ''">
                        AND a.POST = #{tPreEmployeeProject.post}
                    </if>
                    <if test="tPreEmployeeProject.enjoinDate != null">
                        AND a.ENJOIN_DATE = #{tPreEmployeeProject.enjoinDate}
                    </if>
                    <if test="tPreEmployeeProject.tryPeriod != null and tPreEmployeeProject.tryPeriod.trim() != ''">
                        AND a.TRY_PERIOD = #{tPreEmployeeProject.tryPeriod}
                    </if>
                    <if test="tPreEmployeeProject.projectSource != null and tPreEmployeeProject.projectSource.trim() != ''">
                        AND a.PROJECT_SOURCE = #{tPreEmployeeProject.projectSource}
                    </if>
                    <if test="tPreEmployeeProject.taxMonth != null and tPreEmployeeProject.taxMonth.trim() != ''">
                        AND a.TAX_MONTH = #{tPreEmployeeProject.taxMonth}
                    </if>
                    <if test="tPreEmployeeProject.status != null">
                        AND a.STATUS = #{tPreEmployeeProject.status}
                    </if>
                    <if test="tPreEmployeeProject.projectStatus != null">
                        AND a.PROJECT_STATUS = #{tPreEmployeeProject.projectStatus}
                    </if>
                    <if test="tPreEmployeeProject.contractStatus != null">
                        AND a.CONTRACT_STATUS = #{tPreEmployeeProject.contractStatus}
                    </if>
                    <if test="tPreEmployeeProject.salaryStatus != null">
                        AND a.SALARY_STATUS = #{tPreEmployeeProject.salaryStatus}
                    </if>
                    <if test="tPreEmployeeProject.deleteFlag != null and tPreEmployeeProject.deleteFlag.trim() != ''">
                        AND a.DELETE_FLAG = #{tPreEmployeeProject.deleteFlag}
                    </if>
                    <if test="tPreEmployeeProject.createBy != null and tPreEmployeeProject.createBy.trim() != ''">
                        AND a.CREATE_BY = #{tPreEmployeeProject.createBy}
                    </if>
                    <if test="tPreEmployeeProject.createName != null and tPreEmployeeProject.createName.trim() != ''">
                        AND a.CREATE_NAME = #{tPreEmployeeProject.createName}
                    </if>
                    <if test="tPreEmployeeProject.createTime != null">
                        AND a.CREATE_TIME = #{tPreEmployeeProject.createTime}
                    </if>
                    <if test="tPreEmployeeProject.updateBy != null and tPreEmployeeProject.updateBy.trim() != ''">
                        AND a.UPDATE_BY = #{tPreEmployeeProject.updateBy}
                    </if>
                    <if test="tPreEmployeeProject.updateTime != null">
                        AND a.UPDATE_TIME = #{tPreEmployeeProject.updateTime}
                    </if>
                    <if test="tPreEmployeeProject.remark != null and tPreEmployeeProject.remark.trim() != ''">
                        AND a.REMARK = #{tPreEmployeeProject.remark}
                    </if>
                    <if test="tPreEmployeeProject.insuranceStatus != null">
                        AND a.INSURANCE_STATUS = #{tPreEmployeeProject.insuranceStatus}
                    </if>
                    <if test="tPreEmployeeProject.socialStatus != null">
                        AND a.SOCIAL_STATUS = #{tPreEmployeeProject.socialStatus}
                    </if>
                    <if test="tPreEmployeeProject.fundStatus != null">
                        AND a.FUND_STATUS = #{tPreEmployeeProject.fundStatus}
                    </if>
                    <if test="tPreEmployeeProject.isLeaveEmployee != null">
                        AND a.IS_LEAVE_EMPLOYEE = #{tPreEmployeeProject.isLeaveEmployee}
                    </if>
                    <if test="tPreEmployeeProject.socialProvince != null">
                        AND a.SOCIAL_PROVINCE = #{tPreEmployeeProject.socialProvince}
                    </if>
                    <if test="tPreEmployeeProject.socialCity != null">
                        AND a.SOCIAL_CITY = #{tPreEmployeeProject.socialCity}
                    </if>
                    <if test="tPreEmployeeProject.socialTown != null">
                        AND a.SOCIAL_TOWN = #{tPreEmployeeProject.socialTown}
                    </if>
                    <if test="tPreEmployeeProject.empLabel != null and tPreEmployeeProject.empLabel.trim() != ''">
                        AND a.EMP_LABEL = #{tPreEmployeeProject.empLabel}
                    </if>
        </if>
    </sql>
    <!--tPreEmployeeProject简单分页查询-->
    <select id="getTPreEmployeeProjectList" resultMap="tPreEmployeeProjectMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_pre_employee_project a
		where PRE_MAIN_ID = #{preMainId}
		limit 1
    </select>
</mapper>