<?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.perform.dao.ibatis.PerformStaffConfDaoImpl">

    <!-- 字段和属性映射 -->
    <resultMap type="PerformStaffConfEntity" id="PerformStaffConfEntity-Map">
            <id  property="id" column="id" />
            <result property="staffIds" column="staffIds" />
            <result property="staffNames" column="staffNames" />
            <result property="staffCount" column="staffCount" />
            <result property="attendCount" column="attendCount" />
            <result property="assessCount" column="assessCount" />
            <result property="workCount" column="workCount" />
            <result property="effectCount" column="effectCount" />
            <result property="otherCount" column="otherCount" />
            <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('staffIds') or colPickMode == 1 and data.containsKey('staffIds')))">
                    a.staffIds,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('staffNames') or colPickMode == 1 and data.containsKey('staffNames')))">
                    a.staffNames,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('staffCount') or colPickMode == 1 and data.containsKey('staffCount')))">
                    a.staffCount,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('attendCount') or colPickMode == 1 and data.containsKey('attendCount')))">
                    a.attendCount,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('assessCount') or colPickMode == 1 and data.containsKey('assessCount')))">
                    a.assessCount,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('workCount') or colPickMode == 1 and data.containsKey('workCount')))">
                    a.workCount,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('effectCount') or colPickMode == 1 and data.containsKey('effectCount')))">
                    a.effectCount,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('otherCount') or colPickMode == 1 and data.containsKey('otherCount')))">
                    a.otherCount,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('remark') or colPickMode == 1 and data.containsKey('remark')))">
                    a.remark,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createUserId') or colPickMode == 1 and data.containsKey('createUserId')))">
                    a.createUserId,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createTime') or colPickMode == 1 and data.containsKey('createTime')))">
                    a.createTime,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateUserId') or colPickMode == 1 and data.containsKey('updateUserId')))">
                    a.updateUserId,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateTime') or colPickMode == 1 and data.containsKey('updateTime')))">
                    a.updateTime,
                </if>
        </trim>
    </sql>
    <!-- 新增 区分主键自增加还是业务插入 -->
    <insert id="insert" parameterType="PerformStaffConfEntity"  useGeneratedKeys="true" keyProperty="id">
        insert into mortals_xhx_perform_staff_conf
        (staffIds,staffNames,staffCount,attendCount,assessCount,workCount,effectCount,otherCount,remark,createUserId,createTime,updateUserId,updateTime)
        VALUES
        (#{staffIds},#{staffNames},#{staffCount},#{attendCount},#{assessCount},#{workCount},#{effectCount},#{otherCount},#{remark},#{createUserId},#{createTime},#{updateUserId},#{updateTime})
    </insert>

    <!-- 批量新增 -->
    <insert id="insertBatch" parameterType="paramDto">
        insert into mortals_xhx_perform_staff_conf
        (staffIds,staffNames,staffCount,attendCount,assessCount,workCount,effectCount,otherCount,remark,createUserId,createTime,updateUserId,updateTime)
        VALUES
        <foreach collection="data.dataList" item="item" index="index" separator="," >
            (#{item.staffIds},#{item.staffNames},#{item.staffCount},#{item.attendCount},#{item.assessCount},#{item.workCount},#{item.effectCount},#{item.otherCount},#{item.remark},#{item.createUserId},#{item.createTime},#{item.updateUserId},#{item.updateTime})
        </foreach>
    </insert>


    <!-- 根据ParamDto更新 -->
    <update id="update" parameterType="paramDto">
        update mortals_xhx_perform_staff_conf as a
        set
        <trim suffixOverrides="," suffix="">
            <if test="(colPickMode==0 and data.containsKey('staffIds')) or (colPickMode==1 and !data.containsKey('staffIds'))">
                a.staffIds=#{data.staffIds},
            </if>
            <if test="(colPickMode==0 and data.containsKey('staffNames')) or (colPickMode==1 and !data.containsKey('staffNames'))">
                a.staffNames=#{data.staffNames},
            </if>
            <if test="(colPickMode==0 and data.containsKey('staffCount')) or (colPickMode==1 and !data.containsKey('staffCount'))">
                a.staffCount=#{data.staffCount},
            </if>
            <if test="(colPickMode==0 and data.containsKey('staffCountIncrement')) or (colPickMode==1 and !data.containsKey('staffCountIncrement'))">
                a.staffCount=ifnull(a.staffCount,0) + #{data.staffCountIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('attendCount')) or (colPickMode==1 and !data.containsKey('attendCount'))">
                a.attendCount=#{data.attendCount},
            </if>
            <if test="(colPickMode==0 and data.containsKey('attendCountIncrement')) or (colPickMode==1 and !data.containsKey('attendCountIncrement'))">
                a.attendCount=ifnull(a.attendCount,0) + #{data.attendCountIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('assessCount')) or (colPickMode==1 and !data.containsKey('assessCount'))">
                a.assessCount=#{data.assessCount},
            </if>
            <if test="(colPickMode==0 and data.containsKey('assessCountIncrement')) or (colPickMode==1 and !data.containsKey('assessCountIncrement'))">
                a.assessCount=ifnull(a.assessCount,0) + #{data.assessCountIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('workCount')) or (colPickMode==1 and !data.containsKey('workCount'))">
                a.workCount=#{data.workCount},
            </if>
            <if test="(colPickMode==0 and data.containsKey('workCountIncrement')) or (colPickMode==1 and !data.containsKey('workCountIncrement'))">
                a.workCount=ifnull(a.workCount,0) + #{data.workCountIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('effectCount')) or (colPickMode==1 and !data.containsKey('effectCount'))">
                a.effectCount=#{data.effectCount},
            </if>
            <if test="(colPickMode==0 and data.containsKey('effectCountIncrement')) or (colPickMode==1 and !data.containsKey('effectCountIncrement'))">
                a.effectCount=ifnull(a.effectCount,0) + #{data.effectCountIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('otherCount')) or (colPickMode==1 and !data.containsKey('otherCount'))">
                a.otherCount=#{data.otherCount},
            </if>
            <if test="(colPickMode==0 and data.containsKey('otherCountIncrement')) or (colPickMode==1 and !data.containsKey('otherCountIncrement'))">
                a.otherCount=ifnull(a.otherCount,0) + #{data.otherCountIncrement},
            </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_perform_staff_conf as a
        <trim prefix="set" suffixOverrides=",">
                <trim prefix="staffIds=(case" suffix="ELSE staffIds end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('staffIds')) or (colPickMode==1 and !item.containsKey('staffIds'))">
                            when a.id=#{item.id} then #{item.staffIds}
                        </if>
                    </foreach>
                </trim>
                <trim prefix="staffNames=(case" suffix="ELSE staffNames end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('staffNames')) or (colPickMode==1 and !item.containsKey('staffNames'))">
                            when a.id=#{item.id} then #{item.staffNames}
                        </if>
                    </foreach>
                </trim>
                        <trim prefix="staffCount=(case" suffix="ELSE staffCount end),">
                            <foreach collection="data.dataList" item="item" index="index" separator="" >
                                <choose>
                                    <when test="(colPickMode==0 and item.containsKey('staffCount')) or (colPickMode==1 and !item.containsKey('staffCount'))">
                                        when a.id=#{item.id} then #{item.staffCount}
                                    </when>
                                    <when test="(colPickMode==0 and item.containsKey('staffCountIncrement')) or (colPickMode==1 and !item.containsKey('staffCountIncrement'))">
                                        when a.id=#{item.id} then ifnull(a.staffCount,0) + #{item.staffCountIncrement}
                                    </when>
                                </choose>
                            </foreach>
                        </trim>
                        <trim prefix="attendCount=(case" suffix="ELSE attendCount end),">
                            <foreach collection="data.dataList" item="item" index="index" separator="" >
                                <choose>
                                    <when test="(colPickMode==0 and item.containsKey('attendCount')) or (colPickMode==1 and !item.containsKey('attendCount'))">
                                        when a.id=#{item.id} then #{item.attendCount}
                                    </when>
                                    <when test="(colPickMode==0 and item.containsKey('attendCountIncrement')) or (colPickMode==1 and !item.containsKey('attendCountIncrement'))">
                                        when a.id=#{item.id} then ifnull(a.attendCount,0) + #{item.attendCountIncrement}
                                    </when>
                                </choose>
                            </foreach>
                        </trim>
                        <trim prefix="assessCount=(case" suffix="ELSE assessCount end),">
                            <foreach collection="data.dataList" item="item" index="index" separator="" >
                                <choose>
                                    <when test="(colPickMode==0 and item.containsKey('assessCount')) or (colPickMode==1 and !item.containsKey('assessCount'))">
                                        when a.id=#{item.id} then #{item.assessCount}
                                    </when>
                                    <when test="(colPickMode==0 and item.containsKey('assessCountIncrement')) or (colPickMode==1 and !item.containsKey('assessCountIncrement'))">
                                        when a.id=#{item.id} then ifnull(a.assessCount,0) + #{item.assessCountIncrement}
                                    </when>
                                </choose>
                            </foreach>
                        </trim>
                        <trim prefix="workCount=(case" suffix="ELSE workCount end),">
                            <foreach collection="data.dataList" item="item" index="index" separator="" >
                                <choose>
                                    <when test="(colPickMode==0 and item.containsKey('workCount')) or (colPickMode==1 and !item.containsKey('workCount'))">
                                        when a.id=#{item.id} then #{item.workCount}
                                    </when>
                                    <when test="(colPickMode==0 and item.containsKey('workCountIncrement')) or (colPickMode==1 and !item.containsKey('workCountIncrement'))">
                                        when a.id=#{item.id} then ifnull(a.workCount,0) + #{item.workCountIncrement}
                                    </when>
                                </choose>
                            </foreach>
                        </trim>
                        <trim prefix="effectCount=(case" suffix="ELSE effectCount end),">
                            <foreach collection="data.dataList" item="item" index="index" separator="" >
                                <choose>
                                    <when test="(colPickMode==0 and item.containsKey('effectCount')) or (colPickMode==1 and !item.containsKey('effectCount'))">
                                        when a.id=#{item.id} then #{item.effectCount}
                                    </when>
                                    <when test="(colPickMode==0 and item.containsKey('effectCountIncrement')) or (colPickMode==1 and !item.containsKey('effectCountIncrement'))">
                                        when a.id=#{item.id} then ifnull(a.effectCount,0) + #{item.effectCountIncrement}
                                    </when>
                                </choose>
                            </foreach>
                        </trim>
                        <trim prefix="otherCount=(case" suffix="ELSE otherCount end),">
                            <foreach collection="data.dataList" item="item" index="index" separator="" >
                                <choose>
                                    <when test="(colPickMode==0 and item.containsKey('otherCount')) or (colPickMode==1 and !item.containsKey('otherCount'))">
                                        when a.id=#{item.id} then #{item.otherCount}
                                    </when>
                                    <when test="(colPickMode==0 and item.containsKey('otherCountIncrement')) or (colPickMode==1 and !item.containsKey('otherCountIncrement'))">
                                        when a.id=#{item.id} then ifnull(a.otherCount,0) + #{item.otherCountIncrement}
                                    </when>
                                </choose>
                            </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="PerformStaffConfEntity-Map">
        select <include refid="_columns"/>
        from mortals_xhx_perform_staff_conf as a
        where a.id=#{condition.id}
    </select>
    <!-- 根据主健删除 -->
    <delete id="deleteByKey" parameterType="paramDto">
        delete a.* from mortals_xhx_perform_staff_conf as a where a.id=#{condition.id}
    </delete>
    <!-- 根据主健删除一批，针对单一主健有效 -->
    <delete id="deleteByKeys">
        delete from mortals_xhx_perform_staff_conf where id in
        <foreach collection="array" item="item" index="index" open="(" separator="," close=")">
            #{item}
        </foreach>
    </delete>
    <!-- 根据主健列表删除一批，针对单一主健有效 -->
    <delete id="deleteByKeyList">
        delete from mortals_xhx_perform_staff_conf where id in
        <foreach collection="list" item="item" index="index" open="(" separator="," close=")">
            #{item}
        </foreach>
    </delete>

    <!-- 根据对象列表删除一批，针对单一主健有效 -->
    <delete id="deleteByEntityList">
        delete from mortals_xhx_perform_staff_conf 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_perform_staff_conf as a
        <trim suffixOverrides="where" suffix="">
            where
            <trim prefixOverrides="and" prefix="">
                <include refid="_condition_"/>
            </trim>
        </trim>
    </delete>
    <!-- 获取列表 -->
    <select id="getList" parameterType="paramDto" resultMap="PerformStaffConfEntity-Map">
        select <include refid="_columns"/>
        from mortals_xhx_perform_staff_conf 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_perform_staff_conf 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('staffIds')">
                <if test="conditionParamRef.staffIds != null and conditionParamRef.staffIds != ''">
                    ${_conditionType_} a.staffIds like #{${_conditionParam_}.staffIds}
                </if>
                <if test="conditionParamRef.staffIds == null">
                    ${_conditionType_} a.staffIds is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('staffIdsList') and conditionParamRef.staffIdsList.size() > 0">
                ${_conditionType_} a.staffIds in
                <foreach collection="conditionParamRef.staffIdsList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('staffIdsNotList') and conditionParamRef.staffIdsNotList.size() > 0">
                ${_conditionType_} a.staffIds not in
                <foreach collection="conditionParamRef.staffIdsNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>

            <if test="conditionParamRef.containsKey('staffNames')">
                <if test="conditionParamRef.staffNames != null and conditionParamRef.staffNames != ''">
                    ${_conditionType_} a.staffNames like #{${_conditionParam_}.staffNames}
                </if>
                <if test="conditionParamRef.staffNames == null">
                    ${_conditionType_} a.staffNames is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('staffNamesList') and conditionParamRef.staffNamesList.size() > 0">
                ${_conditionType_} a.staffNames in
                <foreach collection="conditionParamRef.staffNamesList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('staffNamesNotList') and conditionParamRef.staffNamesNotList.size() > 0">
                ${_conditionType_} a.staffNames not in
                <foreach collection="conditionParamRef.staffNamesNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('staffCount')">
                <if test="conditionParamRef.staffCount != null ">
                    ${_conditionType_} a.staffCount = #{${_conditionParam_}.staffCount}
                </if>
                <if test="conditionParamRef.staffCount == null">
                    ${_conditionType_} a.staffCount is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('staffCountList') and conditionParamRef.staffCountList.size() > 0">
                ${_conditionType_} a.staffCount in
                <foreach collection="conditionParamRef.staffCountList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('staffCountNotList') and conditionParamRef.staffCountNotList.size() > 0">
                ${_conditionType_} a.staffCount not in
                <foreach collection="conditionParamRef.staffCountNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('staffCountStart') and conditionParamRef.staffCountStart != null">
                ${_conditionType_} a.staffCount <![CDATA[ >= ]]> #{${_conditionParam_}.staffCountStart}
            </if>
            <if test="conditionParamRef.containsKey('staffCountEnd') and conditionParamRef.staffCountEnd != null">
                ${_conditionType_} a.staffCount <![CDATA[ <= ]]> #{${_conditionParam_}.staffCountEnd}
            </if>

            <if test="conditionParamRef.containsKey('attendCount')">
                <if test="conditionParamRef.attendCount != null ">
                    ${_conditionType_} a.attendCount = #{${_conditionParam_}.attendCount}
                </if>
                <if test="conditionParamRef.attendCount == null">
                    ${_conditionType_} a.attendCount is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('attendCountList') and conditionParamRef.attendCountList.size() > 0">
                ${_conditionType_} a.attendCount in
                <foreach collection="conditionParamRef.attendCountList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('attendCountNotList') and conditionParamRef.attendCountNotList.size() > 0">
                ${_conditionType_} a.attendCount not in
                <foreach collection="conditionParamRef.attendCountNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('attendCountStart') and conditionParamRef.attendCountStart != null">
                ${_conditionType_} a.attendCount <![CDATA[ >= ]]> #{${_conditionParam_}.attendCountStart}
            </if>
            <if test="conditionParamRef.containsKey('attendCountEnd') and conditionParamRef.attendCountEnd != null">
                ${_conditionType_} a.attendCount <![CDATA[ <= ]]> #{${_conditionParam_}.attendCountEnd}
            </if>

            <if test="conditionParamRef.containsKey('assessCount')">
                <if test="conditionParamRef.assessCount != null ">
                    ${_conditionType_} a.assessCount = #{${_conditionParam_}.assessCount}
                </if>
                <if test="conditionParamRef.assessCount == null">
                    ${_conditionType_} a.assessCount is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('assessCountList') and conditionParamRef.assessCountList.size() > 0">
                ${_conditionType_} a.assessCount in
                <foreach collection="conditionParamRef.assessCountList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('assessCountNotList') and conditionParamRef.assessCountNotList.size() > 0">
                ${_conditionType_} a.assessCount not in
                <foreach collection="conditionParamRef.assessCountNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('assessCountStart') and conditionParamRef.assessCountStart != null">
                ${_conditionType_} a.assessCount <![CDATA[ >= ]]> #{${_conditionParam_}.assessCountStart}
            </if>
            <if test="conditionParamRef.containsKey('assessCountEnd') and conditionParamRef.assessCountEnd != null">
                ${_conditionType_} a.assessCount <![CDATA[ <= ]]> #{${_conditionParam_}.assessCountEnd}
            </if>

            <if test="conditionParamRef.containsKey('workCount')">
                <if test="conditionParamRef.workCount != null ">
                    ${_conditionType_} a.workCount = #{${_conditionParam_}.workCount}
                </if>
                <if test="conditionParamRef.workCount == null">
                    ${_conditionType_} a.workCount is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('workCountList') and conditionParamRef.workCountList.size() > 0">
                ${_conditionType_} a.workCount in
                <foreach collection="conditionParamRef.workCountList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('workCountNotList') and conditionParamRef.workCountNotList.size() > 0">
                ${_conditionType_} a.workCount not in
                <foreach collection="conditionParamRef.workCountNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('workCountStart') and conditionParamRef.workCountStart != null">
                ${_conditionType_} a.workCount <![CDATA[ >= ]]> #{${_conditionParam_}.workCountStart}
            </if>
            <if test="conditionParamRef.containsKey('workCountEnd') and conditionParamRef.workCountEnd != null">
                ${_conditionType_} a.workCount <![CDATA[ <= ]]> #{${_conditionParam_}.workCountEnd}
            </if>

            <if test="conditionParamRef.containsKey('effectCount')">
                <if test="conditionParamRef.effectCount != null ">
                    ${_conditionType_} a.effectCount = #{${_conditionParam_}.effectCount}
                </if>
                <if test="conditionParamRef.effectCount == null">
                    ${_conditionType_} a.effectCount is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('effectCountList') and conditionParamRef.effectCountList.size() > 0">
                ${_conditionType_} a.effectCount in
                <foreach collection="conditionParamRef.effectCountList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('effectCountNotList') and conditionParamRef.effectCountNotList.size() > 0">
                ${_conditionType_} a.effectCount not in
                <foreach collection="conditionParamRef.effectCountNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('effectCountStart') and conditionParamRef.effectCountStart != null">
                ${_conditionType_} a.effectCount <![CDATA[ >= ]]> #{${_conditionParam_}.effectCountStart}
            </if>
            <if test="conditionParamRef.containsKey('effectCountEnd') and conditionParamRef.effectCountEnd != null">
                ${_conditionType_} a.effectCount <![CDATA[ <= ]]> #{${_conditionParam_}.effectCountEnd}
            </if>

            <if test="conditionParamRef.containsKey('otherCount')">
                <if test="conditionParamRef.otherCount != null ">
                    ${_conditionType_} a.otherCount = #{${_conditionParam_}.otherCount}
                </if>
                <if test="conditionParamRef.otherCount == null">
                    ${_conditionType_} a.otherCount is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('otherCountList') and conditionParamRef.otherCountList.size() > 0">
                ${_conditionType_} a.otherCount in
                <foreach collection="conditionParamRef.otherCountList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('otherCountNotList') and conditionParamRef.otherCountNotList.size() > 0">
                ${_conditionType_} a.otherCount not in
                <foreach collection="conditionParamRef.otherCountNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('otherCountStart') and conditionParamRef.otherCountStart != null">
                ${_conditionType_} a.otherCount <![CDATA[ >= ]]> #{${_conditionParam_}.otherCountStart}
            </if>
            <if test="conditionParamRef.containsKey('otherCountEnd') and conditionParamRef.otherCountEnd != null">
                ${_conditionType_} a.otherCount <![CDATA[ <= ]]> #{${_conditionParam_}.otherCountEnd}
            </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>
    </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('staffIds')">
                        a.staffIds
                        <if test='orderCol.staffIds != null and "DESC".equalsIgnoreCase(orderCol.staffIds)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('staffNames')">
                        a.staffNames
                        <if test='orderCol.staffNames != null and "DESC".equalsIgnoreCase(orderCol.staffNames)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('staffCount')">
                        a.staffCount
                        <if test='orderCol.staffCount != null and "DESC".equalsIgnoreCase(orderCol.staffCount)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('attendCount')">
                        a.attendCount
                        <if test='orderCol.attendCount != null and "DESC".equalsIgnoreCase(orderCol.attendCount)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('assessCount')">
                        a.assessCount
                        <if test='orderCol.assessCount != null and "DESC".equalsIgnoreCase(orderCol.assessCount)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('workCount')">
                        a.workCount
                        <if test='orderCol.workCount != null and "DESC".equalsIgnoreCase(orderCol.workCount)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('effectCount')">
                        a.effectCount
                        <if test='orderCol.effectCount != null and "DESC".equalsIgnoreCase(orderCol.effectCount)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('otherCount')">
                        a.otherCount
                        <if test='orderCol.otherCount != null and "DESC".equalsIgnoreCase(orderCol.otherCount)'>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>