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

    <!-- 通用查询映射结果 -->
    <resultMap id="etlWarningInfoEntityResultMap" type="org.springblade.etl.entity.EtlWarningInfoEntity">
        <result column="ID" property="warnId"/>
        <result column="STCD" property="stcd"/>
        <result column="WARN_NAME" property="warnName"/>
        <result column="WARN_TIME" property="warnTime"/>
        <result column="WARN_LEVEL_CODE" property="warnLevelCode"/>
        <result column="WARN_INFO" property="warnInfo"/>
        <result column="WARN_STATUS" property="warnStatus"/>
        <result column="REVIEW_STATUS" property="reviewStatus"/>
        <result column="TYPE" property="type"/>
        <result column="REMARK" property="remark"/>
        <result column="RAIN_WARN_RATE" property="rainWarnRate"/>
        <result column="WARN_SORT" property="warnSort"/>
        <result column="WARN_LOCATION" property="warnLocation"/>
        <result column="WARN_ADCD" property="warnAdcd"/>
        <result column="USER_ADCD" property="userAdcd"/>
        <result column="WARN_LGTD" property="warnLgtd"/>
        <result column="WARN_LTTD" property="warnLttd"/>
        <result column="INTV" property="intv"/>
        <result column="DRP" property="drp"/>
        <result column="Z" property="z"/>
        <result column="Q" property="q"/>
        <result column="WPTN" property="wptn"/>
        <result column="RZ" property="rz"/>
        <result column="RWPTN" property="rwptn"/>
        <result column="INQ" property="inq"/>
        <result column="REL_WARN_ID" property="relWarnId"/>
        <result column="CREATE_TIME" property="originalCreateTime"/>
        <result column="UPDATE_TIME" property="originalUpdateTime"/>
    </resultMap>

    <!--SELECT_ZHSL_USER-->
    <select id="selectNewList" resultMap="etlWarningInfoEntityResultMap">
        SELECT
        d.*
        FROM
        ST_WARN_INFO d
        WHERE 1=1
        <if test="dto.reviewStatus!=null">
            and (d.REVIEW_STATUS is null or d.REVIEW_STATUS != #{dto.reviewStatus})
        </if>
        <if test="dto.type!=null">
            and d.TYPE = #{dto.type}
        </if>
        <if test="dto.lastTime!=null">
            and d.WARN_TIME > #{dto.lastTime}
        </if>
        order by d.WARN_TIME
    </select>

    <select id="getByWarnId" resultMap="etlWarningInfoEntityResultMap">
        SELECT * FROM
        (SELECT
        d.*
        FROM
        ST_WARN_INFO d
        WHERE 1=1
        <if test="dto.warnId!=null">
            and d.ID = #{dto.warnId}
        </if>
        order by d.CREATE_TIME)
        WHERE ROWNUM &lt;= 1
    </select>

</mapper>
