<?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.inspect.metadata.mqtt.mapper.HrNestBatteryMapper">
    <resultMap id="HrNestBatteryResult" type="com.inspect.metadata.mqtt.domain.HrNestBattery">
        <id property="nestBatteryId" column="nest_battery_id"/>
        <result property="nestCode" column="nest_code"/>
        <result property="no" column="no"/>
        <result property="power" column="power"/>
        <result property="state" column="state"/>
        <result property="temp" column="temp"/>
        <result property="exist" column="exist"/>
        <result property="createTime" column="create_time"/>
        <result property="updateTime" column="update_time"/>
    </resultMap>

    <sql id="selectHrNestBatteryVo">
        select nest_battery_id,
               nest_code,
               no,
               power,
               state,
               temp,
               exist,
               create_time,
               update_time
        from basedata_hr_nest_battery
    </sql>

    <select id="selectNestBatteryList" parameterType="com.inspect.metadata.mqtt.domain.HrNestBattery"
            resultMap="HrNestBatteryResult">
        <include refid="selectHrNestBatteryVo"/>
        <where>
            <if test="nestCode != null ">and nest_code = #{nestCode}</if>
        </where>
    </select>

    <select id="selectNestBatteryByCode" resultType="com.inspect.metadata.mqtt.domain.HrNestBattery">
        <include refid="selectHrNestBatteryVo"/>
        <where>
            <if test="nestCode != null ">and nest_code = #{nestCode}</if>
        </where>
        order by create_time desc
    </select>
</mapper>