<?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"/>
        <result column="Q" property="q"/>
        <result column="XSA" property="xsa"/>
        <result column="XSAVV" property="xsavv"/>
        <result column="XSNXV" property="xsnxv"/>
        <result column="PLWCHRCD" property="plwchrcd"/>
        <result column="WPTN" property="wptn"/>
        <result column="MSQMT" property="msqmt"/>
        <result column="MSAMT" property="msamt"/>
        <result column="MSVMT" property="msvmt"/>
        <result column="FROM_DATE" property="fromDate"/>
        <result column="TO_DATE" property="toDate"/>
    </resultMap>

    <!--SL_ZHSL_NM_EXTRA-->
    <select id="selectLastList" resultMap="riverDataEntityResultMap">
        SELECT * FROM
        ( SELECT
        d.*
        FROM
        SL_ZHSL_NM_EXTRA.ATT_ST_WACO_WARE d
        WHERE 1=1
        <if test="entity.rtuCode!=null">
            and d.ST_CODE = #{entity.rtuCode}
        </if>
        <if test="entity.tm!=null">
            and d.TM > #{entity.tm}
        </if>
        order by d.TM desc )
        WHERE ROWNUM &lt;= 1
    </select>

    <select id="selectNewList" resultMap="riverDataEntityResultMap">
        SELECT
        d.*
        FROM
        SL_ZHSL_NM_EXTRA.ATT_ST_WACO_WARE d
        WHERE 1=1
        <if test="entity.rtuCode!=null">
            and d.ST_CODE = #{entity.rtuCode}
        </if>
        <if test="entity.tm!=null">
            and d.TM > #{entity.tm}
        </if>
        order by d.TM
    </select>
</mapper>
