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

    <!-- 字段和属性映射 -->
    <resultMap type="AttendanceRecordEntity" id="AttendanceRecordEntity-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="remark" column="remark" />
            <result property="createUserId" column="createUserId" />
            <result property="createTime" column="createTime" />
            <result property="updateUserId" column="updateUserId" />
            <result property="updateTime" column="updateTime" />
            <collection property="attendanceRecordDetailList" column="id" ofType="AttendanceRecordDetailEntity" javaType="ArrayList" select="getAttendanceRecordDetailByRecordId"></collection>
    </resultMap>
    <resultMap type="AttendanceRecordDetailEntity" id="AttendanceRecordDetailEntity-Map">
            <result property="id" column="id" />
            <result property="recordId" column="recordId" />
            <result property="shiftsId" column="shiftsId" />
            <result property="shiftsName" column="shiftsName" />
            <result property="goWorkDate" column="goWorkDate" />
            <result property="goWorkResult" column="goWorkResult" />
            <result property="offWorkDate" column="offWorkDate" />
            <result property="offWorkResult" column="offWorkResult" />
            <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('attendanceDate') or colPickMode == 1 and data.containsKey('attendanceDate')))">
                    a.attendanceDate,
                </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>
    <!-- 子表所有列 -->
    <sql id="_columns_sub">
        <trim suffixOverrides="," suffix="">
            b.id,b.recordId,b.shiftsId,b.shiftsName,b.goWorkDate,b.goWorkResult,b.offWorkDate,b.offWorkResult,b.remark,b.createUserId,b.createTime,b.updateUserId,b.updateTime,
        </trim>
    </sql>
    <!-- 新增 区分主键自增加还是业务插入 -->
    <insert id="insert" parameterType="AttendanceRecordEntity"  useGeneratedKeys="true" keyProperty="id">
        insert into mortals_xhx_attendance_record
        (staffId,staffName,workNum,deptId,deptName,positionId,positionName,attendanceGroupId,attendanceGroupName,shiftsId,shiftsName,attendanceDate,remark,createUserId,createTime,updateUserId,updateTime)
        VALUES
        (#{staffId},#{staffName},#{workNum},#{deptId},#{deptName},#{positionId},#{positionName},#{attendanceGroupId},#{attendanceGroupName},#{shiftsId},#{shiftsName},#{attendanceDate},#{remark},#{createUserId},#{createTime},#{updateUserId},#{updateTime})
    </insert>

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


    <!-- 根据ParamDto更新 -->
    <update id="update" parameterType="paramDto">
        update mortals_xhx_attendance_record 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('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 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="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="AttendanceRecordEntity-Map">
        select <include refid="_columns"/>
        from mortals_xhx_attendance_record as a
        where a.id=#{condition.id}
    </select>
    <!-- 根据主健删除 -->
    <delete id="deleteByKey" parameterType="paramDto">
        delete a.* from mortals_xhx_attendance_record as a where a.id=#{condition.id}
    </delete>
    <!-- 根据主健删除一批，针对单一主健有效 -->
    <delete id="deleteByKeys">
        delete from mortals_xhx_attendance_record where id in
        <foreach collection="array" item="item" index="index" open="(" separator="," close=")">
            #{item}
        </foreach>
    </delete>
    <!-- 根据主健列表删除一批，针对单一主健有效 -->
    <delete id="deleteByKeyList">
        delete from mortals_xhx_attendance_record where id in
        <foreach collection="list" item="item" index="index" open="(" separator="," close=")">
            #{item}
        </foreach>
    </delete>

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



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