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

    <!-- 字段和属性映射 -->
    <resultMap type="AttendanceRecordErrorEntity" id="AttendanceRecordErrorEntity-Map">
            <id  property="id" column="id" />
            <result property="staffId" column="staffId" />
            <result property="staffName" column="staffName" />
            <result property="workNum" column="workNum" />
            <result property="deptId" column="deptId" />
            <result property="deptName" column="deptName" />
            <result property="positionId" column="positionId" />
            <result property="positionName" column="positionName" />
            <result property="attendanceGroupId" column="attendanceGroupId" />
            <result property="attendanceGroupName" column="attendanceGroupName" />
            <result property="shiftsId" column="shiftsId" />
            <result property="shiftsName" column="shiftsName" />
            <result property="goOffDateTime" column="goOffDateTime" />
            <result property="errorDateTime" column="errorDateTime" />
            <result property="actualAttendanceDateTime" column="actualAttendanceDateTime" />
            <result property="operDateTime" column="operDateTime" />
            <result property="opertor" column="opertor" />
            <result property="errorStatus" column="errorStatus" />
            <result property="processStatus" column="processStatus" />
            <result property="processResult" column="processResult" />
            <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" />
            
    </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('staffId') or colPickMode == 1 and data.containsKey('staffId')))">
                    a.staffId,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('staffName') or colPickMode == 1 and data.containsKey('staffName')))">
                    a.staffName,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('workNum') or colPickMode == 1 and data.containsKey('workNum')))">
                    a.workNum,
                </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('positionId') or colPickMode == 1 and data.containsKey('positionId')))">
                    a.positionId,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('positionName') or colPickMode == 1 and data.containsKey('positionName')))">
                    a.positionName,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('attendanceGroupId') or colPickMode == 1 and data.containsKey('attendanceGroupId')))">
                    a.attendanceGroupId,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('attendanceGroupName') or colPickMode == 1 and data.containsKey('attendanceGroupName')))">
                    a.attendanceGroupName,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('shiftsId') or colPickMode == 1 and data.containsKey('shiftsId')))">
                    a.shiftsId,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('shiftsName') or colPickMode == 1 and data.containsKey('shiftsName')))">
                    a.shiftsName,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('goOffDateTime') or colPickMode == 1 and data.containsKey('goOffDateTime')))">
                    a.goOffDateTime,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('errorDateTime') or colPickMode == 1 and data.containsKey('errorDateTime')))">
                    a.errorDateTime,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('actualAttendanceDateTime') or colPickMode == 1 and data.containsKey('actualAttendanceDateTime')))">
                    a.actualAttendanceDateTime,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('operDateTime') or colPickMode == 1 and data.containsKey('operDateTime')))">
                    a.operDateTime,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('opertor') or colPickMode == 1 and data.containsKey('opertor')))">
                    a.opertor,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('errorStatus') or colPickMode == 1 and data.containsKey('errorStatus')))">
                    a.errorStatus,
                </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>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('processResult') or colPickMode == 1 and data.containsKey('processResult')))">
                    a.processResult,
                </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>
        </trim>
    </sql>
    <!-- 新增 区分主键自增加还是业务插入 -->
    <insert id="insert" parameterType="AttendanceRecordErrorEntity"  useGeneratedKeys="true" keyProperty="id">
        insert into mortals_xhx_attendance_record_error
        (staffId,staffName,workNum,deptId,deptName,positionId,positionName,attendanceGroupId,attendanceGroupName,shiftsId,shiftsName,goOffDateTime,errorDateTime,actualAttendanceDateTime,operDateTime,opertor,errorStatus,processStatus,processResult,remark,createUserId,createTime,updateUserId,updateTime)
        VALUES
        (#{staffId},#{staffName},#{workNum},#{deptId},#{deptName},#{positionId},#{positionName},#{attendanceGroupId},#{attendanceGroupName},#{shiftsId},#{shiftsName},#{goOffDateTime},#{errorDateTime},#{actualAttendanceDateTime},#{operDateTime},#{opertor},#{errorStatus},#{processStatus},#{processResult},#{remark},#{createUserId},#{createTime},#{updateUserId},#{updateTime})
    </insert>

    <!-- 批量新增 -->
    <insert id="insertBatch" parameterType="paramDto">
        insert into mortals_xhx_attendance_record_error
        (staffId,staffName,workNum,deptId,deptName,positionId,positionName,attendanceGroupId,attendanceGroupName,shiftsId,shiftsName,goOffDateTime,errorDateTime,actualAttendanceDateTime,operDateTime,opertor,errorStatus,processStatus,processResult,remark,createUserId,createTime,updateUserId,updateTime)
        VALUES
        <foreach collection="data.dataList" item="item" index="index" separator="," >
            (#{item.staffId},#{item.staffName},#{item.workNum},#{item.deptId},#{item.deptName},#{item.positionId},#{item.positionName},#{item.attendanceGroupId},#{item.attendanceGroupName},#{item.shiftsId},#{item.shiftsName},#{item.goOffDateTime},#{item.errorDateTime},#{item.actualAttendanceDateTime},#{item.operDateTime},#{item.opertor},#{item.errorStatus},#{item.processStatus},#{item.processResult},#{item.remark},#{item.createUserId},#{item.createTime},#{item.updateUserId},#{item.updateTime})
        </foreach>
    </insert>


    <!-- 根据ParamDto更新 -->
    <update id="update" parameterType="paramDto">
        update mortals_xhx_attendance_record_error as a
        set
        <trim suffixOverrides="," suffix="">
            <if test="(colPickMode==0 and data.containsKey('staffId')) or (colPickMode==1 and !data.containsKey('staffId'))">
                a.staffId=#{data.staffId},
            </if>
            <if test="(colPickMode==0 and data.containsKey('staffIdIncrement')) or (colPickMode==1 and !data.containsKey('staffIdIncrement'))">
                a.staffId=ifnull(a.staffId,0) + #{data.staffIdIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('staffName')) or (colPickMode==1 and !data.containsKey('staffName'))">
                a.staffName=#{data.staffName},
            </if>
            <if test="(colPickMode==0 and data.containsKey('workNum')) or (colPickMode==1 and !data.containsKey('workNum'))">
                a.workNum=#{data.workNum},
            </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('positionId')) or (colPickMode==1 and !data.containsKey('positionId'))">
                a.positionId=#{data.positionId},
            </if>
            <if test="(colPickMode==0 and data.containsKey('positionIdIncrement')) or (colPickMode==1 and !data.containsKey('positionIdIncrement'))">
                a.positionId=ifnull(a.positionId,0) + #{data.positionIdIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('positionName')) or (colPickMode==1 and !data.containsKey('positionName'))">
                a.positionName=#{data.positionName},
            </if>
            <if test="(colPickMode==0 and data.containsKey('attendanceGroupId')) or (colPickMode==1 and !data.containsKey('attendanceGroupId'))">
                a.attendanceGroupId=#{data.attendanceGroupId},
            </if>
            <if test="(colPickMode==0 and data.containsKey('attendanceGroupIdIncrement')) or (colPickMode==1 and !data.containsKey('attendanceGroupIdIncrement'))">
                a.attendanceGroupId=ifnull(a.attendanceGroupId,0) + #{data.attendanceGroupIdIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('attendanceGroupName')) or (colPickMode==1 and !data.containsKey('attendanceGroupName'))">
                a.attendanceGroupName=#{data.attendanceGroupName},
            </if>
            <if test="(colPickMode==0 and data.containsKey('shiftsId')) or (colPickMode==1 and !data.containsKey('shiftsId'))">
                a.shiftsId=#{data.shiftsId},
            </if>
            <if test="(colPickMode==0 and data.containsKey('shiftsIdIncrement')) or (colPickMode==1 and !data.containsKey('shiftsIdIncrement'))">
                a.shiftsId=ifnull(a.shiftsId,0) + #{data.shiftsIdIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('shiftsName')) or (colPickMode==1 and !data.containsKey('shiftsName'))">
                a.shiftsName=#{data.shiftsName},
            </if>
            <if test="(colPickMode==0 and data.containsKey('goOffDateTime')) or (colPickMode==1 and !data.containsKey('goOffDateTime'))">
                a.goOffDateTime=#{data.goOffDateTime},
            </if>
            <if test="(colPickMode==0 and data.containsKey('errorDateTime')) or (colPickMode==1 and !data.containsKey('errorDateTime'))">
                a.errorDateTime=#{data.errorDateTime},
            </if>
            <if test="(colPickMode==0 and data.containsKey('actualAttendanceDateTime')) or (colPickMode==1 and !data.containsKey('actualAttendanceDateTime'))">
                a.actualAttendanceDateTime=#{data.actualAttendanceDateTime},
            </if>
            <if test="(colPickMode==0 and data.containsKey('operDateTime')) or (colPickMode==1 and !data.containsKey('operDateTime'))">
                a.operDateTime=#{data.operDateTime},
            </if>
            <if test="(colPickMode==0 and data.containsKey('opertor')) or (colPickMode==1 and !data.containsKey('opertor'))">
                a.opertor=#{data.opertor},
            </if>
            <if test="(colPickMode==0 and data.containsKey('errorStatus')) or (colPickMode==1 and !data.containsKey('errorStatus'))">
                a.errorStatus=#{data.errorStatus},
            </if>
            <if test="(colPickMode==0 and data.containsKey('errorStatusIncrement')) or (colPickMode==1 and !data.containsKey('errorStatusIncrement'))">
                a.errorStatus=ifnull(a.errorStatus,0) + #{data.errorStatusIncrement},
            </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>
            <if test="(colPickMode==0 and data.containsKey('processResult')) or (colPickMode==1 and !data.containsKey('processResult'))">
                a.processResult=#{data.processResult},
            </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>
        </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_record_error as a
        <trim prefix="set" suffixOverrides=",">
                        <trim prefix="staffId=(case" suffix="ELSE staffId end),">
                            <foreach collection="data.dataList" item="item" index="index" separator="" >
                                <choose>
                                    <when test="(colPickMode==0 and item.containsKey('staffId')) or (colPickMode==1 and !item.containsKey('staffId'))">
                                        when a.id=#{item.id} then #{item.staffId}
                                    </when>
                                    <when test="(colPickMode==0 and item.containsKey('staffIdIncrement')) or (colPickMode==1 and !item.containsKey('staffIdIncrement'))">
                                        when a.id=#{item.id} then ifnull(a.staffId,0) + #{item.staffIdIncrement}
                                    </when>
                                </choose>
                            </foreach>
                        </trim>
                <trim prefix="staffName=(case" suffix="ELSE staffName end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('staffName')) or (colPickMode==1 and !item.containsKey('staffName'))">
                            when a.id=#{item.id} then #{item.staffName}
                        </if>
                    </foreach>
                </trim>
                <trim prefix="workNum=(case" suffix="ELSE workNum end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('workNum')) or (colPickMode==1 and !item.containsKey('workNum'))">
                            when a.id=#{item.id} then #{item.workNum}
                        </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="positionId=(case" suffix="ELSE positionId end),">
                            <foreach collection="data.dataList" item="item" index="index" separator="" >
                                <choose>
                                    <when test="(colPickMode==0 and item.containsKey('positionId')) or (colPickMode==1 and !item.containsKey('positionId'))">
                                        when a.id=#{item.id} then #{item.positionId}
                                    </when>
                                    <when test="(colPickMode==0 and item.containsKey('positionIdIncrement')) or (colPickMode==1 and !item.containsKey('positionIdIncrement'))">
                                        when a.id=#{item.id} then ifnull(a.positionId,0) + #{item.positionIdIncrement}
                                    </when>
                                </choose>
                            </foreach>
                        </trim>
                <trim prefix="positionName=(case" suffix="ELSE positionName end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('positionName')) or (colPickMode==1 and !item.containsKey('positionName'))">
                            when a.id=#{item.id} then #{item.positionName}
                        </if>
                    </foreach>
                </trim>
                        <trim prefix="attendanceGroupId=(case" suffix="ELSE attendanceGroupId end),">
                            <foreach collection="data.dataList" item="item" index="index" separator="" >
                                <choose>
                                    <when test="(colPickMode==0 and item.containsKey('attendanceGroupId')) or (colPickMode==1 and !item.containsKey('attendanceGroupId'))">
                                        when a.id=#{item.id} then #{item.attendanceGroupId}
                                    </when>
                                    <when test="(colPickMode==0 and item.containsKey('attendanceGroupIdIncrement')) or (colPickMode==1 and !item.containsKey('attendanceGroupIdIncrement'))">
                                        when a.id=#{item.id} then ifnull(a.attendanceGroupId,0) + #{item.attendanceGroupIdIncrement}
                                    </when>
                                </choose>
                            </foreach>
                        </trim>
                <trim prefix="attendanceGroupName=(case" suffix="ELSE attendanceGroupName end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('attendanceGroupName')) or (colPickMode==1 and !item.containsKey('attendanceGroupName'))">
                            when a.id=#{item.id} then #{item.attendanceGroupName}
                        </if>
                    </foreach>
                </trim>
                        <trim prefix="shiftsId=(case" suffix="ELSE shiftsId end),">
                            <foreach collection="data.dataList" item="item" index="index" separator="" >
                                <choose>
                                    <when test="(colPickMode==0 and item.containsKey('shiftsId')) or (colPickMode==1 and !item.containsKey('shiftsId'))">
                                        when a.id=#{item.id} then #{item.shiftsId}
                                    </when>
                                    <when test="(colPickMode==0 and item.containsKey('shiftsIdIncrement')) or (colPickMode==1 and !item.containsKey('shiftsIdIncrement'))">
                                        when a.id=#{item.id} then ifnull(a.shiftsId,0) + #{item.shiftsIdIncrement}
                                    </when>
                                </choose>
                            </foreach>
                        </trim>
                <trim prefix="shiftsName=(case" suffix="ELSE shiftsName end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('shiftsName')) or (colPickMode==1 and !item.containsKey('shiftsName'))">
                            when a.id=#{item.id} then #{item.shiftsName}
                        </if>
                    </foreach>
                </trim>
                <trim prefix="goOffDateTime=(case" suffix="ELSE goOffDateTime end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('goOffDateTime')) or (colPickMode==1 and !item.containsKey('goOffDateTime'))">
                            when a.id=#{item.id} then #{item.goOffDateTime}
                        </if>
                    </foreach>
                </trim>
                <trim prefix="errorDateTime=(case" suffix="ELSE errorDateTime end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('errorDateTime')) or (colPickMode==1 and !item.containsKey('errorDateTime'))">
                            when a.id=#{item.id} then #{item.errorDateTime}
                        </if>
                    </foreach>
                </trim>
                <trim prefix="actualAttendanceDateTime=(case" suffix="ELSE actualAttendanceDateTime end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('actualAttendanceDateTime')) or (colPickMode==1 and !item.containsKey('actualAttendanceDateTime'))">
                            when a.id=#{item.id} then #{item.actualAttendanceDateTime}
                        </if>
                    </foreach>
                </trim>
                <trim prefix="operDateTime=(case" suffix="ELSE operDateTime end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('operDateTime')) or (colPickMode==1 and !item.containsKey('operDateTime'))">
                            when a.id=#{item.id} then #{item.operDateTime}
                        </if>
                    </foreach>
                </trim>
                <trim prefix="opertor=(case" suffix="ELSE opertor end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('opertor')) or (colPickMode==1 and !item.containsKey('opertor'))">
                            when a.id=#{item.id} then #{item.opertor}
                        </if>
                    </foreach>
                </trim>
                        <trim prefix="errorStatus=(case" suffix="ELSE errorStatus end),">
                            <foreach collection="data.dataList" item="item" index="index" separator="" >
                                <choose>
                                    <when test="(colPickMode==0 and item.containsKey('errorStatus')) or (colPickMode==1 and !item.containsKey('errorStatus'))">
                                        when a.id=#{item.id} then #{item.errorStatus}
                                    </when>
                                    <when test="(colPickMode==0 and item.containsKey('errorStatusIncrement')) or (colPickMode==1 and !item.containsKey('errorStatusIncrement'))">
                                        when a.id=#{item.id} then ifnull(a.errorStatus,0) + #{item.errorStatusIncrement}
                                    </when>
                                </choose>
                            </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 prefix="processResult=(case" suffix="ELSE processResult end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('processResult')) or (colPickMode==1 and !item.containsKey('processResult'))">
                            when a.id=#{item.id} then #{item.processResult}
                        </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>
        where id in
        <foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")">
            #{item.id}
        </foreach>
    </update>
    <!-- 根据主健查询 -->
    <select id="getByKey" parameterType="paramDto" resultMap="AttendanceRecordErrorEntity-Map">
        select <include refid="_columns"/>
        from mortals_xhx_attendance_record_error as a
        where a.id=#{condition.id}
    </select>
    <!-- 根据主健删除 -->
    <delete id="deleteByKey" parameterType="paramDto">
        delete a.* from mortals_xhx_attendance_record_error as a where a.id=#{condition.id}
    </delete>
    <!-- 根据主健删除一批，针对单一主健有效 -->
    <delete id="deleteByKeys">
        delete from mortals_xhx_attendance_record_error where id in
        <foreach collection="array" item="item" index="index" open="(" separator="," close=")">
            #{item}
        </foreach>
    </delete>
    <!-- 根据主健列表删除一批，针对单一主健有效 -->
    <delete id="deleteByKeyList">
        delete from mortals_xhx_attendance_record_error where id in
        <foreach collection="list" item="item" index="index" open="(" separator="," close=")">
            #{item}
        </foreach>
    </delete>

    <!-- 根据对象列表删除一批，针对单一主健有效 -->
    <delete id="deleteByEntityList">
        delete from mortals_xhx_attendance_record_error 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_record_error as a
        <trim suffixOverrides="where" suffix="">
            where
            <trim prefixOverrides="and" prefix="">
                <include refid="_condition_"/>
            </trim>
        </trim>
    </delete>
    <!-- 获取列表 -->
    <select id="getList" parameterType="paramDto" resultMap="AttendanceRecordErrorEntity-Map">
        select <include refid="_columns"/>
        from mortals_xhx_attendance_record_error 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_record_error 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')">
                ${_conditionType_} a.id in
                <foreach collection="conditionParamRef.idList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('idNotList')">
                ${_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('staffId')">
                <if test="conditionParamRef.staffId != null ">
                    ${_conditionType_} a.staffId = #{${_conditionParam_}.staffId}
                </if>
                <if test="conditionParamRef.staffId == null">
                    ${_conditionType_} a.staffId is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('staffIdList')">
                ${_conditionType_} a.staffId in
                <foreach collection="conditionParamRef.staffIdList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('staffIdNotList')">
                ${_conditionType_} a.staffId not in
                <foreach collection="conditionParamRef.staffIdNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('staffIdStart') and conditionParamRef.staffIdStart != null">
                ${_conditionType_} a.staffId <![CDATA[ >= ]]> #{${_conditionParam_}.staffIdStart}
            </if>
            <if test="conditionParamRef.containsKey('staffIdEnd') and conditionParamRef.staffIdEnd != null">
                ${_conditionType_} a.staffId <![CDATA[ <= ]]> #{${_conditionParam_}.staffIdEnd}
            </if>


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

            <if test="conditionParamRef.containsKey('workNum')">
                <if test="conditionParamRef.workNum != null and conditionParamRef.workNum != ''">
                    ${_conditionType_} a.workNum like #{${_conditionParam_}.workNum}
                </if>
                <if test="conditionParamRef.workNum == null">
                    ${_conditionType_} a.workNum is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('workNumList')">
                ${_conditionType_} a.workNum in
                <foreach collection="conditionParamRef.workNumList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('workNumNotList')">
                ${_conditionType_} a.workNum not in
                <foreach collection="conditionParamRef.workNumNotList" 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')">
                ${_conditionType_} a.deptId in
                <foreach collection="conditionParamRef.deptIdList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('deptIdNotList')">
                ${_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')">
                ${_conditionType_} a.deptName in
                <foreach collection="conditionParamRef.deptNameList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('deptNameNotList')">
                ${_conditionType_} a.deptName not in
                <foreach collection="conditionParamRef.deptNameNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('positionId')">
                <if test="conditionParamRef.positionId != null ">
                    ${_conditionType_} a.positionId = #{${_conditionParam_}.positionId}
                </if>
                <if test="conditionParamRef.positionId == null">
                    ${_conditionType_} a.positionId is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('positionIdList')">
                ${_conditionType_} a.positionId in
                <foreach collection="conditionParamRef.positionIdList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('positionIdNotList')">
                ${_conditionType_} a.positionId not in
                <foreach collection="conditionParamRef.positionIdNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('positionIdStart') and conditionParamRef.positionIdStart != null">
                ${_conditionType_} a.positionId <![CDATA[ >= ]]> #{${_conditionParam_}.positionIdStart}
            </if>
            <if test="conditionParamRef.containsKey('positionIdEnd') and conditionParamRef.positionIdEnd != null">
                ${_conditionType_} a.positionId <![CDATA[ <= ]]> #{${_conditionParam_}.positionIdEnd}
            </if>


            <if test="conditionParamRef.containsKey('positionName')">
                <if test="conditionParamRef.positionName != null and conditionParamRef.positionName != ''">
                    ${_conditionType_} a.positionName like #{${_conditionParam_}.positionName}
                </if>
                <if test="conditionParamRef.positionName == null">
                    ${_conditionType_} a.positionName is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('positionNameList')">
                ${_conditionType_} a.positionName in
                <foreach collection="conditionParamRef.positionNameList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('positionNameNotList')">
                ${_conditionType_} a.positionName not in
                <foreach collection="conditionParamRef.positionNameNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('attendanceGroupId')">
                <if test="conditionParamRef.attendanceGroupId != null ">
                    ${_conditionType_} a.attendanceGroupId = #{${_conditionParam_}.attendanceGroupId}
                </if>
                <if test="conditionParamRef.attendanceGroupId == null">
                    ${_conditionType_} a.attendanceGroupId is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('attendanceGroupIdList')">
                ${_conditionType_} a.attendanceGroupId in
                <foreach collection="conditionParamRef.attendanceGroupIdList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('attendanceGroupIdNotList')">
                ${_conditionType_} a.attendanceGroupId not in
                <foreach collection="conditionParamRef.attendanceGroupIdNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('attendanceGroupIdStart') and conditionParamRef.attendanceGroupIdStart != null">
                ${_conditionType_} a.attendanceGroupId <![CDATA[ >= ]]> #{${_conditionParam_}.attendanceGroupIdStart}
            </if>
            <if test="conditionParamRef.containsKey('attendanceGroupIdEnd') and conditionParamRef.attendanceGroupIdEnd != null">
                ${_conditionType_} a.attendanceGroupId <![CDATA[ <= ]]> #{${_conditionParam_}.attendanceGroupIdEnd}
            </if>


            <if test="conditionParamRef.containsKey('attendanceGroupName')">
                <if test="conditionParamRef.attendanceGroupName != null and conditionParamRef.attendanceGroupName != ''">
                    ${_conditionType_} a.attendanceGroupName like #{${_conditionParam_}.attendanceGroupName}
                </if>
                <if test="conditionParamRef.attendanceGroupName == null">
                    ${_conditionType_} a.attendanceGroupName is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('attendanceGroupNameList')">
                ${_conditionType_} a.attendanceGroupName in
                <foreach collection="conditionParamRef.attendanceGroupNameList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('attendanceGroupNameNotList')">
                ${_conditionType_} a.attendanceGroupName not in
                <foreach collection="conditionParamRef.attendanceGroupNameNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('shiftsId')">
                <if test="conditionParamRef.shiftsId != null ">
                    ${_conditionType_} a.shiftsId = #{${_conditionParam_}.shiftsId}
                </if>
                <if test="conditionParamRef.shiftsId == null">
                    ${_conditionType_} a.shiftsId is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('shiftsIdList')">
                ${_conditionType_} a.shiftsId in
                <foreach collection="conditionParamRef.shiftsIdList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('shiftsIdNotList')">
                ${_conditionType_} a.shiftsId not in
                <foreach collection="conditionParamRef.shiftsIdNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('shiftsIdStart') and conditionParamRef.shiftsIdStart != null">
                ${_conditionType_} a.shiftsId <![CDATA[ >= ]]> #{${_conditionParam_}.shiftsIdStart}
            </if>
            <if test="conditionParamRef.containsKey('shiftsIdEnd') and conditionParamRef.shiftsIdEnd != null">
                ${_conditionType_} a.shiftsId <![CDATA[ <= ]]> #{${_conditionParam_}.shiftsIdEnd}
            </if>


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

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

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

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

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

            <if test="conditionParamRef.containsKey('opertor')">
                <if test="conditionParamRef.opertor != null and conditionParamRef.opertor != ''">
                    ${_conditionType_} a.opertor like #{${_conditionParam_}.opertor}
                </if>
                <if test="conditionParamRef.opertor == null">
                    ${_conditionType_} a.opertor is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('opertorList')">
                ${_conditionType_} a.opertor in
                <foreach collection="conditionParamRef.opertorList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('opertorNotList')">
                ${_conditionType_} a.opertor not in
                <foreach collection="conditionParamRef.opertorNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('errorStatus')">
                <if test="conditionParamRef.errorStatus != null ">
                    ${_conditionType_} a.errorStatus = #{${_conditionParam_}.errorStatus}
                </if>
                <if test="conditionParamRef.errorStatus == null">
                    ${_conditionType_} a.errorStatus is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('errorStatusList')">
                ${_conditionType_} a.errorStatus in
                <foreach collection="conditionParamRef.errorStatusList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('errorStatusNotList')">
                ${_conditionType_} a.errorStatus not in
                <foreach collection="conditionParamRef.errorStatusNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('errorStatusStart') and conditionParamRef.errorStatusStart != null">
                ${_conditionType_} a.errorStatus <![CDATA[ >= ]]> #{${_conditionParam_}.errorStatusStart}
            </if>
            <if test="conditionParamRef.containsKey('errorStatusEnd') and conditionParamRef.errorStatusEnd != null">
                ${_conditionType_} a.errorStatus <![CDATA[ <= ]]> #{${_conditionParam_}.errorStatusEnd}
            </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')">
                ${_conditionType_} a.processStatus in
                <foreach collection="conditionParamRef.processStatusList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('processStatusNotList')">
                ${_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>


            <if test="conditionParamRef.containsKey('processResult')">
                <if test="conditionParamRef.processResult != null and conditionParamRef.processResult != ''">
                    ${_conditionType_} a.processResult like #{${_conditionParam_}.processResult}
                </if>
                <if test="conditionParamRef.processResult == null">
                    ${_conditionType_} a.processResult is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('processResultList')">
                ${_conditionType_} a.processResult in
                <foreach collection="conditionParamRef.processResultList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('processResultNotList')">
                ${_conditionType_} a.processResult not in
                <foreach collection="conditionParamRef.processResultNotList" 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')">
                ${_conditionType_} a.remark in
                <foreach collection="conditionParamRef.remarkList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('remarkNotList')">
                ${_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')">
                ${_conditionType_} a.createUserId in
                <foreach collection="conditionParamRef.createUserIdList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('createUserIdNotList')">
                ${_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')">
                ${_conditionType_} a.updateUserId in
                <foreach collection="conditionParamRef.updateUserIdList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('updateUserIdNotList')">
                ${_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>
    </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('staffId')">
                        a.staffId
                        <if test='orderCol.staffId != null and "DESC".equalsIgnoreCase(orderCol.staffId)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('staffName')">
                        a.staffName
                        <if test='orderCol.staffName != null and "DESC".equalsIgnoreCase(orderCol.staffName)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('workNum')">
                        a.workNum
                        <if test='orderCol.workNum != null and "DESC".equalsIgnoreCase(orderCol.workNum)'>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('positionId')">
                        a.positionId
                        <if test='orderCol.positionId != null and "DESC".equalsIgnoreCase(orderCol.positionId)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('positionName')">
                        a.positionName
                        <if test='orderCol.positionName != null and "DESC".equalsIgnoreCase(orderCol.positionName)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('attendanceGroupId')">
                        a.attendanceGroupId
                        <if test='orderCol.attendanceGroupId != null and "DESC".equalsIgnoreCase(orderCol.attendanceGroupId)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('attendanceGroupName')">
                        a.attendanceGroupName
                        <if test='orderCol.attendanceGroupName != null and "DESC".equalsIgnoreCase(orderCol.attendanceGroupName)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('shiftsId')">
                        a.shiftsId
                        <if test='orderCol.shiftsId != null and "DESC".equalsIgnoreCase(orderCol.shiftsId)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('shiftsName')">
                        a.shiftsName
                        <if test='orderCol.shiftsName != null and "DESC".equalsIgnoreCase(orderCol.shiftsName)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('goOffDateTime')">
                        a.goOffDateTime
                        <if test='orderCol.goOffDateTime != null and "DESC".equalsIgnoreCase(orderCol.goOffDateTime)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('errorDateTime')">
                        a.errorDateTime
                        <if test='orderCol.errorDateTime != null and "DESC".equalsIgnoreCase(orderCol.errorDateTime)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('actualAttendanceDateTime')">
                        a.actualAttendanceDateTime
                        <if test='orderCol.actualAttendanceDateTime != null and "DESC".equalsIgnoreCase(orderCol.actualAttendanceDateTime)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('operDateTime')">
                        a.operDateTime
                        <if test='orderCol.operDateTime != null and "DESC".equalsIgnoreCase(orderCol.operDateTime)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('opertor')">
                        a.opertor
                        <if test='orderCol.opertor != null and "DESC".equalsIgnoreCase(orderCol.opertor)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('errorStatus')">
                        a.errorStatus
                        <if test='orderCol.errorStatus != null and "DESC".equalsIgnoreCase(orderCol.errorStatus)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('processStatus')">
                        a.processStatus
                        <if test='orderCol.processStatus != null and "DESC".equalsIgnoreCase(orderCol.processStatus)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('processResult')">
                        a.processResult
                        <if test='orderCol.processResult != null and "DESC".equalsIgnoreCase(orderCol.processResult)'>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>
            </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>
    <select id="errorAttendance" resultType="integer">
        select count(1) count from mortals_xhx_attendance_record_error where staffId =#{id} group by errorStatus
    </select>
</mapper>