<?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="com.goldenwater.slgc.mapper.AttFsdaBaseMapper">

    <resultMap type="AttFsdaBase" id="AttFsdaBaseResult">
        <result property="fsdaCode" column="FSDA_CODE"/>
        <result property="collDate" column="COLL_DATE"/>
        <result property="fsdaName" column="FSDA_NAME"/>
        <result property="lowLeftLong" column="LOW_LEFT_LONG"/>
        <result property="lowLeftLat" column="LOW_LEFT_LAT"/>
        <result property="upRightLong" column="UP_RIGHT_LONG"/>
        <result property="upRightLat" column="UP_RIGHT_LAT"/>
        <result property="fsdaLoc" column="FSDA_LOC"/>
        <result property="fedaType" column="FEDA_TYPE"/>
        <result property="buildFlDate" column="BUILD_FL_DATE"/>
        <result property="fsdaTotAera" column="FSDA_TOT_AERA"/>
        <result property="fsdaDikeLen" column="FSDA_DIKE_LEN"/>
        <result property="desFlArea" column="DES_FL_AREA"/>
        <result property="desFlStag" column="DES_FL_STAG"/>
        <result property="desStorCap" column="DES_STOR_CAP"/>
        <result property="desFlFlow" column="DES_FL_FLOW"/>
        <result property="arArea" column="AR_AREA"/>
        <result property="fsdaPop" column="FSDA_POP"/>
        <result property="fsdaGdp" column="FSDA_GDP"/>
        <result property="note" column="NOTE"/>
        <result property="updDate" column="UPD_DATE"/>
    </resultMap>

    <sql id="selectAttFsdaBaseVo">
        select FSDA_CODE, COLL_DATE, FSDA_NAME, LOW_LEFT_LONG, LOW_LEFT_LAT, UP_RIGHT_LONG, UP_RIGHT_LAT,
               FSDA_LOC, FEDA_TYPE, BUILD_FL_DATE, FSDA_TOT_AERA, FSDA_DIKE_LEN, DES_FL_AREA,
               DES_FL_STAG, DES_STOR_CAP, DES_FL_FLOW, AR_AREA, FSDA_POP, FSDA_GDP, NOTE, UPD_DATE
        from ATT_FSDA_BASE
    </sql>

    <select id="selectAttFsdaBaseList" parameterType="AttFsdaBase" resultMap="AttFsdaBaseResult">
        <include refid="selectAttFsdaBaseVo"/>
        <where>
            <if test="fsdaName != null and fsdaName != ''">
                and FSDA_NAME like concat('%', #{fsdaName}, '%')
            </if>
            <if test="fedaType != null and fedaType != ''">
                and FEDA_TYPE = #{fedaType}
            </if>
        </where>
        order by FSDA_CODE
    </select>

    <select id="selectAttFsdaBaseById" parameterType="String" resultMap="AttFsdaBaseResult">
        <include refid="selectAttFsdaBaseVo"/>
        where FSDA_CODE = #{fsdaCode}
    </select>

    <delete id="deleteAttFsdaBaseById" parameterType="String">
        delete from ATT_FSDA_BASE where FSDA_CODE = #{fsdaCode}
    </delete>

    <delete id="deleteAttFsdaBaseByIds" parameterType="String">
        delete from ATT_FSDA_BASE where FSDA_CODE in
        <foreach item="fsdaCode" collection="array" open="(" separator="," close=")">
            #{fsdaCode}
        </foreach>
    </delete>

    <insert id="insertAttFsdaBase" parameterType="AttFsdaBase">
        insert into ATT_FSDA_BASE
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="fsdaCode != null">FSDA_CODE,</if>
            <if test="collDate != null">COLL_DATE,</if>
            <if test="fsdaName != null">FSDA_NAME,</if>
            <if test="lowLeftLong != null">LOW_LEFT_LONG,</if>
            <if test="lowLeftLat != null">LOW_LEFT_LAT,</if>
            <if test="upRightLong != null">UP_RIGHT_LONG,</if>
            <if test="upRightLat != null">UP_RIGHT_LAT,</if>
            <if test="fsdaLoc != null">FSDA_LOC,</if>
            <if test="fedaType != null">FEDA_TYPE,</if>
            <if test="buildFlDate != null">BUILD_FL_DATE,</if>
            <if test="fsdaTotAera != null">FSDA_TOT_AERA,</if>
            <if test="fsdaDikeLen != null">FSDA_DIKE_LEN,</if>
            <if test="desFlArea != null">DES_FL_AREA,</if>
            <if test="desFlStag != null">DES_FL_STAG,</if>
            <if test="desStorCap != null">DES_STOR_CAP,</if>
            <if test="desFlFlow != null">DES_FL_FLOW,</if>
            <if test="arArea != null">AR_AREA,</if>
            <if test="fsdaPop != null">FSDA_POP,</if>
            <if test="fsdaGdp != null">FSDA_GDP,</if>
            <if test="note != null">NOTE,</if>
            <if test="updDate != null">UPD_DATE,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="fsdaCode != null">#{fsdaCode},</if>
            <if test="collDate != null">#{collDate},</if>
            <if test="fsdaName != null">#{fsdaName},</if>
            <if test="lowLeftLong != null">#{lowLeftLong},</if>
            <if test="lowLeftLat != null">#{lowLeftLat},</if>
            <if test="upRightLong != null">#{upRightLong},</if>
            <if test="upRightLat != null">#{upRightLat},</if>
            <if test="fsdaLoc != null">#{fsdaLoc},</if>
            <if test="fedaType != null">#{fedaType},</if>
            <if test="buildFlDate != null">#{buildFlDate},</if>
            <if test="fsdaTotAera != null">#{fsdaTotAera},</if>
            <if test="fsdaDikeLen != null">#{fsdaDikeLen},</if>
            <if test="desFlArea != null">#{desFlArea},</if>
            <if test="desFlStag != null">#{desFlStag},</if>
            <if test="desStorCap != null">#{desStorCap},</if>
            <if test="desFlFlow != null">#{desFlFlow},</if>
            <if test="arArea != null">#{arArea},</if>
            <if test="fsdaPop != null">#{fsdaPop},</if>
            <if test="fsdaGdp != null">#{fsdaGdp},</if>
            <if test="note != null">#{note},</if>
            <if test="updDate != null">#{updDate},</if>
        </trim>
    </insert>

    <update id="updateAttFsdaBase" parameterType="AttFsdaBase">
        update ATT_FSDA_BASE
        <trim prefix="SET" suffixOverrides=",">
            <if test="collDate != null">COLL_DATE = #{collDate},</if>
            <if test="fsdaName != null">FSDA_NAME = #{fsdaName},</if>
            <if test="lowLeftLong != null">LOW_LEFT_LONG = #{lowLeftLong},</if>
            <if test="lowLeftLat != null">LOW_LEFT_LAT = #{lowLeftLat},</if>
            <if test="upRightLong != null">UP_RIGHT_LONG = #{upRightLong},</if>
            <if test="upRightLat != null">UP_RIGHT_LAT = #{upRightLat},</if>
            <if test="fsdaLoc != null">FSDA_LOC = #{fsdaLoc},</if>
            <if test="fedaType != null">FEDA_TYPE = #{fedaType},</if>
            <if test="buildFlDate != null">BUILD_FL_DATE = #{buildFlDate},</if>
            <if test="fsdaTotAera != null">FSDA_TOT_AERA = #{fsdaTotAera},</if>
            <if test="fsdaDikeLen != null">FSDA_DIKE_LEN = #{fsdaDikeLen},</if>
            <if test="desFlArea != null">DES_FL_AREA = #{desFlArea},</if>
            <if test="desFlStag != null">DES_FL_STAG = #{desFlStag},</if>
            <if test="desStorCap != null">DES_STOR_CAP = #{desStorCap},</if>
            <if test="desFlFlow != null">DES_FL_FLOW = #{desFlFlow},</if>
            <if test="arArea != null">AR_AREA = #{arArea},</if>
            <if test="fsdaPop != null">FSDA_POP = #{fsdaPop},</if>
            <if test="fsdaGdp != null">FSDA_GDP = #{fsdaGdp},</if>
            <if test="note != null">NOTE = #{note},</if>
            <if test="updDate != null">UPD_DATE = #{updDate},</if>
        </trim>
        where FSDA_CODE = #{fsdaCode}
    </update>

</mapper>
