<?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="org.springblade.etl.mapper.EtlRiverDataMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="riverDataEntityResultMap" type="org.springblade.etl.entity.EtlRiverDataEntity">
        <result column="GUID" property="guid"/>
        <result column="ST_CODE" property="rtuCode"/>
        <result column="TM" property="tm"/>
        <result column="Z" property="z"/>

    </resultMap>


    <select id="selectLastList" resultMap="riverDataEntityResultMap">
        SELECT
        d.*
        FROM
        etl_att_st_waco_ware d
        WHERE 1=1
        <if test="etlRiverDataDTO.rtuCode!=null">
            and d.ST_CODE = #{etlRiverDataDTO.rtuCode}
        </if>
        <if test="etlRiverDataDTO.lastTime!=null">
            and d.TM > #{etlRiverDataDTO.lastTime}
        </if>
        order by d.TM desc
        limit 1
    </select>
</mapper>
