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

  <resultMap id="tPreEmpWorkRecordingMap" type="com.yifu.cloud.plus.v1.yifu.archives.entity.TPreEmpWorkRecording">
    <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="empName" column="EMP_NAME"/>
    <result property="empIdcard" column="EMP_IDCARD"/>
    <result property="workUnit" column="WORK_UNIT"/>
    <result property="workDepart" column="WORK_DEPART"/>
    <result property="workJob" column="WORK_JOB"/>
    <result property="startDate" column="START_DATE"/>
    <result property="endDate" column="END_DATE"/>
    <result property="workingStatus" column="WORKING_STATUS"/>
    <result property="workingType" column="WORKING_TYPE"/>
    <result property="deleteFlag" column="DELETE_FLAG"/>
    <result property="settleDomain" column="SETTLE_DOMAIN"/>
    <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="oldId" column="OLD_ID"/>
  </resultMap>
    <sql id="Base_Column_List">
                a.ID,
                a.PRE_MAIN_ID,
                a.EMP_ID,
                a.EMP_CODE,
                a.EMP_NAME,
                a.EMP_IDCARD,
                a.WORK_UNIT,
                a.WORK_DEPART,
                a.WORK_JOB,
                a.START_DATE,
                a.END_DATE,
                a.WORKING_STATUS,
                a.WORKING_TYPE,
                a.DELETE_FLAG,
                a.SETTLE_DOMAIN,
                a.CREATE_BY,
                a.UPDATE_BY,
                a.CREATE_NAME,
                a.CREATE_TIME,
                a.UPDATE_TIME,
                a.OLD_ID,
                a.REMARK
    </sql>
    <sql id="tPreEmpWorkRecording_where">
        <if test="tPreEmpWorkRecording != null">
                    <if test="tPreEmpWorkRecording.id != null and tPreEmpWorkRecording.id.trim() != ''">
                        AND a.ID = #{tPreEmpWorkRecording.id}
                    </if>
                    <if test="tPreEmpWorkRecording.preMainId != null and tPreEmpWorkRecording.preMainId.trim() != ''">
                        AND a.PRE_MAIN_ID = #{tPreEmpWorkRecording.preMainId}
                    </if>
                    <if test="tPreEmpWorkRecording.empId != null and tPreEmpWorkRecording.empId.trim() != ''">
                        AND a.EMP_ID = #{tPreEmpWorkRecording.empId}
                    </if>
                    <if test="tPreEmpWorkRecording.empCode != null and tPreEmpWorkRecording.empCode.trim() != ''">
                        AND a.EMP_CODE = #{tPreEmpWorkRecording.empCode}
                    </if>
                    <if test="tPreEmpWorkRecording.empName != null and tPreEmpWorkRecording.empName.trim() != ''">
                        AND a.EMP_NAME = #{tPreEmpWorkRecording.empName}
                    </if>
                    <if test="tPreEmpWorkRecording.empIdcard != null and tPreEmpWorkRecording.empIdcard.trim() != ''">
                        AND a.EMP_IDCARD = #{tPreEmpWorkRecording.empIdcard}
                    </if>
                    <if test="tPreEmpWorkRecording.workUnit != null and tPreEmpWorkRecording.workUnit.trim() != ''">
                        AND a.WORK_UNIT = #{tPreEmpWorkRecording.workUnit}
                    </if>
                    <if test="tPreEmpWorkRecording.workDepart != null and tPreEmpWorkRecording.workDepart.trim() != ''">
                        AND a.WORK_DEPART = #{tPreEmpWorkRecording.workDepart}
                    </if>
                    <if test="tPreEmpWorkRecording.workJob != null and tPreEmpWorkRecording.workJob.trim() != ''">
                        AND a.WORK_JOB = #{tPreEmpWorkRecording.workJob}
                    </if>
                    <if test="tPreEmpWorkRecording.startDate != null">
                        AND a.START_DATE = #{tPreEmpWorkRecording.startDate}
                    </if>
                    <if test="tPreEmpWorkRecording.endDate != null">
                        AND a.END_DATE = #{tPreEmpWorkRecording.endDate}
                    </if>
                    <if test="tPreEmpWorkRecording.workingStatus != null and tPreEmpWorkRecording.workingStatus.trim() != ''">
                        AND a.WORKING_STATUS = #{tPreEmpWorkRecording.workingStatus}
                    </if>
                    <if test="tPreEmpWorkRecording.workingType != null and tPreEmpWorkRecording.workingType.trim() != ''">
                        AND a.WORKING_TYPE = #{tPreEmpWorkRecording.workingType}
                    </if>
                    <if test="tPreEmpWorkRecording.deleteFlag != null and tPreEmpWorkRecording.deleteFlag.trim() != ''">
                        AND a.DELETE_FLAG = #{tPreEmpWorkRecording.deleteFlag}
                    </if>
                    <if test="tPreEmpWorkRecording.settleDomain != null and tPreEmpWorkRecording.settleDomain.trim() != ''">
                        AND a.SETTLE_DOMAIN = #{tPreEmpWorkRecording.settleDomain}
                    </if>
                    <if test="tPreEmpWorkRecording.createBy != null and tPreEmpWorkRecording.createBy.trim() != ''">
                        AND a.CREATE_BY = #{tPreEmpWorkRecording.createBy}
                    </if>
                    <if test="tPreEmpWorkRecording.updateBy != null and tPreEmpWorkRecording.updateBy.trim() != ''">
                        AND a.UPDATE_BY = #{tPreEmpWorkRecording.updateBy}
                    </if>
                    <if test="tPreEmpWorkRecording.createName != null and tPreEmpWorkRecording.createName.trim() != ''">
                        AND a.CREATE_NAME = #{tPreEmpWorkRecording.createName}
                    </if>
                    <if test="tPreEmpWorkRecording.createTime != null">
                        AND a.CREATE_TIME = #{tPreEmpWorkRecording.createTime}
                    </if>
                    <if test="tPreEmpWorkRecording.updateTime != null">
                        AND a.UPDATE_TIME = #{tPreEmpWorkRecording.updateTime}
                    </if>
                    <if test="tPreEmpWorkRecording.remark != null and tPreEmpWorkRecording.remark.trim() != ''">
                        AND a.REMARK = #{tPreEmpWorkRecording.remark}
                    </if>
        </if>
    </sql>
    <!--tPreEmpWorkRecording简单分页查询-->
    <select id="getTPreEmpWorkRecordingList" resultMap="tPreEmpWorkRecordingMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_pre_emp_work_recording a
		where PRE_MAIN_ID = #{preMainId}
    </select>

	<delete id="deleteByMainId">
		delete from t_pre_emp_work_recording where PRE_MAIN_ID = #{preMainId}
	</delete>

</mapper>
