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

  <resultMap id="tPreEmpEducationMap" type="com.yifu.cloud.plus.v1.yifu.archives.entity.TPreEmpEducation">
    <id property="id" column="ID"/>
    <result property="preMainId" column="PRE_MAIN_ID"/>
    <result property="empId" column="EMP_ID"/>
    <result property="empName" column="EMP_NAME"/>
    <result property="empCode" column="EMP_CODE"/>
    <result property="empIdcard" column="EMP_IDCARD"/>
    <result property="entryDate" column="ENTRY_DATE"/>
    <result property="educationName" column="EDUCATION_NAME"/>
    <result property="gradutionDate" column="GRADUTION_DATE"/>
    <result property="school" column="SCHOOL"/>
    <result property="educationSystem" column="EDUCATION_SYSTEM"/>
    <result property="highIdentification" column="HIGH_IDENTIFICATION"/>
    <result property="type" column="TYPE"/>
    <result property="collageSystem" column="COLLAGE_SYSTEM"/>
    <result property="deleteFlag" column="DELETE_FLAG"/>
    <result property="settleDomain" column="SETTLE_DOMAIN"/>
    <result property="dispatchFlag" column="DISPATCH_FLAG"/>
    <result property="createBy" column="CREATE_BY"/>
    <result property="updateBy" column="UPDATE_BY"/>
    <result property="createName" column="CREATE_NAME"/>
    <result property="createTime" column="CREATE_TIME"/>
    <result property="updateTime" column="UPDATE_TIME"/>
    <result property="remark" column="REMARK"/>
    <result property="certificationName" column="CERTIFICATION_NAME"/>
    <result property="major" column="MAJOR"/>
	  <result property="oldId" column="OLD_ID"/>
  </resultMap>
    <sql id="Base_Column_List">
                a.ID,
                a.PRE_MAIN_ID,
                a.EMP_ID,
                a.EMP_NAME,
                a.EMP_CODE,
                a.EMP_IDCARD,
                a.ENTRY_DATE,
                a.EDUCATION_NAME,
                a.GRADUTION_DATE,
                a.SCHOOL,
                a.EDUCATION_SYSTEM,
                a.HIGH_IDENTIFICATION,
                a.TYPE,
                a.COLLAGE_SYSTEM,
                a.DELETE_FLAG,
                a.SETTLE_DOMAIN,
                a.DISPATCH_FLAG,
                a.CREATE_BY,
                a.UPDATE_BY,
                a.CREATE_NAME,
                a.CREATE_TIME,
                a.UPDATE_TIME,
                a.REMARK,
                a.CERTIFICATION_NAME,
                a.OLD_ID,
                a.MAJOR
    </sql>
    <sql id="tPreEmpEducation_where">
        <if test="tPreEmpEducation != null">
                    <if test="tPreEmpEducation.id != null and tPreEmpEducation.id.trim() != ''">
                        AND a.ID = #{tPreEmpEducation.id}
                    </if>
                    <if test="tPreEmpEducation.preMainId != null and tPreEmpEducation.preMainId.trim() != ''">
                        AND a.PRE_MAIN_ID = #{tPreEmpEducation.preMainId}
                    </if>
                    <if test="tPreEmpEducation.empId != null and tPreEmpEducation.empId.trim() != ''">
                        AND a.EMP_ID = #{tPreEmpEducation.empId}
                    </if>
                    <if test="tPreEmpEducation.empName != null and tPreEmpEducation.empName.trim() != ''">
                        AND a.EMP_NAME = #{tPreEmpEducation.empName}
                    </if>
                    <if test="tPreEmpEducation.empCode != null and tPreEmpEducation.empCode.trim() != ''">
                        AND a.EMP_CODE = #{tPreEmpEducation.empCode}
                    </if>
                    <if test="tPreEmpEducation.empIdcard != null and tPreEmpEducation.empIdcard.trim() != ''">
                        AND a.EMP_IDCARD = #{tPreEmpEducation.empIdcard}
                    </if>
                    <if test="tPreEmpEducation.entryDate != null">
                        AND a.ENTRY_DATE = #{tPreEmpEducation.entryDate}
                    </if>
                    <if test="tPreEmpEducation.educationName != null and tPreEmpEducation.educationName.trim() != ''">
                        AND a.EDUCATION_NAME = #{tPreEmpEducation.educationName}
                    </if>
                    <if test="tPreEmpEducation.gradutionDate != null">
                        AND a.GRADUTION_DATE = #{tPreEmpEducation.gradutionDate}
                    </if>
                    <if test="tPreEmpEducation.school != null and tPreEmpEducation.school.trim() != ''">
                        AND a.SCHOOL = #{tPreEmpEducation.school}
                    </if>
                    <if test="tPreEmpEducation.educationSystem != null and tPreEmpEducation.educationSystem.trim() != ''">
                        AND a.EDUCATION_SYSTEM = #{tPreEmpEducation.educationSystem}
                    </if>
                    <if test="tPreEmpEducation.highIdentification != null and tPreEmpEducation.highIdentification.trim() != ''">
                        AND a.HIGH_IDENTIFICATION = #{tPreEmpEducation.highIdentification}
                    </if>
                    <if test="tPreEmpEducation.type != null and tPreEmpEducation.type.trim() != ''">
                        AND a.TYPE = #{tPreEmpEducation.type}
                    </if>
                    <if test="tPreEmpEducation.collageSystem != null and tPreEmpEducation.collageSystem.trim() != ''">
                        AND a.COLLAGE_SYSTEM = #{tPreEmpEducation.collageSystem}
                    </if>
                    <if test="tPreEmpEducation.deleteFlag != null and tPreEmpEducation.deleteFlag.trim() != ''">
                        AND a.DELETE_FLAG = #{tPreEmpEducation.deleteFlag}
                    </if>
                    <if test="tPreEmpEducation.settleDomain != null and tPreEmpEducation.settleDomain.trim() != ''">
                        AND a.SETTLE_DOMAIN = #{tPreEmpEducation.settleDomain}
                    </if>
                    <if test="tPreEmpEducation.dispatchFlag != null and tPreEmpEducation.dispatchFlag.trim() != ''">
                        AND a.DISPATCH_FLAG = #{tPreEmpEducation.dispatchFlag}
                    </if>
                    <if test="tPreEmpEducation.createBy != null and tPreEmpEducation.createBy.trim() != ''">
                        AND a.CREATE_BY = #{tPreEmpEducation.createBy}
                    </if>
                    <if test="tPreEmpEducation.updateBy != null and tPreEmpEducation.updateBy.trim() != ''">
                        AND a.UPDATE_BY = #{tPreEmpEducation.updateBy}
                    </if>
                    <if test="tPreEmpEducation.createName != null and tPreEmpEducation.createName.trim() != ''">
                        AND a.CREATE_NAME = #{tPreEmpEducation.createName}
                    </if>
                    <if test="tPreEmpEducation.createTime != null">
                        AND a.CREATE_TIME = #{tPreEmpEducation.createTime}
                    </if>
                    <if test="tPreEmpEducation.updateTime != null">
                        AND a.UPDATE_TIME = #{tPreEmpEducation.updateTime}
                    </if>
                    <if test="tPreEmpEducation.remark != null and tPreEmpEducation.remark.trim() != ''">
                        AND a.REMARK = #{tPreEmpEducation.remark}
                    </if>
                    <if test="tPreEmpEducation.certificationName != null and tPreEmpEducation.certificationName.trim() != ''">
                        AND a.CERTIFICATION_NAME = #{tPreEmpEducation.certificationName}
                    </if>
                    <if test="tPreEmpEducation.major != null and tPreEmpEducation.major.trim() != ''">
                        AND a.MAJOR = #{tPreEmpEducation.major}
                    </if>
        </if>
    </sql>
    <!--tPreEmpEducation简单分页查询-->
    <select id="getTPreEmpEducationList" resultMap="tPreEmpEducationMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_pre_emp_education a
		where PRE_MAIN_ID = #{preMainId} order by a.create_time desc
		limit 1
    </select>
</mapper>
