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

    <!-- 字段和属性映射 -->
    <resultMap type="DeviceEntity" id="DeviceEntity-Map">
            <id  property="id" column="id" />
            <result property="deviceName" column="deviceName" />
            <result property="roomId" column="roomId" />
            <result property="roomName" column="roomName" />
            <result property="deviceCode" column="deviceCode" />
            <result property="deviceMac" column="deviceMac" />
            <result property="siteId" column="siteId" />
            <result property="siteCode" column="siteCode" />
            <result property="siteName" column="siteName" />
            <result property="productCode" column="productCode" />
            <result property="productName" column="productName" />
            <result property="deviceFirmname" column="deviceFirmname" />
            <result property="resolution" column="resolution" />
            <result property="deviceInBuilding" column="deviceInBuilding" />
            <result property="deviceInFloor" column="deviceInFloor" />
            <result property="defectsLiabilityPeriod" column="defectsLiabilityPeriod" />
            <result property="leadingOfficial" column="leadingOfficial" />
            <result property="deviceAddr" column="deviceAddr" />
            <result property="leadingOfficialTelephone" column="leadingOfficialTelephone" />
            <result property="devicePhotoPath" column="devicePhotoPath" />
            <result property="ip" column="ip" />
            <result property="centernum" column="centernum" />
            <result property="port" column="port" />
            <result property="deviceStatus" column="deviceStatus" />
            <result property="enabled" column="enabled" />
            <result property="deviceRemark" column="deviceRemark" />
            <result property="onlineTime" column="onlineTime" />
            <result property="offlineTime" column="offlineTime" />
            <result property="createUserId" column="createUserId" />
            <result property="createTime" column="createTime" />
            <result property="updateUserId" column="updateUserId" />
            <result property="updateTime" column="updateTime" />
            
    </resultMap>


    <!-- 表所有列 -->
    <sql id="_columns">
        <trim suffixOverrides="," suffix="">
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('id') or colPickMode == 1 and data.containsKey('id')))">
                    a.id,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('deviceName') or colPickMode == 1 and data.containsKey('deviceName')))">
                    a.deviceName,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('roomId') or colPickMode == 1 and data.containsKey('roomId')))">
                    a.roomId,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('roomName') or colPickMode == 1 and data.containsKey('roomName')))">
                    a.roomName,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('deviceCode') or colPickMode == 1 and data.containsKey('deviceCode')))">
                    a.deviceCode,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('deviceMac') or colPickMode == 1 and data.containsKey('deviceMac')))">
                    a.deviceMac,
                </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('siteCode') or colPickMode == 1 and data.containsKey('siteCode')))">
                    a.siteCode,
                </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('productCode') or colPickMode == 1 and data.containsKey('productCode')))">
                    a.productCode,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('productName') or colPickMode == 1 and data.containsKey('productName')))">
                    a.productName,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('deviceFirmname') or colPickMode == 1 and data.containsKey('deviceFirmname')))">
                    a.deviceFirmname,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('resolution') or colPickMode == 1 and data.containsKey('resolution')))">
                    a.resolution,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('deviceInBuilding') or colPickMode == 1 and data.containsKey('deviceInBuilding')))">
                    a.deviceInBuilding,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('deviceInFloor') or colPickMode == 1 and data.containsKey('deviceInFloor')))">
                    a.deviceInFloor,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('defectsLiabilityPeriod') or colPickMode == 1 and data.containsKey('defectsLiabilityPeriod')))">
                    a.defectsLiabilityPeriod,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('leadingOfficial') or colPickMode == 1 and data.containsKey('leadingOfficial')))">
                    a.leadingOfficial,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('deviceAddr') or colPickMode == 1 and data.containsKey('deviceAddr')))">
                    a.deviceAddr,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('leadingOfficialTelephone') or colPickMode == 1 and data.containsKey('leadingOfficialTelephone')))">
                    a.leadingOfficialTelephone,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('devicePhotoPath') or colPickMode == 1 and data.containsKey('devicePhotoPath')))">
                    a.devicePhotoPath,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('ip') or colPickMode == 1 and data.containsKey('ip')))">
                    a.ip,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('centernum') or colPickMode == 1 and data.containsKey('centernum')))">
                    a.centernum,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('port') or colPickMode == 1 and data.containsKey('port')))">
                    a.port,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('deviceStatus') or colPickMode == 1 and data.containsKey('deviceStatus')))">
                    a.deviceStatus,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('enabled') or colPickMode == 1 and data.containsKey('enabled')))">
                    a.enabled,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('deviceRemark') or colPickMode == 1 and data.containsKey('deviceRemark')))">
                    a.deviceRemark,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('onlineTime') or colPickMode == 1 and data.containsKey('onlineTime')))">
                    a.onlineTime,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('offlineTime') or colPickMode == 1 and data.containsKey('offlineTime')))">
                    a.offlineTime,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createUserId') or colPickMode == 1 and data.containsKey('createUserId')))">
                    a.createUserId,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createTime') or colPickMode == 1 and data.containsKey('createTime')))">
                    a.createTime,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateUserId') or colPickMode == 1 and data.containsKey('updateUserId')))">
                    a.updateUserId,
                </if>
                <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateTime') or colPickMode == 1 and data.containsKey('updateTime')))">
                    a.updateTime,
                </if>
        </trim>
    </sql>
    <!-- 新增 区分主键自增加还是业务插入 -->
    <insert id="insert" parameterType="DeviceEntity" >
        insert into mortals_xhx_device
        (id,deviceName,roomId,roomName,deviceCode,deviceMac,siteId,siteCode,siteName,productCode,productName,deviceFirmname,resolution,deviceInBuilding,deviceInFloor,defectsLiabilityPeriod,leadingOfficial,deviceAddr,leadingOfficialTelephone,devicePhotoPath,ip,centernum,port,deviceStatus,enabled,deviceRemark,onlineTime,offlineTime,createUserId,createTime,updateUserId,updateTime)
        VALUES
        (#{id},#{deviceName},#{roomId},#{roomName},#{deviceCode},#{deviceMac},#{siteId},#{siteCode},#{siteName},#{productCode},#{productName},#{deviceFirmname},#{resolution},#{deviceInBuilding},#{deviceInFloor},#{defectsLiabilityPeriod},#{leadingOfficial},#{deviceAddr},#{leadingOfficialTelephone},#{devicePhotoPath},#{ip},#{centernum},#{port},#{deviceStatus},#{enabled},#{deviceRemark},#{onlineTime},#{offlineTime},#{createUserId},#{createTime},#{updateUserId},#{updateTime})
    </insert>

    <!-- 批量新增 -->
    <insert id="insertBatch" parameterType="paramDto">
        insert into mortals_xhx_device
        (id,deviceName,roomId,roomName,deviceCode,deviceMac,siteId,siteCode,siteName,productCode,productName,deviceFirmname,resolution,deviceInBuilding,deviceInFloor,defectsLiabilityPeriod,leadingOfficial,deviceAddr,leadingOfficialTelephone,devicePhotoPath,ip,centernum,port,deviceStatus,enabled,deviceRemark,onlineTime,offlineTime,createUserId,createTime,updateUserId,updateTime)
        VALUES
        <foreach collection="data.dataList" item="item" index="index" separator="," >
            (#{item.id},#{item.deviceName},#{item.roomId},#{item.roomName},#{item.deviceCode},#{item.deviceMac},#{item.siteId},#{item.siteCode},#{item.siteName},#{item.productCode},#{item.productName},#{item.deviceFirmname},#{item.resolution},#{item.deviceInBuilding},#{item.deviceInFloor},#{item.defectsLiabilityPeriod},#{item.leadingOfficial},#{item.deviceAddr},#{item.leadingOfficialTelephone},#{item.devicePhotoPath},#{item.ip},#{item.centernum},#{item.port},#{item.deviceStatus},#{item.enabled},#{item.deviceRemark},#{item.onlineTime},#{item.offlineTime},#{item.createUserId},#{item.createTime},#{item.updateUserId},#{item.updateTime})
        </foreach>
    </insert>


    <!-- 根据ParamDto更新 -->
    <update id="update" parameterType="paramDto">
        update mortals_xhx_device as a
        set
        <trim suffixOverrides="," suffix="">
            <if test="(colPickMode==0 and data.containsKey('deviceName')) or (colPickMode==1 and !data.containsKey('deviceName'))">
                a.deviceName=#{data.deviceName},
            </if>
            <if test="(colPickMode==0 and data.containsKey('roomId')) or (colPickMode==1 and !data.containsKey('roomId'))">
                a.roomId=#{data.roomId},
            </if>
            <if test="(colPickMode==0 and data.containsKey('roomIdIncrement')) or (colPickMode==1 and !data.containsKey('roomIdIncrement'))">
                a.roomId=ifnull(a.roomId,0) + #{data.roomIdIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('roomName')) or (colPickMode==1 and !data.containsKey('roomName'))">
                a.roomName=#{data.roomName},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deviceCode')) or (colPickMode==1 and !data.containsKey('deviceCode'))">
                a.deviceCode=#{data.deviceCode},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deviceMac')) or (colPickMode==1 and !data.containsKey('deviceMac'))">
                a.deviceMac=#{data.deviceMac},
            </if>
            <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('siteCode')) or (colPickMode==1 and !data.containsKey('siteCode'))">
                a.siteCode=#{data.siteCode},
            </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('productCode')) or (colPickMode==1 and !data.containsKey('productCode'))">
                a.productCode=#{data.productCode},
            </if>
            <if test="(colPickMode==0 and data.containsKey('productName')) or (colPickMode==1 and !data.containsKey('productName'))">
                a.productName=#{data.productName},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deviceFirmname')) or (colPickMode==1 and !data.containsKey('deviceFirmname'))">
                a.deviceFirmname=#{data.deviceFirmname},
            </if>
            <if test="(colPickMode==0 and data.containsKey('resolution')) or (colPickMode==1 and !data.containsKey('resolution'))">
                a.resolution=#{data.resolution},
            </if>
            <if test="(colPickMode==0 and data.containsKey('resolutionIncrement')) or (colPickMode==1 and !data.containsKey('resolutionIncrement'))">
                a.resolution=ifnull(a.resolution,0) + #{data.resolutionIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deviceInBuilding')) or (colPickMode==1 and !data.containsKey('deviceInBuilding'))">
                a.deviceInBuilding=#{data.deviceInBuilding},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deviceInBuildingIncrement')) or (colPickMode==1 and !data.containsKey('deviceInBuildingIncrement'))">
                a.deviceInBuilding=ifnull(a.deviceInBuilding,0) + #{data.deviceInBuildingIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deviceInFloor')) or (colPickMode==1 and !data.containsKey('deviceInFloor'))">
                a.deviceInFloor=#{data.deviceInFloor},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deviceInFloorIncrement')) or (colPickMode==1 and !data.containsKey('deviceInFloorIncrement'))">
                a.deviceInFloor=ifnull(a.deviceInFloor,0) + #{data.deviceInFloorIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('defectsLiabilityPeriod')) or (colPickMode==1 and !data.containsKey('defectsLiabilityPeriod'))">
                a.defectsLiabilityPeriod=#{data.defectsLiabilityPeriod},
            </if>
            <if test="(colPickMode==0 and data.containsKey('leadingOfficial')) or (colPickMode==1 and !data.containsKey('leadingOfficial'))">
                a.leadingOfficial=#{data.leadingOfficial},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deviceAddr')) or (colPickMode==1 and !data.containsKey('deviceAddr'))">
                a.deviceAddr=#{data.deviceAddr},
            </if>
            <if test="(colPickMode==0 and data.containsKey('leadingOfficialTelephone')) or (colPickMode==1 and !data.containsKey('leadingOfficialTelephone'))">
                a.leadingOfficialTelephone=#{data.leadingOfficialTelephone},
            </if>
            <if test="(colPickMode==0 and data.containsKey('devicePhotoPath')) or (colPickMode==1 and !data.containsKey('devicePhotoPath'))">
                a.devicePhotoPath=#{data.devicePhotoPath},
            </if>
            <if test="(colPickMode==0 and data.containsKey('ip')) or (colPickMode==1 and !data.containsKey('ip'))">
                a.ip=#{data.ip},
            </if>
            <if test="(colPickMode==0 and data.containsKey('centernum')) or (colPickMode==1 and !data.containsKey('centernum'))">
                a.centernum=#{data.centernum},
            </if>
            <if test="(colPickMode==0 and data.containsKey('port')) or (colPickMode==1 and !data.containsKey('port'))">
                a.port=#{data.port},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deviceStatus')) or (colPickMode==1 and !data.containsKey('deviceStatus'))">
                a.deviceStatus=#{data.deviceStatus},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deviceStatusIncrement')) or (colPickMode==1 and !data.containsKey('deviceStatusIncrement'))">
                a.deviceStatus=ifnull(a.deviceStatus,0) + #{data.deviceStatusIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('enabled')) or (colPickMode==1 and !data.containsKey('enabled'))">
                a.enabled=#{data.enabled},
            </if>
            <if test="(colPickMode==0 and data.containsKey('enabledIncrement')) or (colPickMode==1 and !data.containsKey('enabledIncrement'))">
                a.enabled=ifnull(a.enabled,0) + #{data.enabledIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('deviceRemark')) or (colPickMode==1 and !data.containsKey('deviceRemark'))">
                a.deviceRemark=#{data.deviceRemark},
            </if>
            <if test="(colPickMode==0 and data.containsKey('onlineTime')) or (colPickMode==1 and !data.containsKey('onlineTime'))">
                a.onlineTime=#{data.onlineTime},
            </if>
            <if test="(colPickMode==0 and data.containsKey('offlineTime')) or (colPickMode==1 and !data.containsKey('offlineTime'))">
                a.offlineTime=#{data.offlineTime},
            </if>
            <if test="(colPickMode==0 and data.containsKey('createUserId')) or (colPickMode==1 and !data.containsKey('createUserId'))">
                a.createUserId=#{data.createUserId},
            </if>
            <if test="(colPickMode==0 and data.containsKey('createUserIdIncrement')) or (colPickMode==1 and !data.containsKey('createUserIdIncrement'))">
                a.createUserId=ifnull(a.createUserId,0) + #{data.createUserIdIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('createTime')) or (colPickMode==1 and !data.containsKey('createTime'))">
                a.createTime=#{data.createTime},
            </if>
            <if test="(colPickMode==0 and data.containsKey('updateUserId')) or (colPickMode==1 and !data.containsKey('updateUserId'))">
                a.updateUserId=#{data.updateUserId},
            </if>
            <if test="(colPickMode==0 and data.containsKey('updateUserIdIncrement')) or (colPickMode==1 and !data.containsKey('updateUserIdIncrement'))">
                a.updateUserId=ifnull(a.updateUserId,0) + #{data.updateUserIdIncrement},
            </if>
            <if test="(colPickMode==0 and data.containsKey('updateTime')) or (colPickMode==1 and !data.containsKey('updateTime'))">
                a.updateTime=#{data.updateTime},
            </if>
        </trim>
        <trim suffixOverrides="where" suffix="">
            where
            <trim prefixOverrides="and" prefix="">
                <include refid="_condition_"/>
            </trim>
        </trim>
    </update>
    <!-- 批量更新 -->
    <update id="updateBatch" parameterType="paramDto">
        update mortals_xhx_device as a
        <trim prefix="set" suffixOverrides=",">
                <trim prefix="deviceName=(case" suffix="ELSE deviceName end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('deviceName')) or (colPickMode==1 and !item.containsKey('deviceName'))">
                            when a.id=#{item.id} then #{item.deviceName}
                        </if>
                    </foreach>
                </trim>
                        <trim prefix="roomId=(case" suffix="ELSE roomId end),">
                            <foreach collection="data.dataList" item="item" index="index" separator="" >
                                <choose>
                                    <when test="(colPickMode==0 and item.containsKey('roomId')) or (colPickMode==1 and !item.containsKey('roomId'))">
                                        when a.id=#{item.id} then #{item.roomId}
                                    </when>
                                    <when test="(colPickMode==0 and item.containsKey('roomIdIncrement')) or (colPickMode==1 and !item.containsKey('roomIdIncrement'))">
                                        when a.id=#{item.id} then ifnull(a.roomId,0) + #{item.roomIdIncrement}
                                    </when>
                                </choose>
                            </foreach>
                        </trim>
                <trim prefix="roomName=(case" suffix="ELSE roomName end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('roomName')) or (colPickMode==1 and !item.containsKey('roomName'))">
                            when a.id=#{item.id} then #{item.roomName}
                        </if>
                    </foreach>
                </trim>
                <trim prefix="deviceCode=(case" suffix="ELSE deviceCode end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('deviceCode')) or (colPickMode==1 and !item.containsKey('deviceCode'))">
                            when a.id=#{item.id} then #{item.deviceCode}
                        </if>
                    </foreach>
                </trim>
                <trim prefix="deviceMac=(case" suffix="ELSE deviceMac end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('deviceMac')) or (colPickMode==1 and !item.containsKey('deviceMac'))">
                            when a.id=#{item.id} then #{item.deviceMac}
                        </if>
                    </foreach>
                </trim>
                        <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="siteCode=(case" suffix="ELSE siteCode end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('siteCode')) or (colPickMode==1 and !item.containsKey('siteCode'))">
                            when a.id=#{item.id} then #{item.siteCode}
                        </if>
                    </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="productCode=(case" suffix="ELSE productCode end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('productCode')) or (colPickMode==1 and !item.containsKey('productCode'))">
                            when a.id=#{item.id} then #{item.productCode}
                        </if>
                    </foreach>
                </trim>
                <trim prefix="productName=(case" suffix="ELSE productName end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('productName')) or (colPickMode==1 and !item.containsKey('productName'))">
                            when a.id=#{item.id} then #{item.productName}
                        </if>
                    </foreach>
                </trim>
                <trim prefix="deviceFirmname=(case" suffix="ELSE deviceFirmname end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('deviceFirmname')) or (colPickMode==1 and !item.containsKey('deviceFirmname'))">
                            when a.id=#{item.id} then #{item.deviceFirmname}
                        </if>
                    </foreach>
                </trim>
                        <trim prefix="resolution=(case" suffix="ELSE resolution end),">
                            <foreach collection="data.dataList" item="item" index="index" separator="" >
                                <choose>
                                    <when test="(colPickMode==0 and item.containsKey('resolution')) or (colPickMode==1 and !item.containsKey('resolution'))">
                                        when a.id=#{item.id} then #{item.resolution}
                                    </when>
                                    <when test="(colPickMode==0 and item.containsKey('resolutionIncrement')) or (colPickMode==1 and !item.containsKey('resolutionIncrement'))">
                                        when a.id=#{item.id} then ifnull(a.resolution,0) + #{item.resolutionIncrement}
                                    </when>
                                </choose>
                            </foreach>
                        </trim>
                        <trim prefix="deviceInBuilding=(case" suffix="ELSE deviceInBuilding end),">
                            <foreach collection="data.dataList" item="item" index="index" separator="" >
                                <choose>
                                    <when test="(colPickMode==0 and item.containsKey('deviceInBuilding')) or (colPickMode==1 and !item.containsKey('deviceInBuilding'))">
                                        when a.id=#{item.id} then #{item.deviceInBuilding}
                                    </when>
                                    <when test="(colPickMode==0 and item.containsKey('deviceInBuildingIncrement')) or (colPickMode==1 and !item.containsKey('deviceInBuildingIncrement'))">
                                        when a.id=#{item.id} then ifnull(a.deviceInBuilding,0) + #{item.deviceInBuildingIncrement}
                                    </when>
                                </choose>
                            </foreach>
                        </trim>
                        <trim prefix="deviceInFloor=(case" suffix="ELSE deviceInFloor end),">
                            <foreach collection="data.dataList" item="item" index="index" separator="" >
                                <choose>
                                    <when test="(colPickMode==0 and item.containsKey('deviceInFloor')) or (colPickMode==1 and !item.containsKey('deviceInFloor'))">
                                        when a.id=#{item.id} then #{item.deviceInFloor}
                                    </when>
                                    <when test="(colPickMode==0 and item.containsKey('deviceInFloorIncrement')) or (colPickMode==1 and !item.containsKey('deviceInFloorIncrement'))">
                                        when a.id=#{item.id} then ifnull(a.deviceInFloor,0) + #{item.deviceInFloorIncrement}
                                    </when>
                                </choose>
                            </foreach>
                        </trim>
                <trim prefix="defectsLiabilityPeriod=(case" suffix="ELSE defectsLiabilityPeriod end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('defectsLiabilityPeriod')) or (colPickMode==1 and !item.containsKey('defectsLiabilityPeriod'))">
                            when a.id=#{item.id} then #{item.defectsLiabilityPeriod}
                        </if>
                    </foreach>
                </trim>
                <trim prefix="leadingOfficial=(case" suffix="ELSE leadingOfficial end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('leadingOfficial')) or (colPickMode==1 and !item.containsKey('leadingOfficial'))">
                            when a.id=#{item.id} then #{item.leadingOfficial}
                        </if>
                    </foreach>
                </trim>
                <trim prefix="deviceAddr=(case" suffix="ELSE deviceAddr end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('deviceAddr')) or (colPickMode==1 and !item.containsKey('deviceAddr'))">
                            when a.id=#{item.id} then #{item.deviceAddr}
                        </if>
                    </foreach>
                </trim>
                <trim prefix="leadingOfficialTelephone=(case" suffix="ELSE leadingOfficialTelephone end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('leadingOfficialTelephone')) or (colPickMode==1 and !item.containsKey('leadingOfficialTelephone'))">
                            when a.id=#{item.id} then #{item.leadingOfficialTelephone}
                        </if>
                    </foreach>
                </trim>
                <trim prefix="devicePhotoPath=(case" suffix="ELSE devicePhotoPath end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('devicePhotoPath')) or (colPickMode==1 and !item.containsKey('devicePhotoPath'))">
                            when a.id=#{item.id} then #{item.devicePhotoPath}
                        </if>
                    </foreach>
                </trim>
                <trim prefix="ip=(case" suffix="ELSE ip end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('ip')) or (colPickMode==1 and !item.containsKey('ip'))">
                            when a.id=#{item.id} then #{item.ip}
                        </if>
                    </foreach>
                </trim>
                <trim prefix="centernum=(case" suffix="ELSE centernum end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('centernum')) or (colPickMode==1 and !item.containsKey('centernum'))">
                            when a.id=#{item.id} then #{item.centernum}
                        </if>
                    </foreach>
                </trim>
                <trim prefix="port=(case" suffix="ELSE port end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('port')) or (colPickMode==1 and !item.containsKey('port'))">
                            when a.id=#{item.id} then #{item.port}
                        </if>
                    </foreach>
                </trim>
                        <trim prefix="deviceStatus=(case" suffix="ELSE deviceStatus end),">
                            <foreach collection="data.dataList" item="item" index="index" separator="" >
                                <choose>
                                    <when test="(colPickMode==0 and item.containsKey('deviceStatus')) or (colPickMode==1 and !item.containsKey('deviceStatus'))">
                                        when a.id=#{item.id} then #{item.deviceStatus}
                                    </when>
                                    <when test="(colPickMode==0 and item.containsKey('deviceStatusIncrement')) or (colPickMode==1 and !item.containsKey('deviceStatusIncrement'))">
                                        when a.id=#{item.id} then ifnull(a.deviceStatus,0) + #{item.deviceStatusIncrement}
                                    </when>
                                </choose>
                            </foreach>
                        </trim>
                        <trim prefix="enabled=(case" suffix="ELSE enabled end),">
                            <foreach collection="data.dataList" item="item" index="index" separator="" >
                                <choose>
                                    <when test="(colPickMode==0 and item.containsKey('enabled')) or (colPickMode==1 and !item.containsKey('enabled'))">
                                        when a.id=#{item.id} then #{item.enabled}
                                    </when>
                                    <when test="(colPickMode==0 and item.containsKey('enabledIncrement')) or (colPickMode==1 and !item.containsKey('enabledIncrement'))">
                                        when a.id=#{item.id} then ifnull(a.enabled,0) + #{item.enabledIncrement}
                                    </when>
                                </choose>
                            </foreach>
                        </trim>
                <trim prefix="deviceRemark=(case" suffix="ELSE deviceRemark end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('deviceRemark')) or (colPickMode==1 and !item.containsKey('deviceRemark'))">
                            when a.id=#{item.id} then #{item.deviceRemark}
                        </if>
                    </foreach>
                </trim>
                <trim prefix="onlineTime=(case" suffix="ELSE onlineTime end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('onlineTime')) or (colPickMode==1 and !item.containsKey('onlineTime'))">
                            when a.id=#{item.id} then #{item.onlineTime}
                        </if>
                    </foreach>
                </trim>
                <trim prefix="offlineTime=(case" suffix="ELSE offlineTime end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('offlineTime')) or (colPickMode==1 and !item.containsKey('offlineTime'))">
                            when a.id=#{item.id} then #{item.offlineTime}
                        </if>
                    </foreach>
                </trim>
                        <trim prefix="createUserId=(case" suffix="ELSE createUserId end),">
                            <foreach collection="data.dataList" item="item" index="index" separator="" >
                                <choose>
                                    <when test="(colPickMode==0 and item.containsKey('createUserId')) or (colPickMode==1 and !item.containsKey('createUserId'))">
                                        when a.id=#{item.id} then #{item.createUserId}
                                    </when>
                                    <when test="(colPickMode==0 and item.containsKey('createUserIdIncrement')) or (colPickMode==1 and !item.containsKey('createUserIdIncrement'))">
                                        when a.id=#{item.id} then ifnull(a.createUserId,0) + #{item.createUserIdIncrement}
                                    </when>
                                </choose>
                            </foreach>
                        </trim>
                <trim prefix="createTime=(case" suffix="ELSE createTime end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('createTime')) or (colPickMode==1 and !item.containsKey('createTime'))">
                            when a.id=#{item.id} then #{item.createTime}
                        </if>
                    </foreach>
                </trim>
                        <trim prefix="updateUserId=(case" suffix="ELSE updateUserId end),">
                            <foreach collection="data.dataList" item="item" index="index" separator="" >
                                <choose>
                                    <when test="(colPickMode==0 and item.containsKey('updateUserId')) or (colPickMode==1 and !item.containsKey('updateUserId'))">
                                        when a.id=#{item.id} then #{item.updateUserId}
                                    </when>
                                    <when test="(colPickMode==0 and item.containsKey('updateUserIdIncrement')) or (colPickMode==1 and !item.containsKey('updateUserIdIncrement'))">
                                        when a.id=#{item.id} then ifnull(a.updateUserId,0) + #{item.updateUserIdIncrement}
                                    </when>
                                </choose>
                            </foreach>
                        </trim>
                <trim prefix="updateTime=(case" suffix="ELSE updateTime end),">
                    <foreach collection="data.dataList" item="item" index="index" separator="" >
                        <if test="(colPickMode==0 and item.containsKey('updateTime')) or (colPickMode==1 and !item.containsKey('updateTime'))">
                            when a.id=#{item.id} then #{item.updateTime}
                        </if>
                    </foreach>
                </trim>
        </trim>
        where id in
        <foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")">
            #{item.id}
        </foreach>
    </update>
    <!-- 根据主健查询 -->
    <select id="getByKey" parameterType="paramDto" resultMap="DeviceEntity-Map">
        select <include refid="_columns"/>
        from mortals_xhx_device as a
        where a.id=#{condition.id}
    </select>
    <!-- 根据主健删除 -->
    <delete id="deleteByKey" parameterType="paramDto">
        delete a.* from mortals_xhx_device as a where a.id=#{condition.id}
    </delete>
    <!-- 根据主健删除一批，针对单一主健有效 -->
    <delete id="deleteByKeys">
        delete from mortals_xhx_device where id in
        <foreach collection="array" item="item" index="index" open="(" separator="," close=")">
            #{item}
        </foreach>
    </delete>
    <!-- 根据主健列表删除一批，针对单一主健有效 -->
    <delete id="deleteByKeyList">
        delete from mortals_xhx_device where id in
        <foreach collection="list" item="item" index="index" open="(" separator="," close=")">
            #{item}
        </foreach>
    </delete>

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


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

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

            <if test="conditionParamRef.containsKey('deviceMac')">
                <if test="conditionParamRef.deviceMac != null and conditionParamRef.deviceMac != ''">
                    ${_conditionType_} a.deviceMac like #{${_conditionParam_}.deviceMac}
                </if>
                <if test="conditionParamRef.deviceMac == null">
                    ${_conditionType_} a.deviceMac is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('deviceMacList') and conditionParamRef.deviceMacList.size() > 0">
                ${_conditionType_} a.deviceMac in
                <foreach collection="conditionParamRef.deviceMacList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('deviceMacNotList') and conditionParamRef.deviceMacNotList.size() > 0">
                ${_conditionType_} a.deviceMac not in
                <foreach collection="conditionParamRef.deviceMacNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </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('siteCode')">
                <if test="conditionParamRef.siteCode != null and conditionParamRef.siteCode != ''">
                    ${_conditionType_} a.siteCode like #{${_conditionParam_}.siteCode}
                </if>
                <if test="conditionParamRef.siteCode == null">
                    ${_conditionType_} a.siteCode is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('siteCodeList') and conditionParamRef.siteCodeList.size() > 0">
                ${_conditionType_} a.siteCode in
                <foreach collection="conditionParamRef.siteCodeList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('siteCodeNotList') and conditionParamRef.siteCodeNotList.size() > 0">
                ${_conditionType_} a.siteCode not in
                <foreach collection="conditionParamRef.siteCodeNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </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('productCode')">
                <if test="conditionParamRef.productCode != null and conditionParamRef.productCode != ''">
                    ${_conditionType_} a.productCode like #{${_conditionParam_}.productCode}
                </if>
                <if test="conditionParamRef.productCode == null">
                    ${_conditionType_} a.productCode is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('productCodeList') and conditionParamRef.productCodeList.size() > 0">
                ${_conditionType_} a.productCode in
                <foreach collection="conditionParamRef.productCodeList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('productCodeNotList') and conditionParamRef.productCodeNotList.size() > 0">
                ${_conditionType_} a.productCode not in
                <foreach collection="conditionParamRef.productCodeNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>

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

            <if test="conditionParamRef.containsKey('deviceFirmname')">
                <if test="conditionParamRef.deviceFirmname != null and conditionParamRef.deviceFirmname != ''">
                    ${_conditionType_} a.deviceFirmname like #{${_conditionParam_}.deviceFirmname}
                </if>
                <if test="conditionParamRef.deviceFirmname == null">
                    ${_conditionType_} a.deviceFirmname is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('deviceFirmnameList') and conditionParamRef.deviceFirmnameList.size() > 0">
                ${_conditionType_} a.deviceFirmname in
                <foreach collection="conditionParamRef.deviceFirmnameList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('deviceFirmnameNotList') and conditionParamRef.deviceFirmnameNotList.size() > 0">
                ${_conditionType_} a.deviceFirmname not in
                <foreach collection="conditionParamRef.deviceFirmnameNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('resolution')">
                <if test="conditionParamRef.resolution != null ">
                    ${_conditionType_} a.resolution = #{${_conditionParam_}.resolution}
                </if>
                <if test="conditionParamRef.resolution == null">
                    ${_conditionType_} a.resolution is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('resolutionList') and conditionParamRef.resolutionList.size() > 0">
                ${_conditionType_} a.resolution in
                <foreach collection="conditionParamRef.resolutionList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('resolutionNotList') and conditionParamRef.resolutionNotList.size() > 0">
                ${_conditionType_} a.resolution not in
                <foreach collection="conditionParamRef.resolutionNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('resolutionStart') and conditionParamRef.resolutionStart != null">
                ${_conditionType_} a.resolution <![CDATA[ >= ]]> #{${_conditionParam_}.resolutionStart}
            </if>
            <if test="conditionParamRef.containsKey('resolutionEnd') and conditionParamRef.resolutionEnd != null">
                ${_conditionType_} a.resolution <![CDATA[ <= ]]> #{${_conditionParam_}.resolutionEnd}
            </if>

            <if test="conditionParamRef.containsKey('deviceInBuilding')">
                <if test="conditionParamRef.deviceInBuilding != null ">
                    ${_conditionType_} a.deviceInBuilding = #{${_conditionParam_}.deviceInBuilding}
                </if>
                <if test="conditionParamRef.deviceInBuilding == null">
                    ${_conditionType_} a.deviceInBuilding is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('deviceInBuildingList') and conditionParamRef.deviceInBuildingList.size() > 0">
                ${_conditionType_} a.deviceInBuilding in
                <foreach collection="conditionParamRef.deviceInBuildingList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('deviceInBuildingNotList') and conditionParamRef.deviceInBuildingNotList.size() > 0">
                ${_conditionType_} a.deviceInBuilding not in
                <foreach collection="conditionParamRef.deviceInBuildingNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('deviceInBuildingStart') and conditionParamRef.deviceInBuildingStart != null">
                ${_conditionType_} a.deviceInBuilding <![CDATA[ >= ]]> #{${_conditionParam_}.deviceInBuildingStart}
            </if>
            <if test="conditionParamRef.containsKey('deviceInBuildingEnd') and conditionParamRef.deviceInBuildingEnd != null">
                ${_conditionType_} a.deviceInBuilding <![CDATA[ <= ]]> #{${_conditionParam_}.deviceInBuildingEnd}
            </if>

            <if test="conditionParamRef.containsKey('deviceInFloor')">
                <if test="conditionParamRef.deviceInFloor != null ">
                    ${_conditionType_} a.deviceInFloor = #{${_conditionParam_}.deviceInFloor}
                </if>
                <if test="conditionParamRef.deviceInFloor == null">
                    ${_conditionType_} a.deviceInFloor is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('deviceInFloorList') and conditionParamRef.deviceInFloorList.size() > 0">
                ${_conditionType_} a.deviceInFloor in
                <foreach collection="conditionParamRef.deviceInFloorList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('deviceInFloorNotList') and conditionParamRef.deviceInFloorNotList.size() > 0">
                ${_conditionType_} a.deviceInFloor not in
                <foreach collection="conditionParamRef.deviceInFloorNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('deviceInFloorStart') and conditionParamRef.deviceInFloorStart != null">
                ${_conditionType_} a.deviceInFloor <![CDATA[ >= ]]> #{${_conditionParam_}.deviceInFloorStart}
            </if>
            <if test="conditionParamRef.containsKey('deviceInFloorEnd') and conditionParamRef.deviceInFloorEnd != null">
                ${_conditionType_} a.deviceInFloor <![CDATA[ <= ]]> #{${_conditionParam_}.deviceInFloorEnd}
            </if>


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

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

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

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

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

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

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

            <if test="conditionParamRef.containsKey('port')">
                <if test="conditionParamRef.port != null and conditionParamRef.port != ''">
                    ${_conditionType_} a.port like #{${_conditionParam_}.port}
                </if>
                <if test="conditionParamRef.port == null">
                    ${_conditionType_} a.port is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('portList') and conditionParamRef.portList.size() > 0">
                ${_conditionType_} a.port in
                <foreach collection="conditionParamRef.portList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('portNotList') and conditionParamRef.portNotList.size() > 0">
                ${_conditionType_} a.port not in
                <foreach collection="conditionParamRef.portNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('deviceStatus')">
                <if test="conditionParamRef.deviceStatus != null ">
                    ${_conditionType_} a.deviceStatus = #{${_conditionParam_}.deviceStatus}
                </if>
                <if test="conditionParamRef.deviceStatus == null">
                    ${_conditionType_} a.deviceStatus is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('deviceStatusList') and conditionParamRef.deviceStatusList.size() > 0">
                ${_conditionType_} a.deviceStatus in
                <foreach collection="conditionParamRef.deviceStatusList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('deviceStatusNotList') and conditionParamRef.deviceStatusNotList.size() > 0">
                ${_conditionType_} a.deviceStatus not in
                <foreach collection="conditionParamRef.deviceStatusNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('deviceStatusStart') and conditionParamRef.deviceStatusStart != null">
                ${_conditionType_} a.deviceStatus <![CDATA[ >= ]]> #{${_conditionParam_}.deviceStatusStart}
            </if>
            <if test="conditionParamRef.containsKey('deviceStatusEnd') and conditionParamRef.deviceStatusEnd != null">
                ${_conditionType_} a.deviceStatus <![CDATA[ <= ]]> #{${_conditionParam_}.deviceStatusEnd}
            </if>

            <if test="conditionParamRef.containsKey('enabled')">
                <if test="conditionParamRef.enabled != null ">
                    ${_conditionType_} a.enabled = #{${_conditionParam_}.enabled}
                </if>
                <if test="conditionParamRef.enabled == null">
                    ${_conditionType_} a.enabled is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('enabledList') and conditionParamRef.enabledList.size() > 0">
                ${_conditionType_} a.enabled in
                <foreach collection="conditionParamRef.enabledList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('enabledNotList') and conditionParamRef.enabledNotList.size() > 0">
                ${_conditionType_} a.enabled not in
                <foreach collection="conditionParamRef.enabledNotList" open="(" close=")" index="index" item="item" separator=",">
                    #{item}
                </foreach>
            </if>
            <if test="conditionParamRef.containsKey('enabledStart') and conditionParamRef.enabledStart != null">
                ${_conditionType_} a.enabled <![CDATA[ >= ]]> #{${_conditionParam_}.enabledStart}
            </if>
            <if test="conditionParamRef.containsKey('enabledEnd') and conditionParamRef.enabledEnd != null">
                ${_conditionType_} a.enabled <![CDATA[ <= ]]> #{${_conditionParam_}.enabledEnd}
            </if>


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

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

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


            <if test="conditionParamRef.containsKey('updateTime')">
                <if test="conditionParamRef.updateTime != null ">
                    ${_conditionType_} a.updateTime = #{${_conditionParam_}.updateTime}
                </if>
                <if test="conditionParamRef.updateTime == null">
                    ${_conditionType_} a.updateTime is null
                </if>
            </if>
            <if test="conditionParamRef.containsKey('updateTimeStart') and conditionParamRef.updateTimeStart != null and conditionParamRef.updateTimeStart!=''">
                ${_conditionType_} a.updateTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
            </if>
            <if test="conditionParamRef.containsKey('updateTimeEnd') and conditionParamRef.updateTimeEnd != null and conditionParamRef.updateTimeEnd!=''">
                ${_conditionType_} a.updateTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
            </if>
    </sql>
    <sql id="_orderCols_">
        <if test="orderColList != null and !orderColList.isEmpty()">
            order by
                    <if test="conditionParamRef.containsKey('idList') and conditionParamRef.idList.size() > 0">
                        field(a.id,
                        <foreach collection="conditionParamRef.idList" open="" close=")" index="index" item="item" separator=",">
                            #{item}
                        </foreach>
                        ,
                    </if>
                    <if test="conditionParamRef.containsKey('roomIdList') and conditionParamRef.roomIdList.size() > 0">
                        field(a.roomId,
                        <foreach collection="conditionParamRef.roomIdList" open="" close=")" index="index" item="item" separator=",">
                            #{item}
                        </foreach>
                        ,
                    </if>
                    <if test="conditionParamRef.containsKey('siteIdList') and conditionParamRef.siteIdList.size() > 0">
                        field(a.siteId,
                        <foreach collection="conditionParamRef.siteIdList" open="" close=")" index="index" item="item" separator=",">
                            #{item}
                        </foreach>
                        ,
                    </if>
                    <if test="conditionParamRef.containsKey('resolutionList') and conditionParamRef.resolutionList.size() > 0">
                        field(a.resolution,
                        <foreach collection="conditionParamRef.resolutionList" open="" close=")" index="index" item="item" separator=",">
                            #{item}
                        </foreach>
                        ,
                    </if>
                    <if test="conditionParamRef.containsKey('deviceInBuildingList') and conditionParamRef.deviceInBuildingList.size() > 0">
                        field(a.deviceInBuilding,
                        <foreach collection="conditionParamRef.deviceInBuildingList" open="" close=")" index="index" item="item" separator=",">
                            #{item}
                        </foreach>
                        ,
                    </if>
                    <if test="conditionParamRef.containsKey('deviceInFloorList') and conditionParamRef.deviceInFloorList.size() > 0">
                        field(a.deviceInFloor,
                        <foreach collection="conditionParamRef.deviceInFloorList" open="" close=")" index="index" item="item" separator=",">
                            #{item}
                        </foreach>
                        ,
                    </if>
                    <if test="conditionParamRef.containsKey('deviceStatusList') and conditionParamRef.deviceStatusList.size() > 0">
                        field(a.deviceStatus,
                        <foreach collection="conditionParamRef.deviceStatusList" open="" close=")" index="index" item="item" separator=",">
                            #{item}
                        </foreach>
                        ,
                    </if>
                    <if test="conditionParamRef.containsKey('enabledList') and conditionParamRef.enabledList.size() > 0">
                        field(a.enabled,
                        <foreach collection="conditionParamRef.enabledList" open="" close=")" index="index" item="item" separator=",">
                            #{item}
                        </foreach>
                        ,
                    </if>
                    <if test="conditionParamRef.containsKey('createUserIdList') and conditionParamRef.createUserIdList.size() > 0">
                        field(a.createUserId,
                        <foreach collection="conditionParamRef.createUserIdList" open="" close=")" index="index" item="item" separator=",">
                            #{item}
                        </foreach>
                        ,
                    </if>
                    <if test="conditionParamRef.containsKey('updateUserIdList') and conditionParamRef.updateUserIdList.size() > 0">
                        field(a.updateUserId,
                        <foreach collection="conditionParamRef.updateUserIdList" open="" close=")" index="index" item="item" separator=",">
                            #{item}
                        </foreach>
                        ,
                    </if>
            <trim suffixOverrides=","  suffix="">
                <foreach collection="orderColList" open="" close="" index="index" item="item" separator=",">
                     a.${item.colName} ${item.sortKind}
                </foreach>
            </trim>
        </if>
        <if test="(orderColList == null or orderColList.isEmpty()) and orderCol != null and !orderCol.isEmpty()">
            order by
                    <if test="conditionParamRef.containsKey('idList') and conditionParamRef.idList.size() > 0">
                        field(a.id,
                        <foreach collection="conditionParamRef.idList" open="" close=")" index="index" item="item" separator=",">
                            #{item}
                        </foreach>
                        ,
                    </if>
                    <if test="conditionParamRef.containsKey('roomIdList') and conditionParamRef.roomIdList.size() > 0">
                        field(a.roomId,
                        <foreach collection="conditionParamRef.roomIdList" open="" close=")" index="index" item="item" separator=",">
                            #{item}
                        </foreach>
                        ,
                    </if>
                    <if test="conditionParamRef.containsKey('siteIdList') and conditionParamRef.siteIdList.size() > 0">
                        field(a.siteId,
                        <foreach collection="conditionParamRef.siteIdList" open="" close=")" index="index" item="item" separator=",">
                            #{item}
                        </foreach>
                        ,
                    </if>
                    <if test="conditionParamRef.containsKey('resolutionList') and conditionParamRef.resolutionList.size() > 0">
                        field(a.resolution,
                        <foreach collection="conditionParamRef.resolutionList" open="" close=")" index="index" item="item" separator=",">
                            #{item}
                        </foreach>
                        ,
                    </if>
                    <if test="conditionParamRef.containsKey('deviceInBuildingList') and conditionParamRef.deviceInBuildingList.size() > 0">
                        field(a.deviceInBuilding,
                        <foreach collection="conditionParamRef.deviceInBuildingList" open="" close=")" index="index" item="item" separator=",">
                            #{item}
                        </foreach>
                        ,
                    </if>
                    <if test="conditionParamRef.containsKey('deviceInFloorList') and conditionParamRef.deviceInFloorList.size() > 0">
                        field(a.deviceInFloor,
                        <foreach collection="conditionParamRef.deviceInFloorList" open="" close=")" index="index" item="item" separator=",">
                            #{item}
                        </foreach>
                        ,
                    </if>
                    <if test="conditionParamRef.containsKey('deviceStatusList') and conditionParamRef.deviceStatusList.size() > 0">
                        field(a.deviceStatus,
                        <foreach collection="conditionParamRef.deviceStatusList" open="" close=")" index="index" item="item" separator=",">
                            #{item}
                        </foreach>
                        ,
                    </if>
                    <if test="conditionParamRef.containsKey('enabledList') and conditionParamRef.enabledList.size() > 0">
                        field(a.enabled,
                        <foreach collection="conditionParamRef.enabledList" open="" close=")" index="index" item="item" separator=",">
                            #{item}
                        </foreach>
                        ,
                    </if>
                    <if test="conditionParamRef.containsKey('createUserIdList') and conditionParamRef.createUserIdList.size() > 0">
                        field(a.createUserId,
                        <foreach collection="conditionParamRef.createUserIdList" open="" close=")" index="index" item="item" separator=",">
                            #{item}
                        </foreach>
                        ,
                    </if>
                    <if test="conditionParamRef.containsKey('updateUserIdList') and conditionParamRef.updateUserIdList.size() > 0">
                        field(a.updateUserId,
                        <foreach collection="conditionParamRef.updateUserIdList" open="" close=")" index="index" item="item" separator=",">
                            #{item}
                        </foreach>
                        ,
                    </if>
            <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('deviceName')">
                        a.deviceName
                        <if test='orderCol.deviceName != null and "DESC".equalsIgnoreCase(orderCol.deviceName)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('roomId')">
                        a.roomId
                        <if test='orderCol.roomId != null and "DESC".equalsIgnoreCase(orderCol.roomId)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('roomName')">
                        a.roomName
                        <if test='orderCol.roomName != null and "DESC".equalsIgnoreCase(orderCol.roomName)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('deviceCode')">
                        a.deviceCode
                        <if test='orderCol.deviceCode != null and "DESC".equalsIgnoreCase(orderCol.deviceCode)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('deviceMac')">
                        a.deviceMac
                        <if test='orderCol.deviceMac != null and "DESC".equalsIgnoreCase(orderCol.deviceMac)'>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('siteCode')">
                        a.siteCode
                        <if test='orderCol.siteCode != null and "DESC".equalsIgnoreCase(orderCol.siteCode)'>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('productCode')">
                        a.productCode
                        <if test='orderCol.productCode != null and "DESC".equalsIgnoreCase(orderCol.productCode)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('productName')">
                        a.productName
                        <if test='orderCol.productName != null and "DESC".equalsIgnoreCase(orderCol.productName)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('deviceFirmname')">
                        a.deviceFirmname
                        <if test='orderCol.deviceFirmname != null and "DESC".equalsIgnoreCase(orderCol.deviceFirmname)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('resolution')">
                        a.resolution
                        <if test='orderCol.resolution != null and "DESC".equalsIgnoreCase(orderCol.resolution)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('deviceInBuilding')">
                        a.deviceInBuilding
                        <if test='orderCol.deviceInBuilding != null and "DESC".equalsIgnoreCase(orderCol.deviceInBuilding)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('deviceInFloor')">
                        a.deviceInFloor
                        <if test='orderCol.deviceInFloor != null and "DESC".equalsIgnoreCase(orderCol.deviceInFloor)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('defectsLiabilityPeriod')">
                        a.defectsLiabilityPeriod
                        <if test='orderCol.defectsLiabilityPeriod != null and "DESC".equalsIgnoreCase(orderCol.defectsLiabilityPeriod)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('leadingOfficial')">
                        a.leadingOfficial
                        <if test='orderCol.leadingOfficial != null and "DESC".equalsIgnoreCase(orderCol.leadingOfficial)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('deviceAddr')">
                        a.deviceAddr
                        <if test='orderCol.deviceAddr != null and "DESC".equalsIgnoreCase(orderCol.deviceAddr)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('leadingOfficialTelephone')">
                        a.leadingOfficialTelephone
                        <if test='orderCol.leadingOfficialTelephone != null and "DESC".equalsIgnoreCase(orderCol.leadingOfficialTelephone)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('devicePhotoPath')">
                        a.devicePhotoPath
                        <if test='orderCol.devicePhotoPath != null and "DESC".equalsIgnoreCase(orderCol.devicePhotoPath)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('ip')">
                        a.ip
                        <if test='orderCol.ip != null and "DESC".equalsIgnoreCase(orderCol.ip)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('centernum')">
                        a.centernum
                        <if test='orderCol.centernum != null and "DESC".equalsIgnoreCase(orderCol.centernum)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('port')">
                        a.port
                        <if test='orderCol.port != null and "DESC".equalsIgnoreCase(orderCol.port)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('deviceStatus')">
                        a.deviceStatus
                        <if test='orderCol.deviceStatus != null and "DESC".equalsIgnoreCase(orderCol.deviceStatus)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('enabled')">
                        a.enabled
                        <if test='orderCol.enabled != null and "DESC".equalsIgnoreCase(orderCol.enabled)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('deviceRemark')">
                        a.deviceRemark
                        <if test='orderCol.deviceRemark != null and "DESC".equalsIgnoreCase(orderCol.deviceRemark)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('onlineTime')">
                        a.onlineTime
                        <if test='orderCol.onlineTime != null and "DESC".equalsIgnoreCase(orderCol.onlineTime)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('offlineTime')">
                        a.offlineTime
                        <if test='orderCol.offlineTime != null and "DESC".equalsIgnoreCase(orderCol.offlineTime)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('createUserId')">
                        a.createUserId
                        <if test='orderCol.createUserId != null and "DESC".equalsIgnoreCase(orderCol.createUserId)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('createTime')">
                        a.createTime
                        <if test='orderCol.createTime != null and "DESC".equalsIgnoreCase(orderCol.createTime)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('updateUserId')">
                        a.updateUserId
                        <if test='orderCol.updateUserId != null and "DESC".equalsIgnoreCase(orderCol.updateUserId)'>DESC</if>
                        ,
                    </if>
                    <if test="orderCol.containsKey('updateTime')">
                        a.updateTime
                        <if test='orderCol.updateTime != null and "DESC".equalsIgnoreCase(orderCol.updateTime)'>DESC</if>
                        ,
                    </if>
            </trim>
        </if>


    </sql>
    <sql id="_group_by_">
        <if test="groupList != null and !groupList.isEmpty()">
            GROUP BY
            <trim suffixOverrides=","  suffix="">
                <foreach collection="groupList" open="" close="" index="index" item="item" separator=",">
                    ${item}
                </foreach>
            </trim>
        </if>
    </sql>
</mapper>