Newer
Older
newfiber-termite / newfiber-termites / newfiber-termites-dataup / src / main / resources / mapper / termite / DeviceMonitoringDataRealtimeMapper.xml
@xiongkai xiongkai on 29 May 4 KB 基础代码调整
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.newfiber.termite.mapper.DeviceMonitoringDataRealtimeMapper">

    <!-- 通用查询映射结果 -->
    <resultMap type="com.newfiber.termite.domain.DeviceMonitoringDataRealtime" id="DeviceMonitoringDataRealtimeResult">
        <result property="id" column="id"/>
        <result property="sn" column="sn"/>
        <result property="date" column="date"/>
        <result property="yesnoant" column="yesnoant"/>
        <result property="rtpitcu" column="rtpitcu"/>
        <result property="idenpitcu" column="idenpitcu"/>
        <result property="idencolle" column="idencolle"/>
        <result property="druing" column="druing"/>
        <result property="druingDatetime" column="druing_datetime"/>
        <result property="heating" column="heating"/>
        <result property="heatingDatetime" column="heating_datetime"/>
        <result property="uptime" column="uptime"/>
        <result property="software" column="software"/>
        <result property="hardware" column="hardware"/>
        <result property="voltage" column="voltage"/>
        <result property="temperature" column="temperature"/>
        <result property="rssi" column="rssi"/>
        <result property="ap" column="ap"/>
        <result property="camera" column="camera"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        t.id
    	, t.sn
    	, t.date
    	, t.yesnoant
    	, t.rtpitcu
    	, t.idenpitcu
    	, t.idencolle
    	, t.druing
    	, t.druing_datetime
    	, t.heating
    	, t.heating_datetime
    	, t.uptime
    	, t.software
    	, t.hardware
    	, t.voltage
    	, t.temperature
    	, t.rssi
    	, t.ap
    	, t.camera
	</sql>

    <sql id="Where_Condition">
        <if test="request.sn != null and request.sn != ''">
            and t.sn = #{request.sn}
        </if>
        <if test="request.date != null and request.date != ''">
            and t.date = #{request.date}
        </if>
        <if test="request.yesnoant != null and request.yesnoant != ''">
            and t.yesnoant = #{request.yesnoant}
        </if>
        <if test="request.rtpitcu != null and request.rtpitcu != ''">
            and t.rtpitcu = #{request.rtpitcu}
        </if>
        <if test="request.idenpitcu != null and request.idenpitcu != ''">
            and t.idenpitcu = #{request.idenpitcu}
        </if>
        <if test="request.idencolle != null and request.idencolle != ''">
            and t.idencolle = #{request.idencolle}
        </if>
        <if test="request.druing != null and request.druing != ''">
            and t.druing = #{request.druing}
        </if>
        <if test="request.druingDatetime != null and request.druingDatetime != ''">
            and t.druing_datetime = #{request.druingDatetime}
        </if>
        <if test="request.heating != null and request.heating != ''">
            and t.heating = #{request.heating}
        </if>
        <if test="request.heatingDatetime != null and request.heatingDatetime != ''">
            and t.heating_datetime = #{request.heatingDatetime}
        </if>
        <if test="request.uptime != null and request.uptime != ''">
            and t.uptime = #{request.uptime}
        </if>
        <if test="request.software != null and request.software != ''">
            and t.software = #{request.software}
        </if>
        <if test="request.hardware != null and request.hardware != ''">
            and t.hardware = #{request.hardware}
        </if>
        <if test="request.voltage != null and request.voltage != ''">
            and t.voltage = #{request.voltage}
        </if>
        <if test="request.temperature != null and request.temperature != ''">
            and t.temperature = #{request.temperature}
        </if>
        <if test="request.rssi != null and request.rssi != ''">
            and t.rssi = #{request.rssi}
        </if>
        <if test="request.ap != null and request.ap != ''">
            and t.ap = #{request.ap}
        </if>
        <if test="request.camera != null and request.camera != ''">
            and t.camera = #{request.camera}
        </if>
    </sql>

    <sql id="Join_Table">

    </sql>

    <select id="selectByCondition" resultMap="DeviceMonitoringDataRealtimeResult">
        select
        <include refid="Base_Column_List"/>
        from ter_device_monitoring_data_realtime t
        <include refid="Join_Table"/>
        where t.del_flag = 0
        <include refid="Where_Condition"/>
        order by t.${request.orderBy}
    </select>

    <select id="selectOneById" resultMap="DeviceMonitoringDataRealtimeResult">
        select
        <include refid="Base_Column_List"/>
        from ter_device_monitoring_data_realtime t
        <include refid="Join_Table"/>
        where t.id = #{id} and t.del_flag = 0
    </select>

    <delete id="deleteBySn">
        delete from ter_device_monitoring_data_realtime where sn = #{sn}
    </delete>
</mapper>