<?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.realtime.dao.ibatis.RealtimeDataflowDaoImpl">

    <!-- 字段和属性映射 -->
    <resultMap type="RealtimeDataflowEntity" id="RealtimeDataflowEntity-Map">
        <id  property="id" column="id" />
        <result property="siteId" column="siteId" />
        <result property="siteName" column="siteName" />
        <result property="personId" column="personId" />
        <result property="name" column="name" />
        <result property="device" column="device" />
        <result property="detectTime" column="detectTime" />
        <result property="contact" column="contact" />
        <result property="idNumber" column="idNumber" />
        <result property="isBooking" column="isBooking" />
        <result property="queueNum" column="queueNum" />
        <result property="location" column="location" />
        <result property="picture" column="picture" />
        <result property="picUri" column="picUri" />
        <result property="serverIndexCode" column="serverIndexCode" />
        <result property="eventId" column="eventId" />
        <result property="eventType" column="eventType" />
        <result property="createTime" column="createTime" />
        <result property="createUserId" column="createUserId" />
        <result property="updateTime" column="updateTime" />
        <result property="updateUserId" column="updateUserId" />

    </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('siteId') or colPickMode == 1 and data.containsKey('siteId')))">
                a.siteId,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('siteName') or colPickMode == 1 and data.containsKey('siteName')))">
                a.siteName,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('personId') or colPickMode == 1 and data.containsKey('personId')))">
                a.personId,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('name') or colPickMode == 1 and data.containsKey('name')))">
                a.name,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('device') or colPickMode == 1 and data.containsKey('device')))">
                a.device,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('detectTime') or colPickMode == 1 and data.containsKey('detectTime')))">
                a.detectTime,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('contact') or colPickMode == 1 and data.containsKey('contact')))">
                a.contact,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('idNumber') or colPickMode == 1 and data.containsKey('idNumber')))">
                a.idNumber,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('isBooking') or colPickMode == 1 and data.containsKey('isBooking')))">
                a.isBooking,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('queueNum') or colPickMode == 1 and data.containsKey('queueNum')))">
                a.queueNum,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('location') or colPickMode == 1 and data.containsKey('location')))">
                a.location,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('picture') or colPickMode == 1 and data.containsKey('picture')))">
                a.picture,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('picUri') or colPickMode == 1 and data.containsKey('picUri')))">
                a.picUri,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('serverIndexCode') or colPickMode == 1 and data.containsKey('serverIndexCode')))">
                a.serverIndexCode,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('eventId') or colPickMode == 1 and data.containsKey('eventId')))">
                a.eventId,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('eventType') or colPickMode == 1 and data.containsKey('eventType')))">
                a.eventType,
            </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('createUserId') or colPickMode == 1 and data.containsKey('createUserId')))">
                a.createUserId,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateTime') or colPickMode == 1 and data.containsKey('updateTime')))">
                a.updateTime,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateUserId') or colPickMode == 1 and data.containsKey('updateUserId')))">
                a.updateUserId,
            </if>
        </trim>
    </sql>
    <!-- 新增 区分主键自增加还是业务插入 -->
    <insert id="insert" parameterType="RealtimeDataflowEntity"  useGeneratedKeys="true" keyProperty="id">
        insert into mortals_xhx_realtime_dataflow
        (siteId,siteName,personId,name,device,detectTime,contact,idNumber,isBooking,queueNum,location,picture,picUri,serverIndexCode,eventId,eventType,createTime,createUserId,updateTime,updateUserId)
        VALUES
        (#{siteId},#{siteName},#{personId},#{name},#{device},#{detectTime},#{contact},#{idNumber},#{isBooking},#{queueNum},#{location},#{picture},#{picUri},#{serverIndexCode},#{eventId},#{eventType},#{createTime},#{createUserId},#{updateTime},#{updateUserId})
    </insert>

    <!-- 批量新增 -->
    <insert id="insertBatch" parameterType="paramDto">
        insert into mortals_xhx_realtime_dataflow
        (siteId,siteName,personId,name,device,detectTime,contact,idNumber,isBooking,queueNum,location,picture,picUri,serverIndexCode,eventId,eventType,createTime,createUserId,updateTime,updateUserId)
        VALUES
        <foreach collection="data.dataList" item="item" index="index" separator="," >
            (#{item.siteId},#{item.siteName},#{item.personId},#{item.name},#{item.device},#{item.detectTime},#{item.contact},#{item.idNumber},#{item.isBooking},#{item.queueNum},#{item.location},#{item.picture},#{item.picUri},#{item.serverIndexCode},#{item.eventId},#{item.eventType},#{item.createTime},#{item.createUserId},#{item.updateTime},#{item.updateUserId})
        </foreach>
    </insert>


    <!-- 根据ParamDto更新 -->
    <update id="update" parameterType="paramDto">
        update mortals_xhx_realtime_dataflow as a
        set
        <trim suffixOverrides="," suffix="">
            <if test="(colPickMode==0 and data.containsKey('siteId')) or (colPickMode==1 and !data.containsKey('siteId'))">
                a.siteId=#{data.siteId},
            </if>
            <if test="(colPickMode==0 and data.containsKey('siteIdIncrement')) or (colPickMode==1 and !data.containsKey('siteIdIncrement'))">
                a.siteId=ifnull(a.siteId,0) + #{data.siteIdIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('siteName')) or (colPickMode==1 and !data.containsKey('siteName'))">
                a.siteName=#{data.siteName},
            </if>
            <if test="(colPickMode==0 and data.containsKey('personId')) or (colPickMode==1 and !data.containsKey('personId'))">
                a.personId=#{data.personId},
            </if>
            <if test="(colPickMode==0 and data.containsKey('personIdIncrement')) or (colPickMode==1 and !data.containsKey('personIdIncrement'))">
                a.personId=ifnull(a.personId,0) + #{data.personIdIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('name')) or (colPickMode==1 and !data.containsKey('name'))">
                a.name=#{data.name},
            </if>
            <if test="(colPickMode==0 and data.containsKey('device')) or (colPickMode==1 and !data.containsKey('device'))">
                a.device=#{data.device},
            </if>
            <if test="(colPickMode==0 and data.containsKey('detectTime')) or (colPickMode==1 and !data.containsKey('detectTime'))">
                a.detectTime=#{data.detectTime},
            </if>
            <if test="(colPickMode==0 and data.containsKey('contact')) or (colPickMode==1 and !data.containsKey('contact'))">
                a.contact=#{data.contact},
            </if>
            <if test="(colPickMode==0 and data.containsKey('idNumber')) or (colPickMode==1 and !data.containsKey('idNumber'))">
                a.idNumber=#{data.idNumber},
            </if>
            <if test="(colPickMode==0 and data.containsKey('isBooking')) or (colPickMode==1 and !data.containsKey('isBooking'))">
                a.isBooking=#{data.isBooking},
            </if>
            <if test="(colPickMode==0 and data.containsKey('isBookingIncrement')) or (colPickMode==1 and !data.containsKey('isBookingIncrement'))">
                a.isBooking=ifnull(a.isBooking,0) + #{data.isBookingIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('queueNum')) or (colPickMode==1 and !data.containsKey('queueNum'))">
                a.queueNum=#{data.queueNum},
            </if>
            <if test="(colPickMode==0 and data.containsKey('location')) or (colPickMode==1 and !data.containsKey('location'))">
                a.location=#{data.location},
            </if>
            <if test="(colPickMode==0 and data.containsKey('picture')) or (colPickMode==1 and !data.containsKey('picture'))">
                a.picture=#{data.picture},
            </if>
            <if test="(colPickMode==0 and data.containsKey('picUri')) or (colPickMode==1 and !data.containsKey('picUri'))">
                a.picUri=#{data.picUri},
            </if>
            <if test="(colPickMode==0 and data.containsKey('serverIndexCode')) or (colPickMode==1 and !data.containsKey('serverIndexCode'))">
                a.serverIndexCode=#{data.serverIndexCode},
            </if>
            <if test="(colPickMode==0 and data.containsKey('eventId')) or (colPickMode==1 and !data.containsKey('eventId'))">
                a.eventId=#{data.eventId},
            </if>
            <if test="(colPickMode==0 and data.containsKey('eventType')) or (colPickMode==1 and !data.containsKey('eventType'))">
                a.eventType=#{data.eventType},
            </if>
            <if test="(colPickMode==0 and data.containsKey('eventTypeIncrement')) or (colPickMode==1 and !data.containsKey('eventTypeIncrement'))">
                a.eventType=ifnull(a.eventType,0) + #{data.eventTypeIncrement},
            </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('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('updateTime')) or (colPickMode==1 and !data.containsKey('updateTime'))">
                a.updateTime=#{data.updateTime},
            </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>
        </trim>
        <trim suffixOverrides="where" suffix="">
            where
            <trim prefixOverrides="and" prefix="">
                <include refid="_condition_"/>
            </trim>
        </trim>
    </update>
    <!-- 批量更新 -->
    <update id="updateBatch" parameterType="paramDto">
        update mortals_xhx_realtime_dataflow as a
        <trim prefix="set" suffixOverrides=",">
            <trim prefix="siteId=(case" suffix="ELSE siteId end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('siteId')) or (colPickMode==1 and !item.containsKey('siteId'))">
                            when a.id=#{item.id} then #{item.siteId}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('siteIdIncrement')) or (colPickMode==1 and !item.containsKey('siteIdIncrement'))">
                            when a.id=#{item.id} then ifnull(a.siteId,0) + #{item.siteIdIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="siteName=(case" suffix="ELSE siteName end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('siteName')) or (colPickMode==1 and !item.containsKey('siteName'))">
                        when a.id=#{item.id} then #{item.siteName}
                    </if>
                </foreach>
            </trim>
            <trim prefix="personId=(case" suffix="ELSE personId end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('personId')) or (colPickMode==1 and !item.containsKey('personId'))">
                            when a.id=#{item.id} then #{item.personId}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('personIdIncrement')) or (colPickMode==1 and !item.containsKey('personIdIncrement'))">
                            when a.id=#{item.id} then ifnull(a.personId,0) + #{item.personIdIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="name=(case" suffix="ELSE name end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('name')) or (colPickMode==1 and !item.containsKey('name'))">
                        when a.id=#{item.id} then #{item.name}
                    </if>
                </foreach>
            </trim>
            <trim prefix="device=(case" suffix="ELSE device end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('device')) or (colPickMode==1 and !item.containsKey('device'))">
                        when a.id=#{item.id} then #{item.device}
                    </if>
                </foreach>
            </trim>
            <trim prefix="detectTime=(case" suffix="ELSE detectTime end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('detectTime')) or (colPickMode==1 and !item.containsKey('detectTime'))">
                        when a.id=#{item.id} then #{item.detectTime}
                    </if>
                </foreach>
            </trim>
            <trim prefix="contact=(case" suffix="ELSE contact end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('contact')) or (colPickMode==1 and !item.containsKey('contact'))">
                        when a.id=#{item.id} then #{item.contact}
                    </if>
                </foreach>
            </trim>
            <trim prefix="idNumber=(case" suffix="ELSE idNumber end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('idNumber')) or (colPickMode==1 and !item.containsKey('idNumber'))">
                        when a.id=#{item.id} then #{item.idNumber}
                    </if>
                </foreach>
            </trim>
            <trim prefix="isBooking=(case" suffix="ELSE isBooking end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('isBooking')) or (colPickMode==1 and !item.containsKey('isBooking'))">
                            when a.id=#{item.id} then #{item.isBooking}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('isBookingIncrement')) or (colPickMode==1 and !item.containsKey('isBookingIncrement'))">
                            when a.id=#{item.id} then ifnull(a.isBooking,0) + #{item.isBookingIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="queueNum=(case" suffix="ELSE queueNum end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('queueNum')) or (colPickMode==1 and !item.containsKey('queueNum'))">
                        when a.id=#{item.id} then #{item.queueNum}
                    </if>
                </foreach>
            </trim>
            <trim prefix="location=(case" suffix="ELSE location end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('location')) or (colPickMode==1 and !item.containsKey('location'))">
                        when a.id=#{item.id} then #{item.location}
                    </if>
                </foreach>
            </trim>
            <trim prefix="picture=(case" suffix="ELSE picture end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('picture')) or (colPickMode==1 and !item.containsKey('picture'))">
                        when a.id=#{item.id} then #{item.picture}
                    </if>
                </foreach>
            </trim>
            <trim prefix="picUri=(case" suffix="ELSE picUri end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('picUri')) or (colPickMode==1 and !item.containsKey('picUri'))">
                        when a.id=#{item.id} then #{item.picUri}
                    </if>
                </foreach>
            </trim>
            <trim prefix="serverIndexCode=(case" suffix="ELSE serverIndexCode end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('serverIndexCode')) or (colPickMode==1 and !item.containsKey('serverIndexCode'))">
                        when a.id=#{item.id} then #{item.serverIndexCode}
                    </if>
                </foreach>
            </trim>
            <trim prefix="eventId=(case" suffix="ELSE eventId end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('eventId')) or (colPickMode==1 and !item.containsKey('eventId'))">
                        when a.id=#{item.id} then #{item.eventId}
                    </if>
                </foreach>
            </trim>
            <trim prefix="eventType=(case" suffix="ELSE eventType end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('eventType')) or (colPickMode==1 and !item.containsKey('eventType'))">
                            when a.id=#{item.id} then #{item.eventType}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('eventTypeIncrement')) or (colPickMode==1 and !item.containsKey('eventTypeIncrement'))">
                            when a.id=#{item.id} then ifnull(a.eventType,0) + #{item.eventTypeIncrement}
                        </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="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="updateTime=(case" suffix="ELSE updateTime end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('updateTime')) or (colPickMode==1 and !item.containsKey('updateTime'))">
                        when a.id=#{item.id} then #{item.updateTime}
                    </if>
                </foreach>
            </trim>
            <trim prefix="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>
        where id in
        <foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")">
            #{item.id}
        </foreach>
    </update>
    <!-- 根据主健查询 -->
    <select id="getByKey" parameterType="paramDto" resultMap="RealtimeDataflowEntity-Map">
        select <include refid="_columns"/>
        from mortals_xhx_realtime_dataflow as a
        where a.id=#{condition.id}
    </select>
    <!-- 根据主健删除 -->
    <delete id="deleteByKey" parameterType="paramDto">
        delete a.* from mortals_xhx_realtime_dataflow as a where a.id=#{condition.id}
    </delete>
    <!-- 根据主健删除一批，针对单一主健有效 -->
    <delete id="deleteByKeys">
        delete from mortals_xhx_realtime_dataflow where id in
        <foreach collection="array" item="item" index="index" open="(" separator="," close=")">
            #{item}
        </foreach>
    </delete>
    <!-- 根据主健列表删除一批，针对单一主健有效 -->
    <delete id="deleteByKeyList">
        delete from mortals_xhx_realtime_dataflow where id in
        <foreach collection="list" item="item" index="index" open="(" separator="," close=")">
            #{item}
        </foreach>
    </delete>

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


        <if test="conditionParamRef.containsKey('siteName')">
            <if test="conditionParamRef.siteName != null and conditionParamRef.siteName != ''">
                ${_conditionType_} a.siteName like #{${_conditionParam_}.siteName}
            </if>
            <if test="conditionParamRef.siteName == null">
                ${_conditionType_} a.siteName is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('siteNameList') and conditionParamRef.siteNameList.size() > 0">
            ${_conditionType_} a.siteName in
            <foreach collection="conditionParamRef.siteNameList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('siteNameNotList') and conditionParamRef.siteNameNotList.size() > 0">
            ${_conditionType_} a.siteName not in
            <foreach collection="conditionParamRef.siteNameNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('personId')">
            <if test="conditionParamRef.personId != null ">
                ${_conditionType_} a.personId = #{${_conditionParam_}.personId}
            </if>
            <if test="conditionParamRef.personId == null">
                ${_conditionType_} a.personId is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('personIdList') and conditionParamRef.personIdList.size() > 0">
            ${_conditionType_} a.personId in
            <foreach collection="conditionParamRef.personIdList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('personIdNotList') and conditionParamRef.personIdNotList.size() > 0">
            ${_conditionType_} a.personId not in
            <foreach collection="conditionParamRef.personIdNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('personIdStart') and conditionParamRef.personIdStart != null">
            ${_conditionType_} a.personId <![CDATA[ >= ]]> #{${_conditionParam_}.personIdStart}
        </if>
        <if test="conditionParamRef.containsKey('personIdEnd') and conditionParamRef.personIdEnd != null">
            ${_conditionType_} a.personId <![CDATA[ <= ]]> #{${_conditionParam_}.personIdEnd}
        </if>


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

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

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

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

        <if test="conditionParamRef.containsKey('idNumber')">
            <if test="conditionParamRef.idNumber != null and conditionParamRef.idNumber != ''">
                ${_conditionType_} a.idNumber like #{${_conditionParam_}.idNumber}
            </if>
            <if test="conditionParamRef.idNumber == null">
                ${_conditionType_} a.idNumber is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('idNumberList') and conditionParamRef.idNumberList.size() > 0">
            ${_conditionType_} a.idNumber in
            <foreach collection="conditionParamRef.idNumberList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('idNumberNotList') and conditionParamRef.idNumberNotList.size() > 0">
            ${_conditionType_} a.idNumber not in
            <foreach collection="conditionParamRef.idNumberNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('isBooking')">
            <if test="conditionParamRef.isBooking != null ">
                ${_conditionType_} a.isBooking = #{${_conditionParam_}.isBooking}
            </if>
            <if test="conditionParamRef.isBooking == null">
                ${_conditionType_} a.isBooking is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('isBookingList') and conditionParamRef.isBookingList.size() > 0">
            ${_conditionType_} a.isBooking in
            <foreach collection="conditionParamRef.isBookingList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('isBookingNotList') and conditionParamRef.isBookingNotList.size() > 0">
            ${_conditionType_} a.isBooking not in
            <foreach collection="conditionParamRef.isBookingNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('isBookingStart') and conditionParamRef.isBookingStart != null">
            ${_conditionType_} a.isBooking <![CDATA[ >= ]]> #{${_conditionParam_}.isBookingStart}
        </if>
        <if test="conditionParamRef.containsKey('isBookingEnd') and conditionParamRef.isBookingEnd != null">
            ${_conditionType_} a.isBooking <![CDATA[ <= ]]> #{${_conditionParam_}.isBookingEnd}
        </if>


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

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

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

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

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

        <if test="conditionParamRef.containsKey('eventId')">
            <if test="conditionParamRef.eventId != null and conditionParamRef.eventId != ''">
                ${_conditionType_} a.eventId like #{${_conditionParam_}.eventId}
            </if>
            <if test="conditionParamRef.eventId == null">
                ${_conditionType_} a.eventId is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('eventIdList') and conditionParamRef.eventIdList.size() > 0">
            ${_conditionType_} a.eventId in
            <foreach collection="conditionParamRef.eventIdList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('eventIdNotList') and conditionParamRef.eventIdNotList.size() > 0">
            ${_conditionType_} a.eventId not in
            <foreach collection="conditionParamRef.eventIdNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('eventType')">
            <if test="conditionParamRef.eventType != null ">
                ${_conditionType_} a.eventType = #{${_conditionParam_}.eventType}
            </if>
            <if test="conditionParamRef.eventType == null">
                ${_conditionType_} a.eventType is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('eventTypeList') and conditionParamRef.eventTypeList.size() > 0">
            ${_conditionType_} a.eventType in
            <foreach collection="conditionParamRef.eventTypeList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('eventTypeNotList') and conditionParamRef.eventTypeNotList.size() > 0">
            ${_conditionType_} a.eventType not in
            <foreach collection="conditionParamRef.eventTypeNotList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('eventTypeStart') and conditionParamRef.eventTypeStart != null">
            ${_conditionType_} a.eventType <![CDATA[ >= ]]> #{${_conditionParam_}.eventTypeStart}
        </if>
        <if test="conditionParamRef.containsKey('eventTypeEnd') and conditionParamRef.eventTypeEnd != null">
            ${_conditionType_} a.eventType <![CDATA[ <= ]]> #{${_conditionParam_}.eventTypeEnd}
        </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('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('updateTime')">
            <if test="conditionParamRef.updateTime != null ">
                ${_conditionType_} a.updateTime = #{${_conditionParam_}.updateTime}
            </if>
            <if test="conditionParamRef.updateTime == null">
                ${_conditionType_} a.updateTime is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('updateTimeStart') and conditionParamRef.updateTimeStart != null and conditionParamRef.updateTimeStart!=''">
            ${_conditionType_} a.updateTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
        </if>
        <if test="conditionParamRef.containsKey('updateTimeEnd') and conditionParamRef.updateTimeEnd != null and conditionParamRef.updateTimeEnd!=''">
            ${_conditionType_} a.updateTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
        </if>
        <if test="conditionParamRef.containsKey('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>

    </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('siteId')">
                    a.siteId
                    <if test='orderCol.siteId != null and "DESC".equalsIgnoreCase(orderCol.siteId)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('siteName')">
                    a.siteName
                    <if test='orderCol.siteName != null and "DESC".equalsIgnoreCase(orderCol.siteName)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('personId')">
                    a.personId
                    <if test='orderCol.personId != null and "DESC".equalsIgnoreCase(orderCol.personId)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('name')">
                    a.name
                    <if test='orderCol.name != null and "DESC".equalsIgnoreCase(orderCol.name)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('device')">
                    a.device
                    <if test='orderCol.device != null and "DESC".equalsIgnoreCase(orderCol.device)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('detectTime')">
                    a.detectTime
                    <if test='orderCol.detectTime != null and "DESC".equalsIgnoreCase(orderCol.detectTime)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('contact')">
                    a.contact
                    <if test='orderCol.contact != null and "DESC".equalsIgnoreCase(orderCol.contact)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('idNumber')">
                    a.idNumber
                    <if test='orderCol.idNumber != null and "DESC".equalsIgnoreCase(orderCol.idNumber)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('isBooking')">
                    a.isBooking
                    <if test='orderCol.isBooking != null and "DESC".equalsIgnoreCase(orderCol.isBooking)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('queueNum')">
                    a.queueNum
                    <if test='orderCol.queueNum != null and "DESC".equalsIgnoreCase(orderCol.queueNum)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('location')">
                    a.location
                    <if test='orderCol.location != null and "DESC".equalsIgnoreCase(orderCol.location)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('picture')">
                    a.picture
                    <if test='orderCol.picture != null and "DESC".equalsIgnoreCase(orderCol.picture)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('picUri')">
                    a.picUri
                    <if test='orderCol.picUri != null and "DESC".equalsIgnoreCase(orderCol.picUri)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('serverIndexCode')">
                    a.serverIndexCode
                    <if test='orderCol.serverIndexCode != null and "DESC".equalsIgnoreCase(orderCol.serverIndexCode)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('eventId')">
                    a.eventId
                    <if test='orderCol.eventId != null and "DESC".equalsIgnoreCase(orderCol.eventId)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('eventType')">
                    a.eventType
                    <if test='orderCol.eventType != null and "DESC".equalsIgnoreCase(orderCol.eventType)'>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('createUserId')">
                    a.createUserId
                    <if test='orderCol.createUserId != null and "DESC".equalsIgnoreCase(orderCol.createUserId)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('updateTime')">
                    a.updateTime
                    <if test='orderCol.updateTime != null and "DESC".equalsIgnoreCase(orderCol.updateTime)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('updateUserId')">
                    a.updateUserId
                    <if test='orderCol.updateUserId != null and "DESC".equalsIgnoreCase(orderCol.updateUserId)'>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>