<?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.lutao.cloud.oil.mapper.PerceptionMonitorHazardousGasInfoMapper">

  <resultMap id="perceptionMonitorHazardousGasInfoMap" type="com.lutao.entity.PerceptionMonitorHazardousGasInfo">
                  <id property="id" column="id"/>
                        <result property="pfId" column="pf_id"/>
                        <result property="appId" column="app_id"/>
                        <result property="platformCode" column="platform_code"/>
                        <result property="platformName" column="platform_name"/>
                        <result property="platformId" column="platform_id"/>
                        <result property="equipId" column="equip_id"/>
                        <result property="equipCode" column="equip_code"/>
                        <result property="tagId" column="tag_id"/>
                        <result property="tagCode" column="tag_code"/>
                        <result property="rtValue" column="rt_value"/>
                        <result property="collectTime" column="collect_time"/>
                        <result property="lastUpdateTime" column="last_update_time"/>
                        <result property="alarmState" column="alarm_state"/>
                        <result property="alarmType" column="alarm_type"/>
            </resultMap>

      <select id="selectNewRecore" resultType="com.lutao.entity.PerceptionMonitorHazardousGasInfo">
            SELECT
                  *
            FROM
                  perception_monitor_hazardous_gas_info a
            WHERE
                        #{size} > ( SELECT count(*) FROM perception_monitor_hazardous_gas_info b
                                    WHERE b.platform_code = a.platform_code AND b.id &lt; a.id )
            ORDER BY
                  a.platform_code,
                  a.id DESC
      </select>
</mapper>
