<?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.device.dao.ibatis.DeviceStatDaoImpl">

    <!-- 字段和属性映射 -->
    <resultMap type="DeviceStatEntity" id="DeviceStatEntity-Map">
        <id  property="id" column="id" />
        <result property="siteId" column="siteId" />
        <result property="deviceTotalCount" column="deviceTotalCount" />
        <result property="deviceAddCount" column="deviceAddCount" />
        <result property="siteTotalCount" column="siteTotalCount" />
        <result property="siteAddCount" column="siteAddCount" />
        <result property="deviceOnlineCount" column="deviceOnlineCount" />
        <result property="deviceOnlineRatio" column="deviceOnlineRatio" />
        <result property="deviceOfflineCount" column="deviceOfflineCount" />
        <result property="deviceOfflineRatio" column="deviceOfflineRatio" />
        <result property="deviceStopCount" column="deviceStopCount" />
        <result property="deviceStopRatio" column="deviceStopRatio" />
        <result property="deviceUnActiveCount" column="deviceUnActiveCount" />
        <result property="deviceUnActiveRatio" column="deviceUnActiveRatio" />
        <result property="alarmTotalCount" column="alarmTotalCount" />
        <result property="alarmAddCount" column="alarmAddCount" />
        <result property="pushTotalCount" column="pushTotalCount" />
        <result property="pushAddCount" column="pushAddCount" />
        <result property="uploadMessageTotalCount" column="uploadMessageTotalCount" />
        <result property="downloadMessageTotalCount" column="downloadMessageTotalCount" />
        <result property="year" column="year" />
        <result property="month" column="month" />
        <result property="day" column="day" />
        <result property="createTime" column="createTime" />
        <result property="updateUserId" column="updateUserId" />
        <result property="updateTime" column="updateTime" />

    </resultMap>


    <!-- 表所有列 -->
    <sql id="_columns">
        <trim suffixOverrides="," suffix="">
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('id') or colPickMode == 1 and data.containsKey('id')))">
                a.id,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('siteId') or colPickMode == 1 and data.containsKey('siteId')))">
                a.siteId,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('deviceTotalCount') or colPickMode == 1 and data.containsKey('deviceTotalCount')))">
                a.deviceTotalCount,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('deviceAddCount') or colPickMode == 1 and data.containsKey('deviceAddCount')))">
                a.deviceAddCount,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('siteTotalCount') or colPickMode == 1 and data.containsKey('siteTotalCount')))">
                a.siteTotalCount,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('siteAddCount') or colPickMode == 1 and data.containsKey('siteAddCount')))">
                a.siteAddCount,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('deviceOnlineCount') or colPickMode == 1 and data.containsKey('deviceOnlineCount')))">
                a.deviceOnlineCount,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('deviceOnlineRatio') or colPickMode == 1 and data.containsKey('deviceOnlineRatio')))">
                a.deviceOnlineRatio,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('deviceOfflineCount') or colPickMode == 1 and data.containsKey('deviceOfflineCount')))">
                a.deviceOfflineCount,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('deviceOfflineRatio') or colPickMode == 1 and data.containsKey('deviceOfflineRatio')))">
                a.deviceOfflineRatio,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('deviceStopCount') or colPickMode == 1 and data.containsKey('deviceStopCount')))">
                a.deviceStopCount,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('deviceStopRatio') or colPickMode == 1 and data.containsKey('deviceStopRatio')))">
                a.deviceStopRatio,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('deviceUnActiveCount') or colPickMode == 1 and data.containsKey('deviceUnActiveCount')))">
                a.deviceUnActiveCount,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('deviceUnActiveRatio') or colPickMode == 1 and data.containsKey('deviceUnActiveRatio')))">
                a.deviceUnActiveRatio,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('alarmTotalCount') or colPickMode == 1 and data.containsKey('alarmTotalCount')))">
                a.alarmTotalCount,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('alarmAddCount') or colPickMode == 1 and data.containsKey('alarmAddCount')))">
                a.alarmAddCount,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('pushTotalCount') or colPickMode == 1 and data.containsKey('pushTotalCount')))">
                a.pushTotalCount,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('pushAddCount') or colPickMode == 1 and data.containsKey('pushAddCount')))">
                a.pushAddCount,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('uploadMessageTotalCount') or colPickMode == 1 and data.containsKey('uploadMessageTotalCount')))">
                a.uploadMessageTotalCount,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('downloadMessageTotalCount') or colPickMode == 1 and data.containsKey('downloadMessageTotalCount')))">
                a.downloadMessageTotalCount,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('year') or colPickMode == 1 and data.containsKey('year')))">
                a.year,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('month') or colPickMode == 1 and data.containsKey('month')))">
                a.month,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('day') or colPickMode == 1 and data.containsKey('day')))">
                a.day,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createTime') or colPickMode == 1 and data.containsKey('createTime')))">
                a.createTime,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateUserId') or colPickMode == 1 and data.containsKey('updateUserId')))">
                a.updateUserId,
            </if>
            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateTime') or colPickMode == 1 and data.containsKey('updateTime')))">
                a.updateTime,
            </if>
        </trim>
    </sql>
    <!-- 新增 区分主键自增加还是业务插入 -->
    <insert id="insert" parameterType="DeviceStatEntity"  useGeneratedKeys="true" keyProperty="id">
        insert into mortals_xhx_device_stat
        (siteId,deviceTotalCount,deviceAddCount,siteTotalCount,siteAddCount,deviceOnlineCount,deviceOnlineRatio,deviceOfflineCount,deviceOfflineRatio,deviceStopCount,deviceStopRatio,deviceUnActiveCount,deviceUnActiveRatio,alarmTotalCount,alarmAddCount,pushTotalCount,pushAddCount,uploadMessageTotalCount,downloadMessageTotalCount,year,month,day,createTime,updateUserId,updateTime)
        VALUES
        (#{siteId},#{deviceTotalCount},#{deviceAddCount},#{siteTotalCount},#{siteAddCount},#{deviceOnlineCount},#{deviceOnlineRatio},#{deviceOfflineCount},#{deviceOfflineRatio},#{deviceStopCount},#{deviceStopRatio},#{deviceUnActiveCount},#{deviceUnActiveRatio},#{alarmTotalCount},#{alarmAddCount},#{pushTotalCount},#{pushAddCount},#{uploadMessageTotalCount},#{downloadMessageTotalCount},#{year},#{month},#{day},#{createTime},#{updateUserId},#{updateTime})
    </insert>

    <!-- 批量新增 -->
    <insert id="insertBatch" parameterType="paramDto">
        insert into mortals_xhx_device_stat
        (siteId,deviceTotalCount,deviceAddCount,siteTotalCount,siteAddCount,deviceOnlineCount,deviceOnlineRatio,deviceOfflineCount,deviceOfflineRatio,deviceStopCount,deviceStopRatio,deviceUnActiveCount,deviceUnActiveRatio,alarmTotalCount,alarmAddCount,pushTotalCount,pushAddCount,uploadMessageTotalCount,downloadMessageTotalCount,year,month,day,createTime,updateUserId,updateTime)
        VALUES
        <foreach collection="data.dataList" item="item" index="index" separator="," >
            (#{item.siteId},#{item.deviceTotalCount},#{item.deviceAddCount},#{item.siteTotalCount},#{item.siteAddCount},#{item.deviceOnlineCount},#{item.deviceOnlineRatio},#{item.deviceOfflineCount},#{item.deviceOfflineRatio},#{item.deviceStopCount},#{item.deviceStopRatio},#{item.deviceUnActiveCount},#{item.deviceUnActiveRatio},#{item.alarmTotalCount},#{item.alarmAddCount},#{item.pushTotalCount},#{item.pushAddCount},#{item.uploadMessageTotalCount},#{item.downloadMessageTotalCount},#{item.year},#{item.month},#{item.day},#{item.createTime},#{item.updateUserId},#{item.updateTime})
        </foreach>
    </insert>


    <!-- 根据ParamDto更新 -->
    <update id="update" parameterType="paramDto">
        update mortals_xhx_device_stat 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('deviceTotalCount')) or (colPickMode==1 and !data.containsKey('deviceTotalCount'))">
                a.deviceTotalCount=#{data.deviceTotalCount},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deviceTotalCountIncrement')) or (colPickMode==1 and !data.containsKey('deviceTotalCountIncrement'))">
                a.deviceTotalCount=ifnull(a.deviceTotalCount,0) + #{data.deviceTotalCountIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deviceAddCount')) or (colPickMode==1 and !data.containsKey('deviceAddCount'))">
                a.deviceAddCount=#{data.deviceAddCount},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deviceAddCountIncrement')) or (colPickMode==1 and !data.containsKey('deviceAddCountIncrement'))">
                a.deviceAddCount=ifnull(a.deviceAddCount,0) + #{data.deviceAddCountIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('siteTotalCount')) or (colPickMode==1 and !data.containsKey('siteTotalCount'))">
                a.siteTotalCount=#{data.siteTotalCount},
            </if>
            <if test="(colPickMode==0 and data.containsKey('siteTotalCountIncrement')) or (colPickMode==1 and !data.containsKey('siteTotalCountIncrement'))">
                a.siteTotalCount=ifnull(a.siteTotalCount,0) + #{data.siteTotalCountIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('siteAddCount')) or (colPickMode==1 and !data.containsKey('siteAddCount'))">
                a.siteAddCount=#{data.siteAddCount},
            </if>
            <if test="(colPickMode==0 and data.containsKey('siteAddCountIncrement')) or (colPickMode==1 and !data.containsKey('siteAddCountIncrement'))">
                a.siteAddCount=ifnull(a.siteAddCount,0) + #{data.siteAddCountIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deviceOnlineCount')) or (colPickMode==1 and !data.containsKey('deviceOnlineCount'))">
                a.deviceOnlineCount=#{data.deviceOnlineCount},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deviceOnlineCountIncrement')) or (colPickMode==1 and !data.containsKey('deviceOnlineCountIncrement'))">
                a.deviceOnlineCount=ifnull(a.deviceOnlineCount,0) + #{data.deviceOnlineCountIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deviceOnlineRatio')) or (colPickMode==1 and !data.containsKey('deviceOnlineRatio'))">
                a.deviceOnlineRatio=#{data.deviceOnlineRatio},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deviceOnlineRatioIncrement')) or (colPickMode==1 and !data.containsKey('deviceOnlineRatioIncrement'))">
                a.deviceOnlineRatio=ifnull(a.deviceOnlineRatio,0) + #{data.deviceOnlineRatioIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deviceOfflineCount')) or (colPickMode==1 and !data.containsKey('deviceOfflineCount'))">
                a.deviceOfflineCount=#{data.deviceOfflineCount},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deviceOfflineCountIncrement')) or (colPickMode==1 and !data.containsKey('deviceOfflineCountIncrement'))">
                a.deviceOfflineCount=ifnull(a.deviceOfflineCount,0) + #{data.deviceOfflineCountIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deviceOfflineRatio')) or (colPickMode==1 and !data.containsKey('deviceOfflineRatio'))">
                a.deviceOfflineRatio=#{data.deviceOfflineRatio},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deviceOfflineRatioIncrement')) or (colPickMode==1 and !data.containsKey('deviceOfflineRatioIncrement'))">
                a.deviceOfflineRatio=ifnull(a.deviceOfflineRatio,0) + #{data.deviceOfflineRatioIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deviceStopCount')) or (colPickMode==1 and !data.containsKey('deviceStopCount'))">
                a.deviceStopCount=#{data.deviceStopCount},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deviceStopCountIncrement')) or (colPickMode==1 and !data.containsKey('deviceStopCountIncrement'))">
                a.deviceStopCount=ifnull(a.deviceStopCount,0) + #{data.deviceStopCountIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deviceStopRatio')) or (colPickMode==1 and !data.containsKey('deviceStopRatio'))">
                a.deviceStopRatio=#{data.deviceStopRatio},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deviceStopRatioIncrement')) or (colPickMode==1 and !data.containsKey('deviceStopRatioIncrement'))">
                a.deviceStopRatio=ifnull(a.deviceStopRatio,0) + #{data.deviceStopRatioIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deviceUnActiveCount')) or (colPickMode==1 and !data.containsKey('deviceUnActiveCount'))">
                a.deviceUnActiveCount=#{data.deviceUnActiveCount},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deviceUnActiveCountIncrement')) or (colPickMode==1 and !data.containsKey('deviceUnActiveCountIncrement'))">
                a.deviceUnActiveCount=ifnull(a.deviceUnActiveCount,0) + #{data.deviceUnActiveCountIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deviceUnActiveRatio')) or (colPickMode==1 and !data.containsKey('deviceUnActiveRatio'))">
                a.deviceUnActiveRatio=#{data.deviceUnActiveRatio},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deviceUnActiveRatioIncrement')) or (colPickMode==1 and !data.containsKey('deviceUnActiveRatioIncrement'))">
                a.deviceUnActiveRatio=ifnull(a.deviceUnActiveRatio,0) + #{data.deviceUnActiveRatioIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('alarmTotalCount')) or (colPickMode==1 and !data.containsKey('alarmTotalCount'))">
                a.alarmTotalCount=#{data.alarmTotalCount},
            </if>
            <if test="(colPickMode==0 and data.containsKey('alarmTotalCountIncrement')) or (colPickMode==1 and !data.containsKey('alarmTotalCountIncrement'))">
                a.alarmTotalCount=ifnull(a.alarmTotalCount,0) + #{data.alarmTotalCountIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('alarmAddCount')) or (colPickMode==1 and !data.containsKey('alarmAddCount'))">
                a.alarmAddCount=#{data.alarmAddCount},
            </if>
            <if test="(colPickMode==0 and data.containsKey('alarmAddCountIncrement')) or (colPickMode==1 and !data.containsKey('alarmAddCountIncrement'))">
                a.alarmAddCount=ifnull(a.alarmAddCount,0) + #{data.alarmAddCountIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('pushTotalCount')) or (colPickMode==1 and !data.containsKey('pushTotalCount'))">
                a.pushTotalCount=#{data.pushTotalCount},
            </if>
            <if test="(colPickMode==0 and data.containsKey('pushTotalCountIncrement')) or (colPickMode==1 and !data.containsKey('pushTotalCountIncrement'))">
                a.pushTotalCount=ifnull(a.pushTotalCount,0) + #{data.pushTotalCountIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('pushAddCount')) or (colPickMode==1 and !data.containsKey('pushAddCount'))">
                a.pushAddCount=#{data.pushAddCount},
            </if>
            <if test="(colPickMode==0 and data.containsKey('pushAddCountIncrement')) or (colPickMode==1 and !data.containsKey('pushAddCountIncrement'))">
                a.pushAddCount=ifnull(a.pushAddCount,0) + #{data.pushAddCountIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('uploadMessageTotalCount')) or (colPickMode==1 and !data.containsKey('uploadMessageTotalCount'))">
                a.uploadMessageTotalCount=#{data.uploadMessageTotalCount},
            </if>
            <if test="(colPickMode==0 and data.containsKey('uploadMessageTotalCountIncrement')) or (colPickMode==1 and !data.containsKey('uploadMessageTotalCountIncrement'))">
                a.uploadMessageTotalCount=ifnull(a.uploadMessageTotalCount,0) + #{data.uploadMessageTotalCountIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('downloadMessageTotalCount')) or (colPickMode==1 and !data.containsKey('downloadMessageTotalCount'))">
                a.downloadMessageTotalCount=#{data.downloadMessageTotalCount},
            </if>
            <if test="(colPickMode==0 and data.containsKey('downloadMessageTotalCountIncrement')) or (colPickMode==1 and !data.containsKey('downloadMessageTotalCountIncrement'))">
                a.downloadMessageTotalCount=ifnull(a.downloadMessageTotalCount,0) + #{data.downloadMessageTotalCountIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('year')) or (colPickMode==1 and !data.containsKey('year'))">
                a.year=#{data.year},
            </if>
            <if test="(colPickMode==0 and data.containsKey('yearIncrement')) or (colPickMode==1 and !data.containsKey('yearIncrement'))">
                a.year=ifnull(a.year,0) + #{data.yearIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('month')) or (colPickMode==1 and !data.containsKey('month'))">
                a.month=#{data.month},
            </if>
            <if test="(colPickMode==0 and data.containsKey('monthIncrement')) or (colPickMode==1 and !data.containsKey('monthIncrement'))">
                a.month=ifnull(a.month,0) + #{data.monthIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('day')) or (colPickMode==1 and !data.containsKey('day'))">
                a.day=#{data.day},
            </if>
            <if test="(colPickMode==0 and data.containsKey('dayIncrement')) or (colPickMode==1 and !data.containsKey('dayIncrement'))">
                a.day=ifnull(a.day,0) + #{data.dayIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('createTime')) or (colPickMode==1 and !data.containsKey('createTime'))">
                a.createTime=#{data.createTime},
            </if>
            <if test="(colPickMode==0 and data.containsKey('updateUserId')) or (colPickMode==1 and !data.containsKey('updateUserId'))">
                a.updateUserId=#{data.updateUserId},
            </if>
            <if test="(colPickMode==0 and data.containsKey('updateUserIdIncrement')) or (colPickMode==1 and !data.containsKey('updateUserIdIncrement'))">
                a.updateUserId=ifnull(a.updateUserId,0) + #{data.updateUserIdIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('updateTime')) or (colPickMode==1 and !data.containsKey('updateTime'))">
                a.updateTime=#{data.updateTime},
            </if>
        </trim>
        <trim suffixOverrides="where" suffix="">
            where
            <trim prefixOverrides="and" prefix="">
                <include refid="_condition_"/>
            </trim>
        </trim>
    </update>
    <!-- 批量更新 -->
    <update id="updateBatch" parameterType="paramDto">
        update mortals_xhx_device_stat 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="deviceTotalCount=(case" suffix="ELSE deviceTotalCount end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('deviceTotalCount')) or (colPickMode==1 and !item.containsKey('deviceTotalCount'))">
                            when a.id=#{item.id} then #{item.deviceTotalCount}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('deviceTotalCountIncrement')) or (colPickMode==1 and !item.containsKey('deviceTotalCountIncrement'))">
                            when a.id=#{item.id} then ifnull(a.deviceTotalCount,0) + #{item.deviceTotalCountIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="deviceAddCount=(case" suffix="ELSE deviceAddCount end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('deviceAddCount')) or (colPickMode==1 and !item.containsKey('deviceAddCount'))">
                            when a.id=#{item.id} then #{item.deviceAddCount}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('deviceAddCountIncrement')) or (colPickMode==1 and !item.containsKey('deviceAddCountIncrement'))">
                            when a.id=#{item.id} then ifnull(a.deviceAddCount,0) + #{item.deviceAddCountIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="siteTotalCount=(case" suffix="ELSE siteTotalCount end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('siteTotalCount')) or (colPickMode==1 and !item.containsKey('siteTotalCount'))">
                            when a.id=#{item.id} then #{item.siteTotalCount}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('siteTotalCountIncrement')) or (colPickMode==1 and !item.containsKey('siteTotalCountIncrement'))">
                            when a.id=#{item.id} then ifnull(a.siteTotalCount,0) + #{item.siteTotalCountIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="siteAddCount=(case" suffix="ELSE siteAddCount end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('siteAddCount')) or (colPickMode==1 and !item.containsKey('siteAddCount'))">
                            when a.id=#{item.id} then #{item.siteAddCount}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('siteAddCountIncrement')) or (colPickMode==1 and !item.containsKey('siteAddCountIncrement'))">
                            when a.id=#{item.id} then ifnull(a.siteAddCount,0) + #{item.siteAddCountIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="deviceOnlineCount=(case" suffix="ELSE deviceOnlineCount end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('deviceOnlineCount')) or (colPickMode==1 and !item.containsKey('deviceOnlineCount'))">
                            when a.id=#{item.id} then #{item.deviceOnlineCount}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('deviceOnlineCountIncrement')) or (colPickMode==1 and !item.containsKey('deviceOnlineCountIncrement'))">
                            when a.id=#{item.id} then ifnull(a.deviceOnlineCount,0) + #{item.deviceOnlineCountIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="deviceOnlineRatio=(case" suffix="ELSE deviceOnlineRatio end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('deviceOnlineRatio')) or (colPickMode==1 and !item.containsKey('deviceOnlineRatio'))">
                            when a.id=#{item.id} then #{item.deviceOnlineRatio}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('deviceOnlineRatioIncrement')) or (colPickMode==1 and !item.containsKey('deviceOnlineRatioIncrement'))">
                            when a.id=#{item.id} then ifnull(a.deviceOnlineRatio,0) + #{item.deviceOnlineRatioIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="deviceOfflineCount=(case" suffix="ELSE deviceOfflineCount end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('deviceOfflineCount')) or (colPickMode==1 and !item.containsKey('deviceOfflineCount'))">
                            when a.id=#{item.id} then #{item.deviceOfflineCount}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('deviceOfflineCountIncrement')) or (colPickMode==1 and !item.containsKey('deviceOfflineCountIncrement'))">
                            when a.id=#{item.id} then ifnull(a.deviceOfflineCount,0) + #{item.deviceOfflineCountIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="deviceOfflineRatio=(case" suffix="ELSE deviceOfflineRatio end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('deviceOfflineRatio')) or (colPickMode==1 and !item.containsKey('deviceOfflineRatio'))">
                            when a.id=#{item.id} then #{item.deviceOfflineRatio}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('deviceOfflineRatioIncrement')) or (colPickMode==1 and !item.containsKey('deviceOfflineRatioIncrement'))">
                            when a.id=#{item.id} then ifnull(a.deviceOfflineRatio,0) + #{item.deviceOfflineRatioIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="deviceStopCount=(case" suffix="ELSE deviceStopCount end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('deviceStopCount')) or (colPickMode==1 and !item.containsKey('deviceStopCount'))">
                            when a.id=#{item.id} then #{item.deviceStopCount}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('deviceStopCountIncrement')) or (colPickMode==1 and !item.containsKey('deviceStopCountIncrement'))">
                            when a.id=#{item.id} then ifnull(a.deviceStopCount,0) + #{item.deviceStopCountIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="deviceStopRatio=(case" suffix="ELSE deviceStopRatio end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('deviceStopRatio')) or (colPickMode==1 and !item.containsKey('deviceStopRatio'))">
                            when a.id=#{item.id} then #{item.deviceStopRatio}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('deviceStopRatioIncrement')) or (colPickMode==1 and !item.containsKey('deviceStopRatioIncrement'))">
                            when a.id=#{item.id} then ifnull(a.deviceStopRatio,0) + #{item.deviceStopRatioIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="deviceUnActiveCount=(case" suffix="ELSE deviceUnActiveCount end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('deviceUnActiveCount')) or (colPickMode==1 and !item.containsKey('deviceUnActiveCount'))">
                            when a.id=#{item.id} then #{item.deviceUnActiveCount}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('deviceUnActiveCountIncrement')) or (colPickMode==1 and !item.containsKey('deviceUnActiveCountIncrement'))">
                            when a.id=#{item.id} then ifnull(a.deviceUnActiveCount,0) + #{item.deviceUnActiveCountIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="deviceUnActiveRatio=(case" suffix="ELSE deviceUnActiveRatio end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('deviceUnActiveRatio')) or (colPickMode==1 and !item.containsKey('deviceUnActiveRatio'))">
                            when a.id=#{item.id} then #{item.deviceUnActiveRatio}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('deviceUnActiveRatioIncrement')) or (colPickMode==1 and !item.containsKey('deviceUnActiveRatioIncrement'))">
                            when a.id=#{item.id} then ifnull(a.deviceUnActiveRatio,0) + #{item.deviceUnActiveRatioIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="alarmTotalCount=(case" suffix="ELSE alarmTotalCount end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('alarmTotalCount')) or (colPickMode==1 and !item.containsKey('alarmTotalCount'))">
                            when a.id=#{item.id} then #{item.alarmTotalCount}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('alarmTotalCountIncrement')) or (colPickMode==1 and !item.containsKey('alarmTotalCountIncrement'))">
                            when a.id=#{item.id} then ifnull(a.alarmTotalCount,0) + #{item.alarmTotalCountIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="alarmAddCount=(case" suffix="ELSE alarmAddCount end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('alarmAddCount')) or (colPickMode==1 and !item.containsKey('alarmAddCount'))">
                            when a.id=#{item.id} then #{item.alarmAddCount}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('alarmAddCountIncrement')) or (colPickMode==1 and !item.containsKey('alarmAddCountIncrement'))">
                            when a.id=#{item.id} then ifnull(a.alarmAddCount,0) + #{item.alarmAddCountIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="pushTotalCount=(case" suffix="ELSE pushTotalCount end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('pushTotalCount')) or (colPickMode==1 and !item.containsKey('pushTotalCount'))">
                            when a.id=#{item.id} then #{item.pushTotalCount}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('pushTotalCountIncrement')) or (colPickMode==1 and !item.containsKey('pushTotalCountIncrement'))">
                            when a.id=#{item.id} then ifnull(a.pushTotalCount,0) + #{item.pushTotalCountIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="pushAddCount=(case" suffix="ELSE pushAddCount end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('pushAddCount')) or (colPickMode==1 and !item.containsKey('pushAddCount'))">
                            when a.id=#{item.id} then #{item.pushAddCount}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('pushAddCountIncrement')) or (colPickMode==1 and !item.containsKey('pushAddCountIncrement'))">
                            when a.id=#{item.id} then ifnull(a.pushAddCount,0) + #{item.pushAddCountIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="uploadMessageTotalCount=(case" suffix="ELSE uploadMessageTotalCount end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('uploadMessageTotalCount')) or (colPickMode==1 and !item.containsKey('uploadMessageTotalCount'))">
                            when a.id=#{item.id} then #{item.uploadMessageTotalCount}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('uploadMessageTotalCountIncrement')) or (colPickMode==1 and !item.containsKey('uploadMessageTotalCountIncrement'))">
                            when a.id=#{item.id} then ifnull(a.uploadMessageTotalCount,0) + #{item.uploadMessageTotalCountIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="downloadMessageTotalCount=(case" suffix="ELSE downloadMessageTotalCount end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('downloadMessageTotalCount')) or (colPickMode==1 and !item.containsKey('downloadMessageTotalCount'))">
                            when a.id=#{item.id} then #{item.downloadMessageTotalCount}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('downloadMessageTotalCountIncrement')) or (colPickMode==1 and !item.containsKey('downloadMessageTotalCountIncrement'))">
                            when a.id=#{item.id} then ifnull(a.downloadMessageTotalCount,0) + #{item.downloadMessageTotalCountIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="year=(case" suffix="ELSE year end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('year')) or (colPickMode==1 and !item.containsKey('year'))">
                            when a.id=#{item.id} then #{item.year}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('yearIncrement')) or (colPickMode==1 and !item.containsKey('yearIncrement'))">
                            when a.id=#{item.id} then ifnull(a.year,0) + #{item.yearIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="month=(case" suffix="ELSE month end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('month')) or (colPickMode==1 and !item.containsKey('month'))">
                            when a.id=#{item.id} then #{item.month}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('monthIncrement')) or (colPickMode==1 and !item.containsKey('monthIncrement'))">
                            when a.id=#{item.id} then ifnull(a.month,0) + #{item.monthIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="day=(case" suffix="ELSE day end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('day')) or (colPickMode==1 and !item.containsKey('day'))">
                            when a.id=#{item.id} then #{item.day}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('dayIncrement')) or (colPickMode==1 and !item.containsKey('dayIncrement'))">
                            when a.id=#{item.id} then ifnull(a.day,0) + #{item.dayIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="createTime=(case" suffix="ELSE createTime end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('createTime')) or (colPickMode==1 and !item.containsKey('createTime'))">
                        when a.id=#{item.id} then #{item.createTime}
                    </if>
                </foreach>
            </trim>
            <trim prefix="updateUserId=(case" suffix="ELSE updateUserId end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <choose>
                        <when test="(colPickMode==0 and item.containsKey('updateUserId')) or (colPickMode==1 and !item.containsKey('updateUserId'))">
                            when a.id=#{item.id} then #{item.updateUserId}
                        </when>
                        <when test="(colPickMode==0 and item.containsKey('updateUserIdIncrement')) or (colPickMode==1 and !item.containsKey('updateUserIdIncrement'))">
                            when a.id=#{item.id} then ifnull(a.updateUserId,0) + #{item.updateUserIdIncrement}
                        </when>
                    </choose>
                </foreach>
            </trim>
            <trim prefix="updateTime=(case" suffix="ELSE updateTime end),">
                <foreach collection="data.dataList" item="item" index="index" separator="" >
                    <if test="(colPickMode==0 and item.containsKey('updateTime')) or (colPickMode==1 and !item.containsKey('updateTime'))">
                        when a.id=#{item.id} then #{item.updateTime}
                    </if>
                </foreach>
            </trim>
        </trim>
        where id in
        <foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")">
            #{item.id}
        </foreach>
    </update>
    <!-- 根据主健查询 -->
    <select id="getByKey" parameterType="paramDto" resultMap="DeviceStatEntity-Map">
        select <include refid="_columns"/>
        from mortals_xhx_device_stat as a
        where a.id=#{condition.id}
    </select>
    <!-- 根据主健删除 -->
    <delete id="deleteByKey" parameterType="paramDto">
        delete a.* from mortals_xhx_device_stat as a where a.id=#{condition.id}
    </delete>
    <!-- 根据主健删除一批，针对单一主健有效 -->
    <delete id="deleteByKeys">
        delete from mortals_xhx_device_stat 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_xhx_device_stat as a
        <trim suffixOverrides="where" suffix="">
            where
            <trim prefixOverrides="and" prefix="">
                <include refid="_condition_"/>
            </trim>
        </trim>
    </delete>
    <!-- 获取列表 -->
    <select id="getList" parameterType="paramDto" resultMap="DeviceStatEntity-Map">
        select <include refid="_columns"/>
        from mortals_xhx_device_stat 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_device_stat 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('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')">
            ${_conditionType_} a.siteId in
            <foreach collection="conditionParamRef.siteIdList" 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('deviceTotalCount')">
            <if test="conditionParamRef.deviceTotalCount != null ">
                ${_conditionType_} a.deviceTotalCount = #{${_conditionParam_}.deviceTotalCount}
            </if>
            <if test="conditionParamRef.deviceTotalCount == null">
                ${_conditionType_} a.deviceTotalCount is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('deviceTotalCountList')">
            ${_conditionType_} a.deviceTotalCount in
            <foreach collection="conditionParamRef.deviceTotalCountList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('deviceTotalCountStart') and conditionParamRef.deviceTotalCountStart != null">
            ${_conditionType_} a.deviceTotalCount <![CDATA[ >= ]]> #{${_conditionParam_}.deviceTotalCountStart}
        </if>
        <if test="conditionParamRef.containsKey('deviceTotalCountEnd') and conditionParamRef.deviceTotalCountEnd != null">
            ${_conditionType_} a.deviceTotalCount <![CDATA[ <= ]]> #{${_conditionParam_}.deviceTotalCountEnd}
        </if>

        <if test="conditionParamRef.containsKey('deviceAddCount')">
            <if test="conditionParamRef.deviceAddCount != null ">
                ${_conditionType_} a.deviceAddCount = #{${_conditionParam_}.deviceAddCount}
            </if>
            <if test="conditionParamRef.deviceAddCount == null">
                ${_conditionType_} a.deviceAddCount is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('deviceAddCountList')">
            ${_conditionType_} a.deviceAddCount in
            <foreach collection="conditionParamRef.deviceAddCountList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('deviceAddCountStart') and conditionParamRef.deviceAddCountStart != null">
            ${_conditionType_} a.deviceAddCount <![CDATA[ >= ]]> #{${_conditionParam_}.deviceAddCountStart}
        </if>
        <if test="conditionParamRef.containsKey('deviceAddCountEnd') and conditionParamRef.deviceAddCountEnd != null">
            ${_conditionType_} a.deviceAddCount <![CDATA[ <= ]]> #{${_conditionParam_}.deviceAddCountEnd}
        </if>

        <if test="conditionParamRef.containsKey('siteTotalCount')">
            <if test="conditionParamRef.siteTotalCount != null ">
                ${_conditionType_} a.siteTotalCount = #{${_conditionParam_}.siteTotalCount}
            </if>
            <if test="conditionParamRef.siteTotalCount == null">
                ${_conditionType_} a.siteTotalCount is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('siteTotalCountList')">
            ${_conditionType_} a.siteTotalCount in
            <foreach collection="conditionParamRef.siteTotalCountList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('siteTotalCountStart') and conditionParamRef.siteTotalCountStart != null">
            ${_conditionType_} a.siteTotalCount <![CDATA[ >= ]]> #{${_conditionParam_}.siteTotalCountStart}
        </if>
        <if test="conditionParamRef.containsKey('siteTotalCountEnd') and conditionParamRef.siteTotalCountEnd != null">
            ${_conditionType_} a.siteTotalCount <![CDATA[ <= ]]> #{${_conditionParam_}.siteTotalCountEnd}
        </if>

        <if test="conditionParamRef.containsKey('siteAddCount')">
            <if test="conditionParamRef.siteAddCount != null ">
                ${_conditionType_} a.siteAddCount = #{${_conditionParam_}.siteAddCount}
            </if>
            <if test="conditionParamRef.siteAddCount == null">
                ${_conditionType_} a.siteAddCount is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('siteAddCountList')">
            ${_conditionType_} a.siteAddCount in
            <foreach collection="conditionParamRef.siteAddCountList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('siteAddCountStart') and conditionParamRef.siteAddCountStart != null">
            ${_conditionType_} a.siteAddCount <![CDATA[ >= ]]> #{${_conditionParam_}.siteAddCountStart}
        </if>
        <if test="conditionParamRef.containsKey('siteAddCountEnd') and conditionParamRef.siteAddCountEnd != null">
            ${_conditionType_} a.siteAddCount <![CDATA[ <= ]]> #{${_conditionParam_}.siteAddCountEnd}
        </if>

        <if test="conditionParamRef.containsKey('deviceOnlineCount')">
            <if test="conditionParamRef.deviceOnlineCount != null ">
                ${_conditionType_} a.deviceOnlineCount = #{${_conditionParam_}.deviceOnlineCount}
            </if>
            <if test="conditionParamRef.deviceOnlineCount == null">
                ${_conditionType_} a.deviceOnlineCount is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('deviceOnlineCountList')">
            ${_conditionType_} a.deviceOnlineCount in
            <foreach collection="conditionParamRef.deviceOnlineCountList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('deviceOnlineCountStart') and conditionParamRef.deviceOnlineCountStart != null">
            ${_conditionType_} a.deviceOnlineCount <![CDATA[ >= ]]> #{${_conditionParam_}.deviceOnlineCountStart}
        </if>
        <if test="conditionParamRef.containsKey('deviceOnlineCountEnd') and conditionParamRef.deviceOnlineCountEnd != null">
            ${_conditionType_} a.deviceOnlineCount <![CDATA[ <= ]]> #{${_conditionParam_}.deviceOnlineCountEnd}
        </if>

        <if test="conditionParamRef.containsKey('deviceOnlineRatio')">
            <if test="conditionParamRef.deviceOnlineRatio != null ">
                ${_conditionType_} a.deviceOnlineRatio = #{${_conditionParam_}.deviceOnlineRatio}
            </if>
            <if test="conditionParamRef.deviceOnlineRatio == null">
                ${_conditionType_} a.deviceOnlineRatio is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('deviceOnlineRatioList')">
            ${_conditionType_} a.deviceOnlineRatio in
            <foreach collection="conditionParamRef.deviceOnlineRatioList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('deviceOnlineRatioStart') and conditionParamRef.deviceOnlineRatioStart != null">
            ${_conditionType_} a.deviceOnlineRatio <![CDATA[ >= ]]> #{${_conditionParam_}.deviceOnlineRatioStart}
        </if>
        <if test="conditionParamRef.containsKey('deviceOnlineRatioEnd') and conditionParamRef.deviceOnlineRatioEnd != null">
            ${_conditionType_} a.deviceOnlineRatio <![CDATA[ <= ]]> #{${_conditionParam_}.deviceOnlineRatioEnd}
        </if>

        <if test="conditionParamRef.containsKey('deviceOfflineCount')">
            <if test="conditionParamRef.deviceOfflineCount != null ">
                ${_conditionType_} a.deviceOfflineCount = #{${_conditionParam_}.deviceOfflineCount}
            </if>
            <if test="conditionParamRef.deviceOfflineCount == null">
                ${_conditionType_} a.deviceOfflineCount is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('deviceOfflineCountList')">
            ${_conditionType_} a.deviceOfflineCount in
            <foreach collection="conditionParamRef.deviceOfflineCountList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('deviceOfflineCountStart') and conditionParamRef.deviceOfflineCountStart != null">
            ${_conditionType_} a.deviceOfflineCount <![CDATA[ >= ]]> #{${_conditionParam_}.deviceOfflineCountStart}
        </if>
        <if test="conditionParamRef.containsKey('deviceOfflineCountEnd') and conditionParamRef.deviceOfflineCountEnd != null">
            ${_conditionType_} a.deviceOfflineCount <![CDATA[ <= ]]> #{${_conditionParam_}.deviceOfflineCountEnd}
        </if>

        <if test="conditionParamRef.containsKey('deviceOfflineRatio')">
            <if test="conditionParamRef.deviceOfflineRatio != null ">
                ${_conditionType_} a.deviceOfflineRatio = #{${_conditionParam_}.deviceOfflineRatio}
            </if>
            <if test="conditionParamRef.deviceOfflineRatio == null">
                ${_conditionType_} a.deviceOfflineRatio is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('deviceOfflineRatioList')">
            ${_conditionType_} a.deviceOfflineRatio in
            <foreach collection="conditionParamRef.deviceOfflineRatioList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('deviceOfflineRatioStart') and conditionParamRef.deviceOfflineRatioStart != null">
            ${_conditionType_} a.deviceOfflineRatio <![CDATA[ >= ]]> #{${_conditionParam_}.deviceOfflineRatioStart}
        </if>
        <if test="conditionParamRef.containsKey('deviceOfflineRatioEnd') and conditionParamRef.deviceOfflineRatioEnd != null">
            ${_conditionType_} a.deviceOfflineRatio <![CDATA[ <= ]]> #{${_conditionParam_}.deviceOfflineRatioEnd}
        </if>

        <if test="conditionParamRef.containsKey('deviceStopCount')">
            <if test="conditionParamRef.deviceStopCount != null ">
                ${_conditionType_} a.deviceStopCount = #{${_conditionParam_}.deviceStopCount}
            </if>
            <if test="conditionParamRef.deviceStopCount == null">
                ${_conditionType_} a.deviceStopCount is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('deviceStopCountList')">
            ${_conditionType_} a.deviceStopCount in
            <foreach collection="conditionParamRef.deviceStopCountList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('deviceStopCountStart') and conditionParamRef.deviceStopCountStart != null">
            ${_conditionType_} a.deviceStopCount <![CDATA[ >= ]]> #{${_conditionParam_}.deviceStopCountStart}
        </if>
        <if test="conditionParamRef.containsKey('deviceStopCountEnd') and conditionParamRef.deviceStopCountEnd != null">
            ${_conditionType_} a.deviceStopCount <![CDATA[ <= ]]> #{${_conditionParam_}.deviceStopCountEnd}
        </if>

        <if test="conditionParamRef.containsKey('deviceStopRatio')">
            <if test="conditionParamRef.deviceStopRatio != null ">
                ${_conditionType_} a.deviceStopRatio = #{${_conditionParam_}.deviceStopRatio}
            </if>
            <if test="conditionParamRef.deviceStopRatio == null">
                ${_conditionType_} a.deviceStopRatio is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('deviceStopRatioList')">
            ${_conditionType_} a.deviceStopRatio in
            <foreach collection="conditionParamRef.deviceStopRatioList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('deviceStopRatioStart') and conditionParamRef.deviceStopRatioStart != null">
            ${_conditionType_} a.deviceStopRatio <![CDATA[ >= ]]> #{${_conditionParam_}.deviceStopRatioStart}
        </if>
        <if test="conditionParamRef.containsKey('deviceStopRatioEnd') and conditionParamRef.deviceStopRatioEnd != null">
            ${_conditionType_} a.deviceStopRatio <![CDATA[ <= ]]> #{${_conditionParam_}.deviceStopRatioEnd}
        </if>

        <if test="conditionParamRef.containsKey('deviceUnActiveCount')">
            <if test="conditionParamRef.deviceUnActiveCount != null ">
                ${_conditionType_} a.deviceUnActiveCount = #{${_conditionParam_}.deviceUnActiveCount}
            </if>
            <if test="conditionParamRef.deviceUnActiveCount == null">
                ${_conditionType_} a.deviceUnActiveCount is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('deviceUnActiveCountList')">
            ${_conditionType_} a.deviceUnActiveCount in
            <foreach collection="conditionParamRef.deviceUnActiveCountList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('deviceUnActiveCountStart') and conditionParamRef.deviceUnActiveCountStart != null">
            ${_conditionType_} a.deviceUnActiveCount <![CDATA[ >= ]]> #{${_conditionParam_}.deviceUnActiveCountStart}
        </if>
        <if test="conditionParamRef.containsKey('deviceUnActiveCountEnd') and conditionParamRef.deviceUnActiveCountEnd != null">
            ${_conditionType_} a.deviceUnActiveCount <![CDATA[ <= ]]> #{${_conditionParam_}.deviceUnActiveCountEnd}
        </if>

        <if test="conditionParamRef.containsKey('deviceUnActiveRatio')">
            <if test="conditionParamRef.deviceUnActiveRatio != null ">
                ${_conditionType_} a.deviceUnActiveRatio = #{${_conditionParam_}.deviceUnActiveRatio}
            </if>
            <if test="conditionParamRef.deviceUnActiveRatio == null">
                ${_conditionType_} a.deviceUnActiveRatio is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('deviceUnActiveRatioList')">
            ${_conditionType_} a.deviceUnActiveRatio in
            <foreach collection="conditionParamRef.deviceUnActiveRatioList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('deviceUnActiveRatioStart') and conditionParamRef.deviceUnActiveRatioStart != null">
            ${_conditionType_} a.deviceUnActiveRatio <![CDATA[ >= ]]> #{${_conditionParam_}.deviceUnActiveRatioStart}
        </if>
        <if test="conditionParamRef.containsKey('deviceUnActiveRatioEnd') and conditionParamRef.deviceUnActiveRatioEnd != null">
            ${_conditionType_} a.deviceUnActiveRatio <![CDATA[ <= ]]> #{${_conditionParam_}.deviceUnActiveRatioEnd}
        </if>

        <if test="conditionParamRef.containsKey('alarmTotalCount')">
            <if test="conditionParamRef.alarmTotalCount != null ">
                ${_conditionType_} a.alarmTotalCount = #{${_conditionParam_}.alarmTotalCount}
            </if>
            <if test="conditionParamRef.alarmTotalCount == null">
                ${_conditionType_} a.alarmTotalCount is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('alarmTotalCountList')">
            ${_conditionType_} a.alarmTotalCount in
            <foreach collection="conditionParamRef.alarmTotalCountList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('alarmTotalCountStart') and conditionParamRef.alarmTotalCountStart != null">
            ${_conditionType_} a.alarmTotalCount <![CDATA[ >= ]]> #{${_conditionParam_}.alarmTotalCountStart}
        </if>
        <if test="conditionParamRef.containsKey('alarmTotalCountEnd') and conditionParamRef.alarmTotalCountEnd != null">
            ${_conditionType_} a.alarmTotalCount <![CDATA[ <= ]]> #{${_conditionParam_}.alarmTotalCountEnd}
        </if>

        <if test="conditionParamRef.containsKey('alarmAddCount')">
            <if test="conditionParamRef.alarmAddCount != null ">
                ${_conditionType_} a.alarmAddCount = #{${_conditionParam_}.alarmAddCount}
            </if>
            <if test="conditionParamRef.alarmAddCount == null">
                ${_conditionType_} a.alarmAddCount is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('alarmAddCountList')">
            ${_conditionType_} a.alarmAddCount in
            <foreach collection="conditionParamRef.alarmAddCountList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('alarmAddCountStart') and conditionParamRef.alarmAddCountStart != null">
            ${_conditionType_} a.alarmAddCount <![CDATA[ >= ]]> #{${_conditionParam_}.alarmAddCountStart}
        </if>
        <if test="conditionParamRef.containsKey('alarmAddCountEnd') and conditionParamRef.alarmAddCountEnd != null">
            ${_conditionType_} a.alarmAddCount <![CDATA[ <= ]]> #{${_conditionParam_}.alarmAddCountEnd}
        </if>

        <if test="conditionParamRef.containsKey('pushTotalCount')">
            <if test="conditionParamRef.pushTotalCount != null ">
                ${_conditionType_} a.pushTotalCount = #{${_conditionParam_}.pushTotalCount}
            </if>
            <if test="conditionParamRef.pushTotalCount == null">
                ${_conditionType_} a.pushTotalCount is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('pushTotalCountList')">
            ${_conditionType_} a.pushTotalCount in
            <foreach collection="conditionParamRef.pushTotalCountList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('pushTotalCountStart') and conditionParamRef.pushTotalCountStart != null">
            ${_conditionType_} a.pushTotalCount <![CDATA[ >= ]]> #{${_conditionParam_}.pushTotalCountStart}
        </if>
        <if test="conditionParamRef.containsKey('pushTotalCountEnd') and conditionParamRef.pushTotalCountEnd != null">
            ${_conditionType_} a.pushTotalCount <![CDATA[ <= ]]> #{${_conditionParam_}.pushTotalCountEnd}
        </if>

        <if test="conditionParamRef.containsKey('pushAddCount')">
            <if test="conditionParamRef.pushAddCount != null ">
                ${_conditionType_} a.pushAddCount = #{${_conditionParam_}.pushAddCount}
            </if>
            <if test="conditionParamRef.pushAddCount == null">
                ${_conditionType_} a.pushAddCount is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('pushAddCountList')">
            ${_conditionType_} a.pushAddCount in
            <foreach collection="conditionParamRef.pushAddCountList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('pushAddCountStart') and conditionParamRef.pushAddCountStart != null">
            ${_conditionType_} a.pushAddCount <![CDATA[ >= ]]> #{${_conditionParam_}.pushAddCountStart}
        </if>
        <if test="conditionParamRef.containsKey('pushAddCountEnd') and conditionParamRef.pushAddCountEnd != null">
            ${_conditionType_} a.pushAddCount <![CDATA[ <= ]]> #{${_conditionParam_}.pushAddCountEnd}
        </if>

        <if test="conditionParamRef.containsKey('uploadMessageTotalCount')">
            <if test="conditionParamRef.uploadMessageTotalCount != null ">
                ${_conditionType_} a.uploadMessageTotalCount = #{${_conditionParam_}.uploadMessageTotalCount}
            </if>
            <if test="conditionParamRef.uploadMessageTotalCount == null">
                ${_conditionType_} a.uploadMessageTotalCount is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('uploadMessageTotalCountList')">
            ${_conditionType_} a.uploadMessageTotalCount in
            <foreach collection="conditionParamRef.uploadMessageTotalCountList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('uploadMessageTotalCountStart') and conditionParamRef.uploadMessageTotalCountStart != null">
            ${_conditionType_} a.uploadMessageTotalCount <![CDATA[ >= ]]> #{${_conditionParam_}.uploadMessageTotalCountStart}
        </if>
        <if test="conditionParamRef.containsKey('uploadMessageTotalCountEnd') and conditionParamRef.uploadMessageTotalCountEnd != null">
            ${_conditionType_} a.uploadMessageTotalCount <![CDATA[ <= ]]> #{${_conditionParam_}.uploadMessageTotalCountEnd}
        </if>

        <if test="conditionParamRef.containsKey('downloadMessageTotalCount')">
            <if test="conditionParamRef.downloadMessageTotalCount != null ">
                ${_conditionType_} a.downloadMessageTotalCount = #{${_conditionParam_}.downloadMessageTotalCount}
            </if>
            <if test="conditionParamRef.downloadMessageTotalCount == null">
                ${_conditionType_} a.downloadMessageTotalCount is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('downloadMessageTotalCountList')">
            ${_conditionType_} a.downloadMessageTotalCount in
            <foreach collection="conditionParamRef.downloadMessageTotalCountList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('downloadMessageTotalCountStart') and conditionParamRef.downloadMessageTotalCountStart != null">
            ${_conditionType_} a.downloadMessageTotalCount <![CDATA[ >= ]]> #{${_conditionParam_}.downloadMessageTotalCountStart}
        </if>
        <if test="conditionParamRef.containsKey('downloadMessageTotalCountEnd') and conditionParamRef.downloadMessageTotalCountEnd != null">
            ${_conditionType_} a.downloadMessageTotalCount <![CDATA[ <= ]]> #{${_conditionParam_}.downloadMessageTotalCountEnd}
        </if>

        <if test="conditionParamRef.containsKey('year')">
            <if test="conditionParamRef.year != null ">
                ${_conditionType_} a.year = #{${_conditionParam_}.year}
            </if>
            <if test="conditionParamRef.year == null">
                ${_conditionType_} a.year is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('yearList')">
            ${_conditionType_} a.year in
            <foreach collection="conditionParamRef.yearList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('yearStart') and conditionParamRef.yearStart != null">
            ${_conditionType_} a.year <![CDATA[ >= ]]> #{${_conditionParam_}.yearStart}
        </if>
        <if test="conditionParamRef.containsKey('yearEnd') and conditionParamRef.yearEnd != null">
            ${_conditionType_} a.year <![CDATA[ <= ]]> #{${_conditionParam_}.yearEnd}
        </if>

        <if test="conditionParamRef.containsKey('month')">
            <if test="conditionParamRef.month != null ">
                ${_conditionType_} a.month = #{${_conditionParam_}.month}
            </if>
            <if test="conditionParamRef.month == null">
                ${_conditionType_} a.month is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('monthList')">
            ${_conditionType_} a.month in
            <foreach collection="conditionParamRef.monthList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('monthStart') and conditionParamRef.monthStart != null">
            ${_conditionType_} a.month <![CDATA[ >= ]]> #{${_conditionParam_}.monthStart}
        </if>
        <if test="conditionParamRef.containsKey('monthEnd') and conditionParamRef.monthEnd != null">
            ${_conditionType_} a.month <![CDATA[ <= ]]> #{${_conditionParam_}.monthEnd}
        </if>

        <if test="conditionParamRef.containsKey('day')">
            <if test="conditionParamRef.day != null ">
                ${_conditionType_} a.day = #{${_conditionParam_}.day}
            </if>
            <if test="conditionParamRef.day == null">
                ${_conditionType_} a.day is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('dayList')">
            ${_conditionType_} a.day in
            <foreach collection="conditionParamRef.dayList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('dayStart') and conditionParamRef.dayStart != null">
            ${_conditionType_} a.day <![CDATA[ >= ]]> #{${_conditionParam_}.dayStart}
        </if>
        <if test="conditionParamRef.containsKey('dayEnd') and conditionParamRef.dayEnd != null">
            ${_conditionType_} a.day <![CDATA[ <= ]]> #{${_conditionParam_}.dayEnd}
        </if>


        <if test="conditionParamRef.containsKey('createTime')">
            <if test="conditionParamRef.createTime != null ">
                ${_conditionType_} a.createTime = #{${_conditionParam_}.createTime}
            </if>
            <if test="conditionParamRef.createTime == null">
                ${_conditionType_} a.createTime is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('createTimeStart') and conditionParamRef.createTimeStart != null and conditionParamRef.createTimeStart!=''">
            ${_conditionType_} a.createTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.createTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
        </if>
        <if test="conditionParamRef.containsKey('createTimeEnd') and conditionParamRef.createTimeEnd != null and conditionParamRef.createTimeEnd!=''">
            ${_conditionType_} a.createTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.createTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
        </if>
        <if test="conditionParamRef.containsKey('updateUserId')">
            <if test="conditionParamRef.updateUserId != null ">
                ${_conditionType_} a.updateUserId = #{${_conditionParam_}.updateUserId}
            </if>
            <if test="conditionParamRef.updateUserId == null">
                ${_conditionType_} a.updateUserId is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('updateUserIdList')">
            ${_conditionType_} a.updateUserId in
            <foreach collection="conditionParamRef.updateUserIdList" open="(" close=")" index="index" item="item" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="conditionParamRef.containsKey('updateUserIdStart') and conditionParamRef.updateUserIdStart != null">
            ${_conditionType_} a.updateUserId <![CDATA[ >= ]]> #{${_conditionParam_}.updateUserIdStart}
        </if>
        <if test="conditionParamRef.containsKey('updateUserIdEnd') and conditionParamRef.updateUserIdEnd != null">
            ${_conditionType_} a.updateUserId <![CDATA[ <= ]]> #{${_conditionParam_}.updateUserIdEnd}
        </if>


        <if test="conditionParamRef.containsKey('updateTime')">
            <if test="conditionParamRef.updateTime != null ">
                ${_conditionType_} a.updateTime = #{${_conditionParam_}.updateTime}
            </if>
            <if test="conditionParamRef.updateTime == null">
                ${_conditionType_} a.updateTime is null
            </if>
        </if>
        <if test="conditionParamRef.containsKey('updateTimeStart') and conditionParamRef.updateTimeStart != null and conditionParamRef.updateTimeStart!=''">
            ${_conditionType_} a.updateTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
        </if>
        <if test="conditionParamRef.containsKey('updateTimeEnd') and conditionParamRef.updateTimeEnd != null and conditionParamRef.updateTimeEnd!=''">
            ${_conditionType_} a.updateTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
        </if>
    </sql>
    <sql id="_orderCols_">
        <if test="orderColList != null and !orderColList.isEmpty()">
            order by
            <trim suffixOverrides=","  suffix="">
                <foreach collection="orderColList" open="" close="" index="index" item="item" separator=",">
                    ${item.colName} ${item.sortKind}
                </foreach>
            </trim>
        </if>
        <if test="(orderColList == null or orderColList.isEmpty()) and orderCol != null and !orderCol.isEmpty()">
            order by
            <trim suffixOverrides=","  suffix="">
                <if test="orderCol.containsKey('id')">
                    a.id
                    <if test='orderCol.id != null and "DESC".equalsIgnoreCase(orderCol.id)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('siteId')">
                    a.siteId
                    <if test='orderCol.siteId != null and "DESC".equalsIgnoreCase(orderCol.siteId)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('deviceTotalCount')">
                    a.deviceTotalCount
                    <if test='orderCol.deviceTotalCount != null and "DESC".equalsIgnoreCase(orderCol.deviceTotalCount)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('deviceAddCount')">
                    a.deviceAddCount
                    <if test='orderCol.deviceAddCount != null and "DESC".equalsIgnoreCase(orderCol.deviceAddCount)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('siteTotalCount')">
                    a.siteTotalCount
                    <if test='orderCol.siteTotalCount != null and "DESC".equalsIgnoreCase(orderCol.siteTotalCount)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('siteAddCount')">
                    a.siteAddCount
                    <if test='orderCol.siteAddCount != null and "DESC".equalsIgnoreCase(orderCol.siteAddCount)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('deviceOnlineCount')">
                    a.deviceOnlineCount
                    <if test='orderCol.deviceOnlineCount != null and "DESC".equalsIgnoreCase(orderCol.deviceOnlineCount)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('deviceOnlineRatio')">
                    a.deviceOnlineRatio
                    <if test='orderCol.deviceOnlineRatio != null and "DESC".equalsIgnoreCase(orderCol.deviceOnlineRatio)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('deviceOfflineCount')">
                    a.deviceOfflineCount
                    <if test='orderCol.deviceOfflineCount != null and "DESC".equalsIgnoreCase(orderCol.deviceOfflineCount)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('deviceOfflineRatio')">
                    a.deviceOfflineRatio
                    <if test='orderCol.deviceOfflineRatio != null and "DESC".equalsIgnoreCase(orderCol.deviceOfflineRatio)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('deviceStopCount')">
                    a.deviceStopCount
                    <if test='orderCol.deviceStopCount != null and "DESC".equalsIgnoreCase(orderCol.deviceStopCount)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('deviceStopRatio')">
                    a.deviceStopRatio
                    <if test='orderCol.deviceStopRatio != null and "DESC".equalsIgnoreCase(orderCol.deviceStopRatio)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('deviceUnActiveCount')">
                    a.deviceUnActiveCount
                    <if test='orderCol.deviceUnActiveCount != null and "DESC".equalsIgnoreCase(orderCol.deviceUnActiveCount)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('deviceUnActiveRatio')">
                    a.deviceUnActiveRatio
                    <if test='orderCol.deviceUnActiveRatio != null and "DESC".equalsIgnoreCase(orderCol.deviceUnActiveRatio)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('alarmTotalCount')">
                    a.alarmTotalCount
                    <if test='orderCol.alarmTotalCount != null and "DESC".equalsIgnoreCase(orderCol.alarmTotalCount)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('alarmAddCount')">
                    a.alarmAddCount
                    <if test='orderCol.alarmAddCount != null and "DESC".equalsIgnoreCase(orderCol.alarmAddCount)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('pushTotalCount')">
                    a.pushTotalCount
                    <if test='orderCol.pushTotalCount != null and "DESC".equalsIgnoreCase(orderCol.pushTotalCount)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('pushAddCount')">
                    a.pushAddCount
                    <if test='orderCol.pushAddCount != null and "DESC".equalsIgnoreCase(orderCol.pushAddCount)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('uploadMessageTotalCount')">
                    a.uploadMessageTotalCount
                    <if test='orderCol.uploadMessageTotalCount != null and "DESC".equalsIgnoreCase(orderCol.uploadMessageTotalCount)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('downloadMessageTotalCount')">
                    a.downloadMessageTotalCount
                    <if test='orderCol.downloadMessageTotalCount != null and "DESC".equalsIgnoreCase(orderCol.downloadMessageTotalCount)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('year')">
                    a.year
                    <if test='orderCol.year != null and "DESC".equalsIgnoreCase(orderCol.year)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('month')">
                    a.month
                    <if test='orderCol.month != null and "DESC".equalsIgnoreCase(orderCol.month)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('day')">
                    a.day
                    <if test='orderCol.day != null and "DESC".equalsIgnoreCase(orderCol.day)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('createTime')">
                    a.createTime
                    <if test='orderCol.createTime != null and "DESC".equalsIgnoreCase(orderCol.createTime)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('updateUserId')">
                    a.updateUserId
                    <if test='orderCol.updateUserId != null and "DESC".equalsIgnoreCase(orderCol.updateUserId)'>DESC</if>
                    ,
                </if>
                <if test="orderCol.containsKey('updateTime')">
                    a.updateTime
                    <if test='orderCol.updateTime != null and "DESC".equalsIgnoreCase(orderCol.updateTime)'>DESC</if>
                    ,
                </if>
            </trim>
        </if>
    </sql>
    <sql id="_group_by_">
        <if test="groupList != null and !groupList.isEmpty()">
            GROUP BY
            <trim suffixOverrides=","  suffix="">
                <foreach collection="groupList" open="" close="" index="index" item="item" separator=",">
                    ${item}
                </foreach>
            </trim>
        </if>
    </sql>
</mapper>