<?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.comment.dao.ibatis.CommentInfoDaoImpl">

    <!-- 字段和属性映射 -->
    <resultMap type="CommentInfoEntity" id="CommentInfoEntity-Map">
        <result property="id" column="id" />
        <result property="type" column="type" />
        <result property="personalCode" column="personalCode" />
        <result property="time" column="time" />
        <result property="taskId" column="taskId" />
        <result property="activityId" column="activityId" />
        <result property="activityName" column="activityName" />
        <result property="processInstanceId" column="processInstanceId" />
        <result property="action" column="action" />
        <result property="message" column="message" />
        <result property="createUser" column="createUser" />
        <result property="createTime" column="createTime" />
    </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 as id,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('type') or colPickMode == 1 and data.containsKey('type')))">
                    a.type as type,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('personalCode') or colPickMode == 1 and data.containsKey('personalCode')))">
                    a.personalCode as personalCode,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('time') or colPickMode == 1 and data.containsKey('time')))">
                    a.time as time,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('taskId') or colPickMode == 1 and data.containsKey('taskId')))">
                    a.taskId as taskId,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('activityId') or colPickMode == 1 and data.containsKey('activityId')))">
                    a.activityId as activityId,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('activityName') or colPickMode == 1 and data.containsKey('activityName')))">
                    a.activityName as activityName,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('processInstanceId') or colPickMode == 1 and data.containsKey('processInstanceId')))">
                    a.processInstanceId as processInstanceId,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('action') or colPickMode == 1 and data.containsKey('action')))">
                    a.action as action,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('message') or colPickMode == 1 and data.containsKey('message')))">
                    a.message as message,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createUser') or colPickMode == 1 and data.containsKey('createUser')))">
                    a.createUser as createUser,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createTime') or colPickMode == 1 and data.containsKey('createTime')))">
                    a.createTime as createTime,
                </if>
        </trim>
    </sql>
    <!-- 新增 -->
        <insert id="insert" parameterType="CommentInfoEntity" useGeneratedKeys="true" keyProperty="id">
            insert into mortals_flow_comment_info
            (type,personalCode,time,taskId,activityId,activityName,processInstanceId,action,message,createUser,createTime)
            VALUES
            (#{type},#{personalCode},#{time},#{taskId},#{activityId},#{activityName},#{processInstanceId},#{action},#{message},#{createUser},#{createTime})
        </insert>

        <!-- 批量新增 -->
        <insert id="insertBatch" parameterType="paramDto">
            insert into mortals_flow_comment_info
            (type,personalCode,time,taskId,activityId,activityName,processInstanceId,action,message,createUser,createTime)
            VALUES
            <foreach collection="data.dataList" item="item" index="index" separator="," >
                (#{item.type},#{item.personalCode},#{item.time},#{item.taskId},#{item.activityId},#{item.activityName},#{item.processInstanceId},#{item.action},#{item.message},#{item.createUser},#{item.createTime})
            </foreach>
        </insert>
    <!-- 根据ParamDto更新 -->
    <update id="update" parameterType="paramDto">
        update mortals_flow_comment_info as a
        set
        <trim suffixOverrides="," suffix="">
            <if test="(colPickMode==0 and data.containsKey('type')) or (colPickMode==1 and !data.containsKey('type'))">
                a.type=#{data.type},
            </if>
            <if test="(colPickMode==0 and data.containsKey('personalCode')) or (colPickMode==1 and !data.containsKey('personalCode'))">
                a.personalCode=#{data.personalCode},
            </if>
            <if test="(colPickMode==0 and data.containsKey('time')) or (colPickMode==1 and !data.containsKey('time'))">
                a.time=#{data.time},
            </if>
            <if test="(colPickMode==0 and data.containsKey('taskId')) or (colPickMode==1 and !data.containsKey('taskId'))">
                a.taskId=#{data.taskId},
            </if>
            <if test="(colPickMode==0 and data.containsKey('activityId')) or (colPickMode==1 and !data.containsKey('activityId'))">
                a.activityId=#{data.activityId},
            </if>
            <if test="(colPickMode==0 and data.containsKey('activityName')) or (colPickMode==1 and !data.containsKey('activityName'))">
                a.activityName=#{data.activityName},
            </if>
            <if test="(colPickMode==0 and data.containsKey('processInstanceId')) or (colPickMode==1 and !data.containsKey('processInstanceId'))">
                a.processInstanceId=#{data.processInstanceId},
            </if>
            <if test="(colPickMode==0 and data.containsKey('action')) or (colPickMode==1 and !data.containsKey('action'))">
                a.action=#{data.action},
            </if>
            <if test="(colPickMode==0 and data.containsKey('message')) or (colPickMode==1 and !data.containsKey('message'))">
                a.message=#{data.message},
            </if>
            <if test="(colPickMode==0 and data.containsKey('createUser')) or (colPickMode==1 and !data.containsKey('createUser'))">
                a.createUser=#{data.createUser},
            </if>
            <if test="(colPickMode==0 and data.containsKey('createTime')) or (colPickMode==1 and !data.containsKey('createTime'))">
                a.createTime=#{data.createTime},
            </if>
        </trim>
        <trim suffixOverrides="where" suffix="">
            where
            <trim prefixOverrides="and" prefix="">
                <include refid="_condition_"/>
            </trim>
        </trim>
    </update>
    <!-- 批量更新 -->
    <update id="updateBatch" parameterType="paramDto">
        update mortals_flow_comment_info as a
        <trim prefix="set" suffixOverrides=",">


                <trim prefix="type=(case" suffix="ELSE type end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('type')) or (colPickMode==1 and !item.containsKey('type'))">
                            when a.id=#{item.id} then #{item.type}
                        </if>
                    </foreach>
                </trim>

                <trim prefix="personalCode=(case" suffix="ELSE personalCode end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('personalCode')) or (colPickMode==1 and !item.containsKey('personalCode'))">
                            when a.id=#{item.id} then #{item.personalCode}
                        </if>
                    </foreach>
                </trim>

                <trim prefix="time=(case" suffix="ELSE time end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('time')) or (colPickMode==1 and !item.containsKey('time'))">
                            when a.id=#{item.id} then #{item.time}
                        </if>
                    </foreach>
                </trim>

                <trim prefix="taskId=(case" suffix="ELSE taskId end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('taskId')) or (colPickMode==1 and !item.containsKey('taskId'))">
                            when a.id=#{item.id} then #{item.taskId}
                        </if>
                    </foreach>
                </trim>

                <trim prefix="activityId=(case" suffix="ELSE activityId end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('activityId')) or (colPickMode==1 and !item.containsKey('activityId'))">
                            when a.id=#{item.id} then #{item.activityId}
                        </if>
                    </foreach>
                </trim>

                <trim prefix="activityName=(case" suffix="ELSE activityName end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('activityName')) or (colPickMode==1 and !item.containsKey('activityName'))">
                            when a.id=#{item.id} then #{item.activityName}
                        </if>
                    </foreach>
                </trim>

                <trim prefix="processInstanceId=(case" suffix="ELSE processInstanceId end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('processInstanceId')) or (colPickMode==1 and !item.containsKey('processInstanceId'))">
                            when a.id=#{item.id} then #{item.processInstanceId}
                        </if>
                    </foreach>
                </trim>

                <trim prefix="action=(case" suffix="ELSE action end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('action')) or (colPickMode==1 and !item.containsKey('action'))">
                            when a.id=#{item.id} then #{item.action}
                        </if>
                    </foreach>
                </trim>

                <trim prefix="message=(case" suffix="ELSE message end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('message')) or (colPickMode==1 and !item.containsKey('message'))">
                            when a.id=#{item.id} then #{item.message}
                        </if>
                    </foreach>
                </trim>

                <trim prefix="createUser=(case" suffix="ELSE createUser end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('createUser')) or (colPickMode==1 and !item.containsKey('createUser'))">
                            when a.id=#{item.id} then #{item.createUser}
                        </if>
                    </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>
        where id in
        <foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")">
            #{item.id}
        </foreach>
    </update>
    <!-- 根据主健查询 -->
    <select id="getByKey" parameterType="paramDto" resultMap="CommentInfoEntity-Map">
        select <include refid="_columns"/>
        from mortals_flow_comment_info as a
        where a.id=#{condition.id}
    </select>
    <!-- 根据主健删除 -->
    <delete id="deleteByKey" parameterType="paramDto">
        delete a.* from mortals_flow_comment_info as a where a.id=#{condition.id}
    </delete>
    <!-- 根据主健删除一批，针对单一主健有效 -->
    <delete id="deleteByKeys">
        delete from mortals_flow_comment_info where id in
        <foreach collection="array" item="item" index="index" open="(" separator="," close=")">
            #{item}
        </foreach>
    </delete>
    <!-- 根据paramDto删除一批 -->
    <delete id="deleteByMap" parameterType="paramDto">
        delete a.* from mortals_flow_comment_info as a
        <trim suffixOverrides="where" suffix="">
            where
            <trim prefixOverrides="and" prefix="">
                <include refid="_condition_"/>
            </trim>
        </trim>
    </delete>
    <!-- 获取列表 -->
    <select id="getList" parameterType="paramDto" resultMap="CommentInfoEntity-Map">
        select <include refid="_columns"/>
        from mortals_flow_comment_info 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_flow_comment_info 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('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('type')">
                <if test="conditionParamRef.type != null and conditionParamRef.type != ''">
                    ${_conditionType_} a.type like #{${_conditionParam_}.type}
                </if>
                <if test="conditionParamRef.type == null">
                    ${_conditionType_} a.type is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('typeList')">
                ${_conditionType_} a.type in
                <foreach collection="conditionParamRef.typeList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>

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

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

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

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

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

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

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

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

            <if test="conditionParamRef.containsKey('createUser')">
                <if test="conditionParamRef.createUser != null and conditionParamRef.createUser != ''">
                    ${_conditionType_} a.createUser like #{${_conditionParam_}.createUser}
                </if>
                <if test="conditionParamRef.createUser == null">
                    ${_conditionType_} a.createUser is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('createUserList')">
                ${_conditionType_} a.createUser in
                <foreach collection="conditionParamRef.createUserList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </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>
    </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('type')">
                        a.type
                        <if test='orderCol.type != null and "DESC".equalsIgnoreCase(orderCol.type)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('personalCode')">
                        a.personalCode
                        <if test='orderCol.personalCode != null and "DESC".equalsIgnoreCase(orderCol.personalCode)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('time')">
                        a.time
                        <if test='orderCol.time != null and "DESC".equalsIgnoreCase(orderCol.time)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('taskId')">
                        a.taskId
                        <if test='orderCol.taskId != null and "DESC".equalsIgnoreCase(orderCol.taskId)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('activityId')">
                        a.activityId
                        <if test='orderCol.activityId != null and "DESC".equalsIgnoreCase(orderCol.activityId)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('activityName')">
                        a.activityName
                        <if test='orderCol.activityName != null and "DESC".equalsIgnoreCase(orderCol.activityName)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('processInstanceId')">
                        a.processInstanceId
                        <if test='orderCol.processInstanceId != null and "DESC".equalsIgnoreCase(orderCol.processInstanceId)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('action')">
                        a.action
                        <if test='orderCol.action != null and "DESC".equalsIgnoreCase(orderCol.action)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('message')">
                        a.message
                        <if test='orderCol.message != null and "DESC".equalsIgnoreCase(orderCol.message)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('createUser')">
                        a.createUser
                        <if test='orderCol.createUser != null and "DESC".equalsIgnoreCase(orderCol.createUser)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('createTime')">
                        a.createTime
                        <if test='orderCol.createTime != null and "DESC".equalsIgnoreCase(orderCol.createTime)'>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>