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

    <!-- 字段和属性映射 -->
    <resultMap type="AttendanceRecordHikEntity" id="AttendanceRecordHikEntity-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="attendanceDate" column="attendanceDate" />
        <result property="attendanceAddress" column="attendanceAddress" />
        <result property="eventSource" column="eventSource" />
        <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="signInResult" column="signInResult" />
        <result property="signOutResult" column="signOutResult" />
        <result property="attendType" column="attendType" />
        <result property="punchResult" column="punchResult" />

    </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('attendanceDate') or colPickMode == 1 and data.containsKey('attendanceDate')))">
                a.attendanceDate,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('attendanceAddress') or colPickMode == 1 and data.containsKey('attendanceAddress')))">
                a.attendanceAddress,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('eventSource') or colPickMode == 1 and data.containsKey('eventSource')))">
                a.eventSource,
            </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('signInResult') or colPickMode == 1 and data.containsKey('signInResult')))">
                a.signInResult,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('signOutResult') or colPickMode == 1 and data.containsKey('signOutResult')))">
                a.signOutResult,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('attendType') or colPickMode == 1 and data.containsKey('attendType')))">
                a.attendType,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('punchResult') or colPickMode == 1 and data.containsKey('punchResult')))">
                a.punchResult,
            </if>
        </trim>
    </sql>
    <!-- 新增 区分主键自增加还是业务插入 -->
    <insert id="insert" parameterType="AttendanceRecordHikEntity"  useGeneratedKeys="true" keyProperty="id">
        insert into mortals_xhx_attendance_record_hik
        (staffId,staffName,workNum,deptId,deptName,positionId,positionName,attendanceGroupId,attendanceGroupName,shiftsId,shiftsName,attendanceDate,attendanceAddress,eventSource,remark,createUserId,createTime,updateUserId,updateTime,signInResult,signOutResult,attendType,punchResult)
        VALUES
        (#{staffId},#{staffName},#{workNum},#{deptId},#{deptName},#{positionId},#{positionName},#{attendanceGroupId},#{attendanceGroupName},#{shiftsId},#{shiftsName},#{attendanceDate},#{attendanceAddress},#{eventSource},#{remark},#{createUserId},#{createTime},#{updateUserId},#{updateTime},#{signInResult},#{signOutResult},#{attendType},#{punchResult})
    </insert>

    <!-- 批量新增 -->
    <insert id="insertBatch" parameterType="paramDto">
        insert into mortals_xhx_attendance_record_hik
        (staffId,staffName,workNum,deptId,deptName,positionId,positionName,attendanceGroupId,attendanceGroupName,shiftsId,shiftsName,attendanceDate,attendanceAddress,eventSource,remark,createUserId,createTime,updateUserId,updateTime,signInResult,signOutResult,attendType,punchResult)
        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.attendanceDate},#{item.attendanceAddress},#{item.eventSource},#{item.remark},#{item.createUserId},#{item.createTime},#{item.updateUserId},#{item.updateTime},#{item.signInResult},#{item.signOutResult},#{item.attendType},#{item.punchResult})
        </foreach>
    </insert>


    <!-- 根据ParamDto更新 -->
    <update id="update" parameterType="paramDto">
        update mortals_xhx_attendance_record_hik 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('attendanceDate')) or (colPickMode==1 and !data.containsKey('attendanceDate'))">
                a.attendanceDate=#{data.attendanceDate},
            </if>
            <if test="(colPickMode==0 and data.containsKey('attendanceAddress')) or (colPickMode==1 and !data.containsKey('attendanceAddress'))">
                a.attendanceAddress=#{data.attendanceAddress},
            </if>
            <if test="(colPickMode==0 and data.containsKey('eventSource')) or (colPickMode==1 and !data.containsKey('eventSource'))">
                a.eventSource=#{data.eventSource},
            </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('signInResult')) or (colPickMode==1 and !data.containsKey('signInResult'))">
                a.signInResult=#{data.signInResult},
            </if>
            <if test="(colPickMode==0 and data.containsKey('signInResultIncrement')) or (colPickMode==1 and !data.containsKey('signInResultIncrement'))">
                a.signInResult=ifnull(a.signInResult,0) + #{data.signInResultIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('signOutResult')) or (colPickMode==1 and !data.containsKey('signOutResult'))">
                a.signOutResult=#{data.signOutResult},
            </if>
            <if test="(colPickMode==0 and data.containsKey('signOutResultIncrement')) or (colPickMode==1 and !data.containsKey('signOutResultIncrement'))">
                a.signOutResult=ifnull(a.signOutResult,0) + #{data.signOutResultIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('attendType')) or (colPickMode==1 and !data.containsKey('attendType'))">
                a.attendType=#{data.attendType},
            </if>
            <if test="(colPickMode==0 and data.containsKey('punchResult')) or (colPickMode==1 and !data.containsKey('punchResult'))">
                a.punchResult=#{data.punchResult},
            </if>
            <if test="(colPickMode==0 and data.containsKey('punchResultIncrement')) or (colPickMode==1 and !data.containsKey('punchResultIncrement'))">
                a.punchResult=ifnull(a.punchResult,0) + #{data.punchResultIncrement},
            </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_hik 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="attendanceDate=(case" suffix="ELSE attendanceDate end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('attendanceDate')) or (colPickMode==1 and !item.containsKey('attendanceDate'))">
                        when a.id=#{item.id} then #{item.attendanceDate}
                    </if>
                </foreach>
            </trim>
            <trim prefix="attendanceAddress=(case" suffix="ELSE attendanceAddress end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('attendanceAddress')) or (colPickMode==1 and !item.containsKey('attendanceAddress'))">
                        when a.id=#{item.id} then #{item.attendanceAddress}
                    </if>
                </foreach>
            </trim>
            <trim prefix="eventSource=(case" suffix="ELSE eventSource end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('eventSource')) or (colPickMode==1 and !item.containsKey('eventSource'))">
                        when a.id=#{item.id} then #{item.eventSource}
                    </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="signInResult=(case" suffix="ELSE signInResult end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('signInResult')) or (colPickMode==1 and !item.containsKey('signInResult'))">
                            when a.id=#{item.id} then #{item.signInResult}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('signInResultIncrement')) or (colPickMode==1 and !item.containsKey('signInResultIncrement'))">
                            when a.id=#{item.id} then ifnull(a.signInResult,0) + #{item.signInResultIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="signOutResult=(case" suffix="ELSE signOutResult end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('signOutResult')) or (colPickMode==1 and !item.containsKey('signOutResult'))">
                            when a.id=#{item.id} then #{item.signOutResult}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('signOutResultIncrement')) or (colPickMode==1 and !item.containsKey('signOutResultIncrement'))">
                            when a.id=#{item.id} then ifnull(a.signOutResult,0) + #{item.signOutResultIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="attendType=(case" suffix="ELSE attendType end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('attendType')) or (colPickMode==1 and !item.containsKey('attendType'))">
                        when a.id=#{item.id} then #{item.attendType}
                    </if>
                </foreach>
            </trim>
            <trim prefix="punchResult=(case" suffix="ELSE punchResult end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('punchResult')) or (colPickMode==1 and !item.containsKey('punchResult'))">
                            when a.id=#{item.id} then #{item.punchResult}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('punchResultIncrement')) or (colPickMode==1 and !item.containsKey('punchResultIncrement'))">
                            when a.id=#{item.id} then ifnull(a.punchResult,0) + #{item.punchResultIncrement}
                        </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="AttendanceRecordHikEntity-Map">
        select <include refid="_columns"/>
        from mortals_xhx_attendance_record_hik as a
        where a.id=#{condition.id}
    </select>
    <!-- 根据主健删除 -->
    <delete id="deleteByKey" parameterType="paramDto">
        delete a.* from mortals_xhx_attendance_record_hik as a where a.id=#{condition.id}
    </delete>
    <!-- 根据主健删除一批，针对单一主健有效 -->
    <delete id="deleteByKeys">
        delete from mortals_xhx_attendance_record_hik 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_hik 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_hik 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_hik as a
        <trim suffixOverrides="where" suffix="">
            where
            <trim prefixOverrides="and" prefix="">
                <include refid="_condition_"/>
            </trim>
        </trim>
    </delete>
    <!-- 获取列表 -->
    <select id="getList" parameterType="paramDto" resultMap="AttendanceRecordHikEntity-Map">
        select <include refid="_columns"/>
        from mortals_xhx_attendance_record_hik 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_hik 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('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') and conditionParamRef.staffIdList.size() > 0">
            ${_conditionType_} a.staffId in
            <foreach collection="conditionParamRef.staffIdList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('staffIdNotList') and conditionParamRef.staffIdNotList.size() > 0">
            ${_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') and conditionParamRef.staffNameList.size() > 0">
            ${_conditionType_} a.staffName in
            <foreach collection="conditionParamRef.staffNameList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('staffNameNotList') and conditionParamRef.staffNameNotList.size() > 0">
            ${_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') and conditionParamRef.workNumList.size() > 0">
            ${_conditionType_} a.workNum in
            <foreach collection="conditionParamRef.workNumList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('workNumNotList') and conditionParamRef.workNumNotList.size() > 0">
            ${_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') 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('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') and conditionParamRef.positionIdList.size() > 0">
            ${_conditionType_} a.positionId in
            <foreach collection="conditionParamRef.positionIdList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('positionIdNotList') and conditionParamRef.positionIdNotList.size() > 0">
            ${_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') and conditionParamRef.positionNameList.size() > 0">
            ${_conditionType_} a.positionName in
            <foreach collection="conditionParamRef.positionNameList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('positionNameNotList') and conditionParamRef.positionNameNotList.size() > 0">
            ${_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') and conditionParamRef.attendanceGroupIdList.size() > 0">
            ${_conditionType_} a.attendanceGroupId in
            <foreach collection="conditionParamRef.attendanceGroupIdList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('attendanceGroupIdNotList') and conditionParamRef.attendanceGroupIdNotList.size() > 0">
            ${_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') and conditionParamRef.attendanceGroupNameList.size() > 0">
            ${_conditionType_} a.attendanceGroupName in
            <foreach collection="conditionParamRef.attendanceGroupNameList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('attendanceGroupNameNotList') and conditionParamRef.attendanceGroupNameNotList.size() > 0">
            ${_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') and conditionParamRef.shiftsIdList.size() > 0">
            ${_conditionType_} a.shiftsId in
            <foreach collection="conditionParamRef.shiftsIdList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('shiftsIdNotList') and conditionParamRef.shiftsIdNotList.size() > 0">
            ${_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') and conditionParamRef.shiftsNameList.size() > 0">
            ${_conditionType_} a.shiftsName in
            <foreach collection="conditionParamRef.shiftsNameList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('shiftsNameNotList') and conditionParamRef.shiftsNameNotList.size() > 0">
            ${_conditionType_} a.shiftsName not in
            <foreach collection="conditionParamRef.shiftsNameNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>

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

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

        <if test="conditionParamRef.containsKey('eventSource')">
            <if test="conditionParamRef.eventSource != null and conditionParamRef.eventSource != ''">
                ${_conditionType_} a.eventSource like #{${_conditionParam_}.eventSource}
            </if>
            <if test="conditionParamRef.eventSource == null">
                ${_conditionType_} a.eventSource is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('eventSourceList') and conditionParamRef.eventSourceList.size() > 0">
            ${_conditionType_} a.eventSource in
            <foreach collection="conditionParamRef.eventSourceList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('eventSourceNotList') and conditionParamRef.eventSourceNotList.size() > 0">
            ${_conditionType_} a.eventSource not in
            <foreach collection="conditionParamRef.eventSourceNotList" 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('signInResult')">
            <if test="conditionParamRef.signInResult != null ">
                ${_conditionType_} a.signInResult = #{${_conditionParam_}.signInResult}
            </if>
            <if test="conditionParamRef.signInResult == null">
                ${_conditionType_} a.signInResult is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('signInResultList') and conditionParamRef.signInResultList.size() > 0">
            ${_conditionType_} a.signInResult in
            <foreach collection="conditionParamRef.signInResultList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('signInResultNotList') and conditionParamRef.signInResultNotList.size() > 0">
            ${_conditionType_} a.signInResult not in
            <foreach collection="conditionParamRef.signInResultNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('signInResultStart') and conditionParamRef.signInResultStart != null">
            ${_conditionType_} a.signInResult <![CDATA[ >= ]]> #{${_conditionParam_}.signInResultStart}
        </if>
        <if test="conditionParamRef.containsKey('signInResultEnd') and conditionParamRef.signInResultEnd != null">
            ${_conditionType_} a.signInResult <![CDATA[ <= ]]> #{${_conditionParam_}.signInResultEnd}
        </if>

        <if test="conditionParamRef.containsKey('signOutResult')">
            <if test="conditionParamRef.signOutResult != null ">
                ${_conditionType_} a.signOutResult = #{${_conditionParam_}.signOutResult}
            </if>
            <if test="conditionParamRef.signOutResult == null">
                ${_conditionType_} a.signOutResult is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('signOutResultList') and conditionParamRef.signOutResultList.size() > 0">
            ${_conditionType_} a.signOutResult in
            <foreach collection="conditionParamRef.signOutResultList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('signOutResultNotList') and conditionParamRef.signOutResultNotList.size() > 0">
            ${_conditionType_} a.signOutResult not in
            <foreach collection="conditionParamRef.signOutResultNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('signOutResultStart') and conditionParamRef.signOutResultStart != null">
            ${_conditionType_} a.signOutResult <![CDATA[ >= ]]> #{${_conditionParam_}.signOutResultStart}
        </if>
        <if test="conditionParamRef.containsKey('signOutResultEnd') and conditionParamRef.signOutResultEnd != null">
            ${_conditionType_} a.signOutResult <![CDATA[ <= ]]> #{${_conditionParam_}.signOutResultEnd}
        </if>


        <if test="conditionParamRef.containsKey('attendType')">
            <if test="conditionParamRef.attendType != null and conditionParamRef.attendType != ''">
                ${_conditionType_} a.attendType like #{${_conditionParam_}.attendType}
            </if>
            <if test="conditionParamRef.attendType == null">
                ${_conditionType_} a.attendType is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('attendTypeList') and conditionParamRef.attendTypeList.size() > 0">
            ${_conditionType_} a.attendType in
            <foreach collection="conditionParamRef.attendTypeList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('attendTypeNotList') and conditionParamRef.attendTypeNotList.size() > 0">
            ${_conditionType_} a.attendType not in
            <foreach collection="conditionParamRef.attendTypeNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('punchResult')">
            <if test="conditionParamRef.punchResult != null ">
                ${_conditionType_} a.punchResult = #{${_conditionParam_}.punchResult}
            </if>
            <if test="conditionParamRef.punchResult == null">
                ${_conditionType_} a.punchResult is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('punchResultList') and conditionParamRef.punchResultList.size() > 0">
            ${_conditionType_} a.punchResult in
            <foreach collection="conditionParamRef.punchResultList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('punchResultNotList') and conditionParamRef.punchResultNotList.size() > 0">
            ${_conditionType_} a.punchResult not in
            <foreach collection="conditionParamRef.punchResultNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('punchResultStart') and conditionParamRef.punchResultStart != null">
            ${_conditionType_} a.punchResult <![CDATA[ >= ]]> #{${_conditionParam_}.punchResultStart}
        </if>
        <if test="conditionParamRef.containsKey('punchResultEnd') and conditionParamRef.punchResultEnd != null">
            ${_conditionType_} a.punchResult <![CDATA[ <= ]]> #{${_conditionParam_}.punchResultEnd}
        </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('attendanceDate')">
                    a.attendanceDate
                    <if test='orderCol.attendanceDate != null and "DESC".equalsIgnoreCase(orderCol.attendanceDate)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('attendanceAddress')">
                    a.attendanceAddress
                    <if test='orderCol.attendanceAddress != null and "DESC".equalsIgnoreCase(orderCol.attendanceAddress)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('eventSource')">
                    a.eventSource
                    <if test='orderCol.eventSource != null and "DESC".equalsIgnoreCase(orderCol.eventSource)'>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('signInResult')">
                    a.signInResult
                    <if test='orderCol.signInResult != null and "DESC".equalsIgnoreCase(orderCol.signInResult)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('signOutResult')">
                    a.signOutResult
                    <if test='orderCol.signOutResult != null and "DESC".equalsIgnoreCase(orderCol.signOutResult)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('attendType')">
                    a.attendType
                    <if test='orderCol.attendType != null and "DESC".equalsIgnoreCase(orderCol.attendType)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('punchResult')">
                    a.punchResult
                    <if test='orderCol.punchResult != null and "DESC".equalsIgnoreCase(orderCol.punchResult)'>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>