<?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.EtlRsvrDataMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="rsvrDataEntityResultMap" type="org.springblade.etl.entity.EtlRsvrDataEntity">
        <result column="GUID" property="guid"/>
        <result column="ST_CODE" property="rtuCode"/>
        <result column="TM" property="tm"/>
        <result column="RZ" property="rz"/>
        <result column="W" property="w"/>
        <result column="INQ" property="inq"/>
        <result column="BLRZ" property="blrz"/>
        <result column="OTQ" property="otq"/>
        <result column="RWCHRCD" property="rwchrcd"/>
        <result column="RWPTN" property="rwptn"/>
        <result column="INQDR" property="inqdr"/>
        <result column="MSQMT" property="msqmt"/>
        <result column="FROM_DATE" property="fromDate"/>
        <result column="TO_DATE" property="toDate"/>
    </resultMap>

    <!--SL_ZHSL_NM_EXTRA-->
    <select id="selectLastList" resultMap="rsvrDataEntityResultMap">
        SELECT * FROM
        ( SELECT
        d.*
        FROM
        SL_ZHSL_NM_EXTRA.ATT_ST_RES_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="rsvrDataEntityResultMap">
        SELECT
        d.*
        FROM
        SL_ZHSL_NM_EXTRA.ATT_ST_RES_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>
