<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "mybatis-3-mapper.dtd">
<mapper namespace="com.mortals.xhx.module.attendance.dao.ibatis.AttendanceLeaveRecordDaoImpl">

    <!-- 字段和属性映射 -->
    <resultMap type="AttendanceLeaveRecordEntity" id="AttendanceLeaveRecordEntity-Map">
        <id  property="id" column="id" />
        <result property="leavePersonId" column="leavePersonId" />
        <result property="leavePerson" column="leavePerson" />
        <result property="deptId" column="deptId" />
        <result property="deptName" column="deptName" />
        <result property="phoneNumber" column="phoneNumber" />
        <result property="leaveType" column="leaveType" />
        <result property="startTime" column="startTime" />
        <result property="endTime" column="endTime" />
        <result property="duration" column="duration" />
        <result property="reason" column="reason" />
        <result property="approverId" column="approverId" />
        <result property="approver" column="approver" />
        <result property="attachment" column="attachment" />
        <result property="attachmentPath" column="attachmentPath" />
        <result property="remark" column="remark" />
        <result property="createUserId" column="createUserId" />
        <result property="createTime" column="createTime" />
        <result property="updateUserId" column="updateUserId" />
        <result property="updateTime" column="updateTime" />
        <result property="appealTime" column="appealTime" />
        <result property="auditResult" column="auditResult" />
        <result property="auditDesc" column="auditDesc" />
        <result property="auditTime" column="auditTime" />
        <result property="processStatus" column="processStatus" />

    </resultMap>


    <!-- 表所有列 -->
    <sql id="_columns">
        <trim suffixOverrides="," suffix="">
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('id') or colPickMode == 1 and data.containsKey('id')))">
                a.id,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('leavePersonId') or colPickMode == 1 and data.containsKey('leavePersonId')))">
                a.leavePersonId,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('leavePerson') or colPickMode == 1 and data.containsKey('leavePerson')))">
                a.leavePerson,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('deptId') or colPickMode == 1 and data.containsKey('deptId')))">
                a.deptId,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('deptName') or colPickMode == 1 and data.containsKey('deptName')))">
                a.deptName,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('phoneNumber') or colPickMode == 1 and data.containsKey('phoneNumber')))">
                a.phoneNumber,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('leaveType') or colPickMode == 1 and data.containsKey('leaveType')))">
                a.leaveType,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('startTime') or colPickMode == 1 and data.containsKey('startTime')))">
                a.startTime,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('endTime') or colPickMode == 1 and data.containsKey('endTime')))">
                a.endTime,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('duration') or colPickMode == 1 and data.containsKey('duration')))">
                a.duration,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('reason') or colPickMode == 1 and data.containsKey('reason')))">
                a.reason,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('approverId') or colPickMode == 1 and data.containsKey('approverId')))">
                a.approverId,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('approver') or colPickMode == 1 and data.containsKey('approver')))">
                a.approver,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('attachment') or colPickMode == 1 and data.containsKey('attachment')))">
                a.attachment,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('attachmentPath') or colPickMode == 1 and data.containsKey('attachmentPath')))">
                a.attachmentPath,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('remark') or colPickMode == 1 and data.containsKey('remark')))">
                a.remark,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createUserId') or colPickMode == 1 and data.containsKey('createUserId')))">
                a.createUserId,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createTime') or colPickMode == 1 and data.containsKey('createTime')))">
                a.createTime,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateUserId') or colPickMode == 1 and data.containsKey('updateUserId')))">
                a.updateUserId,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateTime') or colPickMode == 1 and data.containsKey('updateTime')))">
                a.updateTime,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('appealTime') or colPickMode == 1 and data.containsKey('appealTime')))">
                a.appealTime,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('auditResult') or colPickMode == 1 and data.containsKey('auditResult')))">
                a.auditResult,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('auditDesc') or colPickMode == 1 and data.containsKey('auditDesc')))">
                a.auditDesc,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('auditTime') or colPickMode == 1 and data.containsKey('auditTime')))">
                a.auditTime,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('processStatus') or colPickMode == 1 and data.containsKey('processStatus')))">
                a.processStatus,
            </if>
        </trim>
    </sql>
    <!-- 新增 区分主键自增加还是业务插入 -->
    <insert id="insert" parameterType="AttendanceLeaveRecordEntity"  useGeneratedKeys="true" keyProperty="id">
        insert into mortals_xhx_attendance_leave_record
        (leavePersonId,leavePerson,deptId,deptName,phoneNumber,leaveType,startTime,endTime,duration,reason,approverId,approver,attachment,attachmentPath,remark,createUserId,createTime,updateUserId,updateTime,appealTime,auditResult,auditDesc,auditTime,processStatus)
        VALUES
        (#{leavePersonId},#{leavePerson},#{deptId},#{deptName},#{phoneNumber},#{leaveType},#{startTime},#{endTime},#{duration},#{reason},#{approverId},#{approver},#{attachment},#{attachmentPath},#{remark},#{createUserId},#{createTime},#{updateUserId},#{updateTime},#{appealTime},#{auditResult},#{auditDesc},#{auditTime},#{processStatus})
    </insert>

    <!-- 批量新增 -->
    <insert id="insertBatch" parameterType="paramDto">
        insert into mortals_xhx_attendance_leave_record
        (leavePersonId,leavePerson,deptId,deptName,phoneNumber,leaveType,startTime,endTime,duration,reason,approverId,approver,attachment,attachmentPath,remark,createUserId,createTime,updateUserId,updateTime,appealTime,auditResult,auditDesc,auditTime,processStatus)
        VALUES
        <foreach collection="data.dataList" item="item" index="index" separator="," >
            (#{item.leavePersonId},#{item.leavePerson},#{item.deptId},#{item.deptName},#{item.phoneNumber},#{item.leaveType},#{item.startTime},#{item.endTime},#{item.duration},#{item.reason},#{item.approverId},#{item.approver},#{item.attachment},#{item.attachmentPath},#{item.remark},#{item.createUserId},#{item.createTime},#{item.updateUserId},#{item.updateTime},#{item.appealTime},#{item.auditResult},#{item.auditDesc},#{item.auditTime},#{item.processStatus})
        </foreach>
    </insert>


    <!-- 根据ParamDto更新 -->
    <update id="update" parameterType="paramDto">
        update mortals_xhx_attendance_leave_record as a
        set
        <trim suffixOverrides="," suffix="">
            <if test="(colPickMode==0 and data.containsKey('leavePersonId')) or (colPickMode==1 and !data.containsKey('leavePersonId'))">
                a.leavePersonId=#{data.leavePersonId},
            </if>
            <if test="(colPickMode==0 and data.containsKey('leavePersonIdIncrement')) or (colPickMode==1 and !data.containsKey('leavePersonIdIncrement'))">
                a.leavePersonId=ifnull(a.leavePersonId,0) + #{data.leavePersonIdIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('leavePerson')) or (colPickMode==1 and !data.containsKey('leavePerson'))">
                a.leavePerson=#{data.leavePerson},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deptId')) or (colPickMode==1 and !data.containsKey('deptId'))">
                a.deptId=#{data.deptId},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deptIdIncrement')) or (colPickMode==1 and !data.containsKey('deptIdIncrement'))">
                a.deptId=ifnull(a.deptId,0) + #{data.deptIdIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deptName')) or (colPickMode==1 and !data.containsKey('deptName'))">
                a.deptName=#{data.deptName},
            </if>
            <if test="(colPickMode==0 and data.containsKey('phoneNumber')) or (colPickMode==1 and !data.containsKey('phoneNumber'))">
                a.phoneNumber=#{data.phoneNumber},
            </if>
            <if test="(colPickMode==0 and data.containsKey('leaveType')) or (colPickMode==1 and !data.containsKey('leaveType'))">
                a.leaveType=#{data.leaveType},
            </if>
            <if test="(colPickMode==0 and data.containsKey('leaveTypeIncrement')) or (colPickMode==1 and !data.containsKey('leaveTypeIncrement'))">
                a.leaveType=ifnull(a.leaveType,0) + #{data.leaveTypeIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('startTime')) or (colPickMode==1 and !data.containsKey('startTime'))">
                a.startTime=#{data.startTime},
            </if>
            <if test="(colPickMode==0 and data.containsKey('endTime')) or (colPickMode==1 and !data.containsKey('endTime'))">
                a.endTime=#{data.endTime},
            </if>
            <if test="(colPickMode==0 and data.containsKey('duration')) or (colPickMode==1 and !data.containsKey('duration'))">
                a.duration=#{data.duration},
            </if>
            <if test="(colPickMode==0 and data.containsKey('durationIncrement')) or (colPickMode==1 and !data.containsKey('durationIncrement'))">
                a.duration=ifnull(a.duration,0) + #{data.durationIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('reason')) or (colPickMode==1 and !data.containsKey('reason'))">
                a.reason=#{data.reason},
            </if>
            <if test="(colPickMode==0 and data.containsKey('approverId')) or (colPickMode==1 and !data.containsKey('approverId'))">
                a.approverId=#{data.approverId},
            </if>
            <if test="(colPickMode==0 and data.containsKey('approverIdIncrement')) or (colPickMode==1 and !data.containsKey('approverIdIncrement'))">
                a.approverId=ifnull(a.approverId,0) + #{data.approverIdIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('approver')) or (colPickMode==1 and !data.containsKey('approver'))">
                a.approver=#{data.approver},
            </if>
            <if test="(colPickMode==0 and data.containsKey('attachment')) or (colPickMode==1 and !data.containsKey('attachment'))">
                a.attachment=#{data.attachment},
            </if>
            <if test="(colPickMode==0 and data.containsKey('attachmentPath')) or (colPickMode==1 and !data.containsKey('attachmentPath'))">
                a.attachmentPath=#{data.attachmentPath},
            </if>
            <if test="(colPickMode==0 and data.containsKey('remark')) or (colPickMode==1 and !data.containsKey('remark'))">
                a.remark=#{data.remark},
            </if>
            <if test="(colPickMode==0 and data.containsKey('createUserId')) or (colPickMode==1 and !data.containsKey('createUserId'))">
                a.createUserId=#{data.createUserId},
            </if>
            <if test="(colPickMode==0 and data.containsKey('createUserIdIncrement')) or (colPickMode==1 and !data.containsKey('createUserIdIncrement'))">
                a.createUserId=ifnull(a.createUserId,0) + #{data.createUserIdIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('createTime')) or (colPickMode==1 and !data.containsKey('createTime'))">
                a.createTime=#{data.createTime},
            </if>
            <if test="(colPickMode==0 and data.containsKey('updateUserId')) or (colPickMode==1 and !data.containsKey('updateUserId'))">
                a.updateUserId=#{data.updateUserId},
            </if>
            <if test="(colPickMode==0 and data.containsKey('updateUserIdIncrement')) or (colPickMode==1 and !data.containsKey('updateUserIdIncrement'))">
                a.updateUserId=ifnull(a.updateUserId,0) + #{data.updateUserIdIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('updateTime')) or (colPickMode==1 and !data.containsKey('updateTime'))">
                a.updateTime=#{data.updateTime},
            </if>
            <if test="(colPickMode==0 and data.containsKey('appealTime')) or (colPickMode==1 and !data.containsKey('appealTime'))">
                a.appealTime=#{data.appealTime},
            </if>
            <if test="(colPickMode==0 and data.containsKey('auditResult')) or (colPickMode==1 and !data.containsKey('auditResult'))">
                a.auditResult=#{data.auditResult},
            </if>
            <if test="(colPickMode==0 and data.containsKey('auditResultIncrement')) or (colPickMode==1 and !data.containsKey('auditResultIncrement'))">
                a.auditResult=ifnull(a.auditResult,0) + #{data.auditResultIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('auditDesc')) or (colPickMode==1 and !data.containsKey('auditDesc'))">
                a.auditDesc=#{data.auditDesc},
            </if>
            <if test="(colPickMode==0 and data.containsKey('auditTime')) or (colPickMode==1 and !data.containsKey('auditTime'))">
                a.auditTime=#{data.auditTime},
            </if>
            <if test="(colPickMode==0 and data.containsKey('processStatus')) or (colPickMode==1 and !data.containsKey('processStatus'))">
                a.processStatus=#{data.processStatus},
            </if>
            <if test="(colPickMode==0 and data.containsKey('processStatusIncrement')) or (colPickMode==1 and !data.containsKey('processStatusIncrement'))">
                a.processStatus=ifnull(a.processStatus,0) + #{data.processStatusIncrement},
            </if>
        </trim>
        <trim suffixOverrides="where" suffix="">
            where
            <trim prefixOverrides="and" prefix="">
                <include refid="_condition_"/>
            </trim>
        </trim>
    </update>
    <!-- 批量更新 -->
    <update id="updateBatch" parameterType="paramDto">
        update mortals_xhx_attendance_leave_record as a
        <trim prefix="set" suffixOverrides=",">
            <trim prefix="leavePersonId=(case" suffix="ELSE leavePersonId end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('leavePersonId')) or (colPickMode==1 and !item.containsKey('leavePersonId'))">
                            when a.id=#{item.id} then #{item.leavePersonId}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('leavePersonIdIncrement')) or (colPickMode==1 and !item.containsKey('leavePersonIdIncrement'))">
                            when a.id=#{item.id} then ifnull(a.leavePersonId,0) + #{item.leavePersonIdIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="leavePerson=(case" suffix="ELSE leavePerson end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('leavePerson')) or (colPickMode==1 and !item.containsKey('leavePerson'))">
                        when a.id=#{item.id} then #{item.leavePerson}
                    </if>
                </foreach>
            </trim>
            <trim prefix="deptId=(case" suffix="ELSE deptId end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('deptId')) or (colPickMode==1 and !item.containsKey('deptId'))">
                            when a.id=#{item.id} then #{item.deptId}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('deptIdIncrement')) or (colPickMode==1 and !item.containsKey('deptIdIncrement'))">
                            when a.id=#{item.id} then ifnull(a.deptId,0) + #{item.deptIdIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="deptName=(case" suffix="ELSE deptName end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('deptName')) or (colPickMode==1 and !item.containsKey('deptName'))">
                        when a.id=#{item.id} then #{item.deptName}
                    </if>
                </foreach>
            </trim>
            <trim prefix="phoneNumber=(case" suffix="ELSE phoneNumber end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('phoneNumber')) or (colPickMode==1 and !item.containsKey('phoneNumber'))">
                        when a.id=#{item.id} then #{item.phoneNumber}
                    </if>
                </foreach>
            </trim>
            <trim prefix="leaveType=(case" suffix="ELSE leaveType end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('leaveType')) or (colPickMode==1 and !item.containsKey('leaveType'))">
                            when a.id=#{item.id} then #{item.leaveType}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('leaveTypeIncrement')) or (colPickMode==1 and !item.containsKey('leaveTypeIncrement'))">
                            when a.id=#{item.id} then ifnull(a.leaveType,0) + #{item.leaveTypeIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="startTime=(case" suffix="ELSE startTime end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('startTime')) or (colPickMode==1 and !item.containsKey('startTime'))">
                        when a.id=#{item.id} then #{item.startTime}
                    </if>
                </foreach>
            </trim>
            <trim prefix="endTime=(case" suffix="ELSE endTime end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('endTime')) or (colPickMode==1 and !item.containsKey('endTime'))">
                        when a.id=#{item.id} then #{item.endTime}
                    </if>
                </foreach>
            </trim>
            <trim prefix="duration=(case" suffix="ELSE duration end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('duration')) or (colPickMode==1 and !item.containsKey('duration'))">
                            when a.id=#{item.id} then #{item.duration}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('durationIncrement')) or (colPickMode==1 and !item.containsKey('durationIncrement'))">
                            when a.id=#{item.id} then ifnull(a.duration,0) + #{item.durationIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="reason=(case" suffix="ELSE reason end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('reason')) or (colPickMode==1 and !item.containsKey('reason'))">
                        when a.id=#{item.id} then #{item.reason}
                    </if>
                </foreach>
            </trim>
            <trim prefix="approverId=(case" suffix="ELSE approverId end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('approverId')) or (colPickMode==1 and !item.containsKey('approverId'))">
                            when a.id=#{item.id} then #{item.approverId}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('approverIdIncrement')) or (colPickMode==1 and !item.containsKey('approverIdIncrement'))">
                            when a.id=#{item.id} then ifnull(a.approverId,0) + #{item.approverIdIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="approver=(case" suffix="ELSE approver end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('approver')) or (colPickMode==1 and !item.containsKey('approver'))">
                        when a.id=#{item.id} then #{item.approver}
                    </if>
                </foreach>
            </trim>
            <trim prefix="attachment=(case" suffix="ELSE attachment end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('attachment')) or (colPickMode==1 and !item.containsKey('attachment'))">
                        when a.id=#{item.id} then #{item.attachment}
                    </if>
                </foreach>
            </trim>
            <trim prefix="attachmentPath=(case" suffix="ELSE attachmentPath end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('attachmentPath')) or (colPickMode==1 and !item.containsKey('attachmentPath'))">
                        when a.id=#{item.id} then #{item.attachmentPath}
                    </if>
                </foreach>
            </trim>
            <trim prefix="remark=(case" suffix="ELSE remark end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('remark')) or (colPickMode==1 and !item.containsKey('remark'))">
                        when a.id=#{item.id} then #{item.remark}
                    </if>
                </foreach>
            </trim>
            <trim prefix="createUserId=(case" suffix="ELSE createUserId end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('createUserId')) or (colPickMode==1 and !item.containsKey('createUserId'))">
                            when a.id=#{item.id} then #{item.createUserId}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('createUserIdIncrement')) or (colPickMode==1 and !item.containsKey('createUserIdIncrement'))">
                            when a.id=#{item.id} then ifnull(a.createUserId,0) + #{item.createUserIdIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="createTime=(case" suffix="ELSE createTime end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('createTime')) or (colPickMode==1 and !item.containsKey('createTime'))">
                        when a.id=#{item.id} then #{item.createTime}
                    </if>
                </foreach>
            </trim>
            <trim prefix="updateUserId=(case" suffix="ELSE updateUserId end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('updateUserId')) or (colPickMode==1 and !item.containsKey('updateUserId'))">
                            when a.id=#{item.id} then #{item.updateUserId}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('updateUserIdIncrement')) or (colPickMode==1 and !item.containsKey('updateUserIdIncrement'))">
                            when a.id=#{item.id} then ifnull(a.updateUserId,0) + #{item.updateUserIdIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="updateTime=(case" suffix="ELSE updateTime end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('updateTime')) or (colPickMode==1 and !item.containsKey('updateTime'))">
                        when a.id=#{item.id} then #{item.updateTime}
                    </if>
                </foreach>
            </trim>
            <trim prefix="appealTime=(case" suffix="ELSE appealTime end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('appealTime')) or (colPickMode==1 and !item.containsKey('appealTime'))">
                        when a.id=#{item.id} then #{item.appealTime}
                    </if>
                </foreach>
            </trim>
            <trim prefix="auditResult=(case" suffix="ELSE auditResult end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('auditResult')) or (colPickMode==1 and !item.containsKey('auditResult'))">
                            when a.id=#{item.id} then #{item.auditResult}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('auditResultIncrement')) or (colPickMode==1 and !item.containsKey('auditResultIncrement'))">
                            when a.id=#{item.id} then ifnull(a.auditResult,0) + #{item.auditResultIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="auditDesc=(case" suffix="ELSE auditDesc end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('auditDesc')) or (colPickMode==1 and !item.containsKey('auditDesc'))">
                        when a.id=#{item.id} then #{item.auditDesc}
                    </if>
                </foreach>
            </trim>
            <trim prefix="auditTime=(case" suffix="ELSE auditTime end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('auditTime')) or (colPickMode==1 and !item.containsKey('auditTime'))">
                        when a.id=#{item.id} then #{item.auditTime}
                    </if>
                </foreach>
            </trim>
            <trim prefix="processStatus=(case" suffix="ELSE processStatus end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('processStatus')) or (colPickMode==1 and !item.containsKey('processStatus'))">
                            when a.id=#{item.id} then #{item.processStatus}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('processStatusIncrement')) or (colPickMode==1 and !item.containsKey('processStatusIncrement'))">
                            when a.id=#{item.id} then ifnull(a.processStatus,0) + #{item.processStatusIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
        </trim>
        where id in
        <foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")">
            #{item.id}
        </foreach>
    </update>
    <!-- 根据主健查询 -->
    <select id="getByKey" parameterType="paramDto" resultMap="AttendanceLeaveRecordEntity-Map">
        select <include refid="_columns"/>
        from mortals_xhx_attendance_leave_record as a
        where a.id=#{condition.id}
    </select>
    <!-- 根据主健删除 -->
    <delete id="deleteByKey" parameterType="paramDto">
        delete a.* from mortals_xhx_attendance_leave_record as a where a.id=#{condition.id}
    </delete>
    <!-- 根据主健删除一批，针对单一主健有效 -->
    <delete id="deleteByKeys">
        delete from mortals_xhx_attendance_leave_record where id in
        <foreach collection="array" item="item" index="index" open="(" separator="," close=")">
            #{item}
        </foreach>
    </delete>
    <!-- 根据主健列表删除一批，针对单一主健有效 -->
    <delete id="deleteByKeyList">
        delete from mortals_xhx_attendance_leave_record where id in
        <foreach collection="list" item="item" index="index" open="(" separator="," close=")">
            #{item}
        </foreach>
    </delete>

    <!-- 根据对象列表删除一批，针对单一主健有效 -->
    <delete id="deleteByEntityList">
        delete from mortals_xhx_attendance_leave_record where id in
        <foreach collection="list" item="item" index="index" open="(" separator="," close=")">
            #{item.id}
        </foreach>
    </delete>
    <!-- 根据paramDto删除一批 -->
    <delete id="deleteByMap" parameterType="paramDto">
        delete a.* from mortals_xhx_attendance_leave_record as a
        <trim suffixOverrides="where" suffix="">
            where
            <trim prefixOverrides="and" prefix="">
                <include refid="_condition_"/>
            </trim>
        </trim>
    </delete>
    <!-- 获取列表 -->
    <select id="getList" parameterType="paramDto" resultMap="AttendanceLeaveRecordEntity-Map">
        select <include refid="_columns"/>
        from mortals_xhx_attendance_leave_record as a
        <trim suffixOverrides="where" suffix="">
            where
            <trim prefixOverrides="and" prefix="">
                <include refid="_condition_"/>
            </trim>
        </trim>
        <include refid="_orderCols_"/>
    </select>



    <!-- 获取 -->
    <select id="getListCount" parameterType="paramDto" resultType="int">
        select count(1)
        from mortals_xhx_attendance_leave_record as a
        <trim suffixOverrides="where" suffix="">
            where
            <trim prefixOverrides="and" prefix="">
                <include refid="_condition_"/>
            </trim>
        </trim>
    </select>
    <!-- 条件映射 -->
    <sql id="_condition_">
        <if test="condition != null and !condition.isEmpty()">
            <!-- 条件映射-普通条件 -->
            <include refid="_condition_param_">
                <property name="_conditionParam_" value="condition"/>
                <property name="_conditionType_" value="and"/>
            </include>
            <!-- 条件映射-集合之间使用AND，集合中元素使用OR-(list[0].1 or list[0].2) and (list[1].3 or list[1].4) -->
            <if test="condition.containsKey('andConditionList') and !condition.andConditionList.isEmpty()">
                and
                <foreach collection="condition.andConditionList" open="(" close=")" index="index" item="andCondition" separator=" and ">
                    <trim prefixOverrides="or" prefix="(" suffix=")">
                        <include refid="_condition_param_">
                            <property name="_conditionParam_" value="andCondition"/>
                            <property name="_conditionType_" value="or"/>
                        </include>
                    </trim>
                </foreach>
            </if>
            <!-- 条件映射-集合之间使用OR，集合中元素使用AND-(list[0].1 and list[0].2) or (list[1].3 and list[1].4) -->
            <if test="condition.containsKey('orConditionList') and !condition.orConditionList.isEmpty()">
                and
                <foreach collection="condition.orConditionList" open="(" close=")" index="index" item="orCondition" separator=" or ">
                    <trim prefixOverrides="and" prefix="(" suffix=")">
                        <include refid="_condition_param_">
                            <property name="_conditionParam_" value="orCondition"/>
                            <property name="_conditionType_" value="and"/>
                        </include>
                    </trim>
                </foreach>
            </if>
        </if>
    </sql>
    <!-- 条件映射-代参数 -->
    <sql id="_condition_param_">
        <bind name="conditionParamRef" value="${_conditionParam_}"/>
        <if test="conditionParamRef.containsKey('id')">
            <if test="conditionParamRef.id != null">
                ${_conditionType_} a.id=#{${_conditionParam_}.id}
            </if>
        </if>
        <if test="conditionParamRef.containsKey('id')">
            <if test="conditionParamRef.id != null ">
                ${_conditionType_} a.id = #{${_conditionParam_}.id}
            </if>
            <if test="conditionParamRef.id == null">
                ${_conditionType_} a.id is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('idList') and conditionParamRef.idList.size() > 0">
            ${_conditionType_} a.id in
            <foreach collection="conditionParamRef.idList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('idNotList') and conditionParamRef.idNotList.size() > 0">
            ${_conditionType_} a.id not in
            <foreach collection="conditionParamRef.idNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('idStart') and conditionParamRef.idStart != null">
            ${_conditionType_} a.id <![CDATA[ >= ]]> #{${_conditionParam_}.idStart}
        </if>
        <if test="conditionParamRef.containsKey('idEnd') and conditionParamRef.idEnd != null">
            ${_conditionType_} a.id <![CDATA[ <= ]]> #{${_conditionParam_}.idEnd}
        </if>

        <if test="conditionParamRef.containsKey('leavePersonId')">
            <if test="conditionParamRef.leavePersonId != null ">
                ${_conditionType_} a.leavePersonId = #{${_conditionParam_}.leavePersonId}
            </if>
            <if test="conditionParamRef.leavePersonId == null">
                ${_conditionType_} a.leavePersonId is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('leavePersonIdList') and conditionParamRef.leavePersonIdList.size() > 0">
            ${_conditionType_} a.leavePersonId in
            <foreach collection="conditionParamRef.leavePersonIdList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('leavePersonIdNotList') and conditionParamRef.leavePersonIdNotList.size() > 0">
            ${_conditionType_} a.leavePersonId not in
            <foreach collection="conditionParamRef.leavePersonIdNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('leavePersonIdStart') and conditionParamRef.leavePersonIdStart != null">
            ${_conditionType_} a.leavePersonId <![CDATA[ >= ]]> #{${_conditionParam_}.leavePersonIdStart}
        </if>
        <if test="conditionParamRef.containsKey('leavePersonIdEnd') and conditionParamRef.leavePersonIdEnd != null">
            ${_conditionType_} a.leavePersonId <![CDATA[ <= ]]> #{${_conditionParam_}.leavePersonIdEnd}
        </if>


        <if test="conditionParamRef.containsKey('leavePerson')">
            <if test="conditionParamRef.leavePerson != null and conditionParamRef.leavePerson != ''">
                ${_conditionType_} a.leavePerson like #{${_conditionParam_}.leavePerson}
            </if>
            <if test="conditionParamRef.leavePerson == null">
                ${_conditionType_} a.leavePerson is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('leavePersonList') and conditionParamRef.leavePersonList.size() > 0">
            ${_conditionType_} a.leavePerson in
            <foreach collection="conditionParamRef.leavePersonList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('leavePersonNotList') and conditionParamRef.leavePersonNotList.size() > 0">
            ${_conditionType_} a.leavePerson not in
            <foreach collection="conditionParamRef.leavePersonNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('deptId')">
            <if test="conditionParamRef.deptId != null ">
                ${_conditionType_} a.deptId = #{${_conditionParam_}.deptId}
            </if>
            <if test="conditionParamRef.deptId == null">
                ${_conditionType_} a.deptId is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('deptIdList') and conditionParamRef.deptIdList.size() > 0">
            ${_conditionType_} a.deptId in
            <foreach collection="conditionParamRef.deptIdList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('deptIdNotList') and conditionParamRef.deptIdNotList.size() > 0">
            ${_conditionType_} a.deptId not in
            <foreach collection="conditionParamRef.deptIdNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('deptIdStart') and conditionParamRef.deptIdStart != null">
            ${_conditionType_} a.deptId <![CDATA[ >= ]]> #{${_conditionParam_}.deptIdStart}
        </if>
        <if test="conditionParamRef.containsKey('deptIdEnd') and conditionParamRef.deptIdEnd != null">
            ${_conditionType_} a.deptId <![CDATA[ <= ]]> #{${_conditionParam_}.deptIdEnd}
        </if>


        <if test="conditionParamRef.containsKey('deptName')">
            <if test="conditionParamRef.deptName != null and conditionParamRef.deptName != ''">
                ${_conditionType_} a.deptName like #{${_conditionParam_}.deptName}
            </if>
            <if test="conditionParamRef.deptName == null">
                ${_conditionType_} a.deptName is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('deptNameList') and conditionParamRef.deptNameList.size() > 0">
            ${_conditionType_} a.deptName in
            <foreach collection="conditionParamRef.deptNameList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('deptNameNotList') and conditionParamRef.deptNameNotList.size() > 0">
            ${_conditionType_} a.deptName not in
            <foreach collection="conditionParamRef.deptNameNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>

        <if test="conditionParamRef.containsKey('phoneNumber')">
            <if test="conditionParamRef.phoneNumber != null and conditionParamRef.phoneNumber != ''">
                ${_conditionType_} a.phoneNumber like #{${_conditionParam_}.phoneNumber}
            </if>
            <if test="conditionParamRef.phoneNumber == null">
                ${_conditionType_} a.phoneNumber is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('phoneNumberList') and conditionParamRef.phoneNumberList.size() > 0">
            ${_conditionType_} a.phoneNumber in
            <foreach collection="conditionParamRef.phoneNumberList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('phoneNumberNotList') and conditionParamRef.phoneNumberNotList.size() > 0">
            ${_conditionType_} a.phoneNumber not in
            <foreach collection="conditionParamRef.phoneNumberNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('leaveType')">
            <if test="conditionParamRef.leaveType != null ">
                ${_conditionType_} a.leaveType = #{${_conditionParam_}.leaveType}
            </if>
            <if test="conditionParamRef.leaveType == null">
                ${_conditionType_} a.leaveType is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('leaveTypeList') and conditionParamRef.leaveTypeList.size() > 0">
            ${_conditionType_} a.leaveType in
            <foreach collection="conditionParamRef.leaveTypeList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('leaveTypeNotList') and conditionParamRef.leaveTypeNotList.size() > 0">
            ${_conditionType_} a.leaveType not in
            <foreach collection="conditionParamRef.leaveTypeNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('leaveTypeStart') and conditionParamRef.leaveTypeStart != null">
            ${_conditionType_} a.leaveType <![CDATA[ >= ]]> #{${_conditionParam_}.leaveTypeStart}
        </if>
        <if test="conditionParamRef.containsKey('leaveTypeEnd') and conditionParamRef.leaveTypeEnd != null">
            ${_conditionType_} a.leaveType <![CDATA[ <= ]]> #{${_conditionParam_}.leaveTypeEnd}
        </if>


        <if test="conditionParamRef.containsKey('startTime')">
            <if test="conditionParamRef.startTime != null ">
                ${_conditionType_} a.startTime = #{${_conditionParam_}.startTime}
            </if>
            <if test="conditionParamRef.startTime == null">
                ${_conditionType_} a.startTime is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('startTimeStart') and conditionParamRef.startTimeStart != null and conditionParamRef.startTimeStart!=''">
            ${_conditionType_} a.startTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.startTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
        </if>
        <if test="conditionParamRef.containsKey('startTimeEnd') and conditionParamRef.startTimeEnd != null and conditionParamRef.startTimeEnd!=''">
            ${_conditionType_} a.startTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.startTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
        </if>

        <if test="conditionParamRef.containsKey('endTime')">
            <if test="conditionParamRef.endTime != null ">
                ${_conditionType_} a.endTime = #{${_conditionParam_}.endTime}
            </if>
            <if test="conditionParamRef.endTime == null">
                ${_conditionType_} a.endTime is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('endTimeStart') and conditionParamRef.endTimeStart != null and conditionParamRef.endTimeStart!=''">
            ${_conditionType_} a.endTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.endTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
        </if>
        <if test="conditionParamRef.containsKey('endTimeEnd') and conditionParamRef.endTimeEnd != null and conditionParamRef.endTimeEnd!=''">
            ${_conditionType_} a.endTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.endTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
        </if>
        <if test="conditionParamRef.containsKey('duration')">
            <if test="conditionParamRef.duration != null ">
                ${_conditionType_} a.duration = #{${_conditionParam_}.duration}
            </if>
            <if test="conditionParamRef.duration == null">
                ${_conditionType_} a.duration is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('durationList') and conditionParamRef.durationList.size() > 0">
            ${_conditionType_} a.duration in
            <foreach collection="conditionParamRef.durationList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('durationNotList') and conditionParamRef.durationNotList.size() > 0">
            ${_conditionType_} a.duration not in
            <foreach collection="conditionParamRef.durationNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('durationStart') and conditionParamRef.durationStart != null">
            ${_conditionType_} a.duration <![CDATA[ >= ]]> #{${_conditionParam_}.durationStart}
        </if>
        <if test="conditionParamRef.containsKey('durationEnd') and conditionParamRef.durationEnd != null">
            ${_conditionType_} a.duration <![CDATA[ <= ]]> #{${_conditionParam_}.durationEnd}
        </if>


        <if test="conditionParamRef.containsKey('reason')">
            <if test="conditionParamRef.reason != null and conditionParamRef.reason != ''">
                ${_conditionType_} a.reason like #{${_conditionParam_}.reason}
            </if>
            <if test="conditionParamRef.reason == null">
                ${_conditionType_} a.reason is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('reasonList') and conditionParamRef.reasonList.size() > 0">
            ${_conditionType_} a.reason in
            <foreach collection="conditionParamRef.reasonList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('reasonNotList') and conditionParamRef.reasonNotList.size() > 0">
            ${_conditionType_} a.reason not in
            <foreach collection="conditionParamRef.reasonNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('approverId')">
            <if test="conditionParamRef.approverId != null ">
                ${_conditionType_} a.approverId = #{${_conditionParam_}.approverId}
            </if>
            <if test="conditionParamRef.approverId == null">
                ${_conditionType_} a.approverId is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('approverIdList') and conditionParamRef.approverIdList.size() > 0">
            ${_conditionType_} a.approverId in
            <foreach collection="conditionParamRef.approverIdList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('approverIdNotList') and conditionParamRef.approverIdNotList.size() > 0">
            ${_conditionType_} a.approverId not in
            <foreach collection="conditionParamRef.approverIdNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('approverIdStart') and conditionParamRef.approverIdStart != null">
            ${_conditionType_} a.approverId <![CDATA[ >= ]]> #{${_conditionParam_}.approverIdStart}
        </if>
        <if test="conditionParamRef.containsKey('approverIdEnd') and conditionParamRef.approverIdEnd != null">
            ${_conditionType_} a.approverId <![CDATA[ <= ]]> #{${_conditionParam_}.approverIdEnd}
        </if>


        <if test="conditionParamRef.containsKey('approver')">
            <if test="conditionParamRef.approver != null and conditionParamRef.approver != ''">
                ${_conditionType_} a.approver like #{${_conditionParam_}.approver}
            </if>
            <if test="conditionParamRef.approver == null">
                ${_conditionType_} a.approver is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('approverList') and conditionParamRef.approverList.size() > 0">
            ${_conditionType_} a.approver in
            <foreach collection="conditionParamRef.approverList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('approverNotList') and conditionParamRef.approverNotList.size() > 0">
            ${_conditionType_} a.approver not in
            <foreach collection="conditionParamRef.approverNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>

        <if test="conditionParamRef.containsKey('attachment')">
            <if test="conditionParamRef.attachment != null and conditionParamRef.attachment != ''">
                ${_conditionType_} a.attachment like #{${_conditionParam_}.attachment}
            </if>
            <if test="conditionParamRef.attachment == null">
                ${_conditionType_} a.attachment is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('attachmentList') and conditionParamRef.attachmentList.size() > 0">
            ${_conditionType_} a.attachment in
            <foreach collection="conditionParamRef.attachmentList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('attachmentNotList') and conditionParamRef.attachmentNotList.size() > 0">
            ${_conditionType_} a.attachment not in
            <foreach collection="conditionParamRef.attachmentNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>

        <if test="conditionParamRef.containsKey('attachmentPath')">
            <if test="conditionParamRef.attachmentPath != null and conditionParamRef.attachmentPath != ''">
                ${_conditionType_} a.attachmentPath like #{${_conditionParam_}.attachmentPath}
            </if>
            <if test="conditionParamRef.attachmentPath == null">
                ${_conditionType_} a.attachmentPath is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('attachmentPathList') and conditionParamRef.attachmentPathList.size() > 0">
            ${_conditionType_} a.attachmentPath in
            <foreach collection="conditionParamRef.attachmentPathList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('attachmentPathNotList') and conditionParamRef.attachmentPathNotList.size() > 0">
            ${_conditionType_} a.attachmentPath not in
            <foreach collection="conditionParamRef.attachmentPathNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>

        <if test="conditionParamRef.containsKey('remark')">
            <if test="conditionParamRef.remark != null and conditionParamRef.remark != ''">
                ${_conditionType_} a.remark like #{${_conditionParam_}.remark}
            </if>
            <if test="conditionParamRef.remark == null">
                ${_conditionType_} a.remark is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('remarkList') and conditionParamRef.remarkList.size() > 0">
            ${_conditionType_} a.remark in
            <foreach collection="conditionParamRef.remarkList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('remarkNotList') and conditionParamRef.remarkNotList.size() > 0">
            ${_conditionType_} a.remark not in
            <foreach collection="conditionParamRef.remarkNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('createUserId')">
            <if test="conditionParamRef.createUserId != null ">
                ${_conditionType_} a.createUserId = #{${_conditionParam_}.createUserId}
            </if>
            <if test="conditionParamRef.createUserId == null">
                ${_conditionType_} a.createUserId is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('createUserIdList') and conditionParamRef.createUserIdList.size() > 0">
            ${_conditionType_} a.createUserId in
            <foreach collection="conditionParamRef.createUserIdList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('createUserIdNotList') and conditionParamRef.createUserIdNotList.size() > 0">
            ${_conditionType_} a.createUserId not in
            <foreach collection="conditionParamRef.createUserIdNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('createUserIdStart') and conditionParamRef.createUserIdStart != null">
            ${_conditionType_} a.createUserId <![CDATA[ >= ]]> #{${_conditionParam_}.createUserIdStart}
        </if>
        <if test="conditionParamRef.containsKey('createUserIdEnd') and conditionParamRef.createUserIdEnd != null">
            ${_conditionType_} a.createUserId <![CDATA[ <= ]]> #{${_conditionParam_}.createUserIdEnd}
        </if>


        <if test="conditionParamRef.containsKey('createTime')">
            <if test="conditionParamRef.createTime != null ">
                ${_conditionType_} a.createTime = #{${_conditionParam_}.createTime}
            </if>
            <if test="conditionParamRef.createTime == null">
                ${_conditionType_} a.createTime is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('createTimeStart') and conditionParamRef.createTimeStart != null and conditionParamRef.createTimeStart!=''">
            ${_conditionType_} a.createTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.createTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
        </if>
        <if test="conditionParamRef.containsKey('createTimeEnd') and conditionParamRef.createTimeEnd != null and conditionParamRef.createTimeEnd!=''">
            ${_conditionType_} a.createTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.createTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
        </if>
        <if test="conditionParamRef.containsKey('updateUserId')">
            <if test="conditionParamRef.updateUserId != null ">
                ${_conditionType_} a.updateUserId = #{${_conditionParam_}.updateUserId}
            </if>
            <if test="conditionParamRef.updateUserId == null">
                ${_conditionType_} a.updateUserId is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('updateUserIdList') and conditionParamRef.updateUserIdList.size() > 0">
            ${_conditionType_} a.updateUserId in
            <foreach collection="conditionParamRef.updateUserIdList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('updateUserIdNotList') and conditionParamRef.updateUserIdNotList.size() > 0">
            ${_conditionType_} a.updateUserId not in
            <foreach collection="conditionParamRef.updateUserIdNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('updateUserIdStart') and conditionParamRef.updateUserIdStart != null">
            ${_conditionType_} a.updateUserId <![CDATA[ >= ]]> #{${_conditionParam_}.updateUserIdStart}
        </if>
        <if test="conditionParamRef.containsKey('updateUserIdEnd') and conditionParamRef.updateUserIdEnd != null">
            ${_conditionType_} a.updateUserId <![CDATA[ <= ]]> #{${_conditionParam_}.updateUserIdEnd}
        </if>


        <if test="conditionParamRef.containsKey('updateTime')">
            <if test="conditionParamRef.updateTime != null ">
                ${_conditionType_} a.updateTime = #{${_conditionParam_}.updateTime}
            </if>
            <if test="conditionParamRef.updateTime == null">
                ${_conditionType_} a.updateTime is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('updateTimeStart') and conditionParamRef.updateTimeStart != null and conditionParamRef.updateTimeStart!=''">
            ${_conditionType_} a.updateTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
        </if>
        <if test="conditionParamRef.containsKey('updateTimeEnd') and conditionParamRef.updateTimeEnd != null and conditionParamRef.updateTimeEnd!=''">
            ${_conditionType_} a.updateTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
        </if>

        <if test="conditionParamRef.containsKey('appealTime')">
            <if test="conditionParamRef.appealTime != null ">
                ${_conditionType_} a.appealTime = #{${_conditionParam_}.appealTime}
            </if>
            <if test="conditionParamRef.appealTime == null">
                ${_conditionType_} a.appealTime is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('appealTimeStart') and conditionParamRef.appealTimeStart != null and conditionParamRef.appealTimeStart!=''">
            ${_conditionType_} a.appealTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.appealTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
        </if>
        <if test="conditionParamRef.containsKey('appealTimeEnd') and conditionParamRef.appealTimeEnd != null and conditionParamRef.appealTimeEnd!=''">
            ${_conditionType_} a.appealTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.appealTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
        </if>
        <if test="conditionParamRef.containsKey('auditResult')">
            <if test="conditionParamRef.auditResult != null ">
                ${_conditionType_} a.auditResult = #{${_conditionParam_}.auditResult}
            </if>
            <if test="conditionParamRef.auditResult == null">
                ${_conditionType_} a.auditResult is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('auditResultList') and conditionParamRef.auditResultList.size() > 0">
            ${_conditionType_} a.auditResult in
            <foreach collection="conditionParamRef.auditResultList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('auditResultNotList') and conditionParamRef.auditResultNotList.size() > 0">
            ${_conditionType_} a.auditResult not in
            <foreach collection="conditionParamRef.auditResultNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('auditResultStart') and conditionParamRef.auditResultStart != null">
            ${_conditionType_} a.auditResult <![CDATA[ >= ]]> #{${_conditionParam_}.auditResultStart}
        </if>
        <if test="conditionParamRef.containsKey('auditResultEnd') and conditionParamRef.auditResultEnd != null">
            ${_conditionType_} a.auditResult <![CDATA[ <= ]]> #{${_conditionParam_}.auditResultEnd}
        </if>


        <if test="conditionParamRef.containsKey('auditDesc')">
            <if test="conditionParamRef.auditDesc != null and conditionParamRef.auditDesc != ''">
                ${_conditionType_} a.auditDesc like #{${_conditionParam_}.auditDesc}
            </if>
            <if test="conditionParamRef.auditDesc == null">
                ${_conditionType_} a.auditDesc is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('auditDescList') and conditionParamRef.auditDescList.size() > 0">
            ${_conditionType_} a.auditDesc in
            <foreach collection="conditionParamRef.auditDescList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('auditDescNotList') and conditionParamRef.auditDescNotList.size() > 0">
            ${_conditionType_} a.auditDesc not in
            <foreach collection="conditionParamRef.auditDescNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>

        <if test="conditionParamRef.containsKey('auditTime')">
            <if test="conditionParamRef.auditTime != null ">
                ${_conditionType_} a.auditTime = #{${_conditionParam_}.auditTime}
            </if>
            <if test="conditionParamRef.auditTime == null">
                ${_conditionType_} a.auditTime is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('auditTimeStart') and conditionParamRef.auditTimeStart != null and conditionParamRef.auditTimeStart!=''">
            ${_conditionType_} a.auditTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.auditTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
        </if>
        <if test="conditionParamRef.containsKey('auditTimeEnd') and conditionParamRef.auditTimeEnd != null and conditionParamRef.auditTimeEnd!=''">
            ${_conditionType_} a.auditTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.auditTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
        </if>
        <if test="conditionParamRef.containsKey('processStatus')">
            <if test="conditionParamRef.processStatus != null ">
                ${_conditionType_} a.processStatus = #{${_conditionParam_}.processStatus}
            </if>
            <if test="conditionParamRef.processStatus == null">
                ${_conditionType_} a.processStatus is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('processStatusList') and conditionParamRef.processStatusList.size() > 0">
            ${_conditionType_} a.processStatus in
            <foreach collection="conditionParamRef.processStatusList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('processStatusNotList') and conditionParamRef.processStatusNotList.size() > 0">
            ${_conditionType_} a.processStatus not in
            <foreach collection="conditionParamRef.processStatusNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('processStatusStart') and conditionParamRef.processStatusStart != null">
            ${_conditionType_} a.processStatus <![CDATA[ >= ]]> #{${_conditionParam_}.processStatusStart}
        </if>
        <if test="conditionParamRef.containsKey('processStatusEnd') and conditionParamRef.processStatusEnd != null">
            ${_conditionType_} a.processStatus <![CDATA[ <= ]]> #{${_conditionParam_}.processStatusEnd}
        </if>

    </sql>
    <sql id="_orderCols_">
        <if test="orderColList != null and !orderColList.isEmpty()">
            order by
            <trim suffixOverrides=","  suffix="">
                <foreach collection="orderColList" open="" close="" index="index" item="item" separator=",">
                    ${item.colName} ${item.sortKind}
                </foreach>
            </trim>
        </if>
        <if test="(orderColList == null or orderColList.isEmpty()) and orderCol != null and !orderCol.isEmpty()">
            order by
            <trim suffixOverrides=","  suffix="">
                <if test="orderCol.containsKey('id')">
                    a.id
                    <if test='orderCol.id != null and "DESC".equalsIgnoreCase(orderCol.id)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('leavePersonId')">
                    a.leavePersonId
                    <if test='orderCol.leavePersonId != null and "DESC".equalsIgnoreCase(orderCol.leavePersonId)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('leavePerson')">
                    a.leavePerson
                    <if test='orderCol.leavePerson != null and "DESC".equalsIgnoreCase(orderCol.leavePerson)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('deptId')">
                    a.deptId
                    <if test='orderCol.deptId != null and "DESC".equalsIgnoreCase(orderCol.deptId)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('deptName')">
                    a.deptName
                    <if test='orderCol.deptName != null and "DESC".equalsIgnoreCase(orderCol.deptName)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('phoneNumber')">
                    a.phoneNumber
                    <if test='orderCol.phoneNumber != null and "DESC".equalsIgnoreCase(orderCol.phoneNumber)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('leaveType')">
                    a.leaveType
                    <if test='orderCol.leaveType != null and "DESC".equalsIgnoreCase(orderCol.leaveType)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('startTime')">
                    a.startTime
                    <if test='orderCol.startTime != null and "DESC".equalsIgnoreCase(orderCol.startTime)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('endTime')">
                    a.endTime
                    <if test='orderCol.endTime != null and "DESC".equalsIgnoreCase(orderCol.endTime)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('duration')">
                    a.duration
                    <if test='orderCol.duration != null and "DESC".equalsIgnoreCase(orderCol.duration)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('reason')">
                    a.reason
                    <if test='orderCol.reason != null and "DESC".equalsIgnoreCase(orderCol.reason)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('approverId')">
                    a.approverId
                    <if test='orderCol.approverId != null and "DESC".equalsIgnoreCase(orderCol.approverId)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('approver')">
                    a.approver
                    <if test='orderCol.approver != null and "DESC".equalsIgnoreCase(orderCol.approver)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('attachment')">
                    a.attachment
                    <if test='orderCol.attachment != null and "DESC".equalsIgnoreCase(orderCol.attachment)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('attachmentPath')">
                    a.attachmentPath
                    <if test='orderCol.attachmentPath != null and "DESC".equalsIgnoreCase(orderCol.attachmentPath)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('remark')">
                    a.remark
                    <if test='orderCol.remark != null and "DESC".equalsIgnoreCase(orderCol.remark)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('createUserId')">
                    a.createUserId
                    <if test='orderCol.createUserId != null and "DESC".equalsIgnoreCase(orderCol.createUserId)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('createTime')">
                    a.createTime
                    <if test='orderCol.createTime != null and "DESC".equalsIgnoreCase(orderCol.createTime)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('updateUserId')">
                    a.updateUserId
                    <if test='orderCol.updateUserId != null and "DESC".equalsIgnoreCase(orderCol.updateUserId)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('updateTime')">
                    a.updateTime
                    <if test='orderCol.updateTime != null and "DESC".equalsIgnoreCase(orderCol.updateTime)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('appealTime')">
                    a.appealTime
                    <if test='orderCol.appealTime != null and "DESC".equalsIgnoreCase(orderCol.appealTime)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('auditResult')">
                    a.auditResult
                    <if test='orderCol.auditResult != null and "DESC".equalsIgnoreCase(orderCol.auditResult)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('auditDesc')">
                    a.auditDesc
                    <if test='orderCol.auditDesc != null and "DESC".equalsIgnoreCase(orderCol.auditDesc)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('auditTime')">
                    a.auditTime
                    <if test='orderCol.auditTime != null and "DESC".equalsIgnoreCase(orderCol.auditTime)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('processStatus')">
                    a.processStatus
                    <if test='orderCol.processStatus != null and "DESC".equalsIgnoreCase(orderCol.processStatus)'>DESC</if>
                    ,
                </if>
            </trim>
        </if>
    </sql>
    <sql id="_group_by_">
        <if test="groupList != null and !groupList.isEmpty()">
            GROUP BY
            <trim suffixOverrides=","  suffix="">
                <foreach collection="groupList" open="" close="" index="index" item="item" separator=",">
                    ${item}
                </foreach>
            </trim>
        </if>
    </sql>
</mapper>