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

    <!-- 通用查询映射结果 -->
    <resultMap id="groundDataEntityResultMap" type="org.springblade.etl.entity.EtlGroundDataEntity">
        <result column="GUID" property="guid"/>
        <result column="ST_CODE" property="rtuCode"/>
        <result column="MEAS_DATE" property="tm"/>
        <result column="VERT_AVER_MOCO" property="vtavslm"/>
        <result column="SURF_MOCO" property="srlslm"/>
        <result column="MOCO_10CM" property="slm10"/>
        <result column="MOCO_20CM" property="slm20"/>
        <result column="MOCO_30CM" property="slm30"/>
        <result column="MOCO_40CM" property="slm40"/>
        <result column="MOCO_50CM" property="slm50"/>
        <result column="MOCO_60CM" property="slm60"/>
        <result column="MOCO_80CM" property="slm80"/>
        <result column="MOCO_10CM" property="slm100"/>

    </resultMap>


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