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

    <resultMap type="AttDpdsBase" id="AttDpdsBaseResult">
        <result property="dpdsCode" column="DPDS_CODE"/>
        <result property="collDate" column="COLL_DATE"/>
        <result property="dpdsName" column="DPDS_NAME"/>
        <result property="dpdsLong" column="DPDS_LONG"/>
        <result property="dpdsLat" column="DPDS_LAT"/>
        <result property="dpdsLoc" column="DPDS_LOC"/>
        <result property="dangNum" column="DANG_NUM"/>
        <result property="dpdsNum" column="DPDS_NUM"/>
        <result property="dpdsLen" column="DPDS_LEN"/>
        <result property="note" column="NOTE"/>
        <result property="updDate" column="UPD_DATE"/>
    </resultMap>

    <sql id="selectAttDpdsBaseVo">
        select DPDS_CODE, COLL_DATE, DPDS_NAME, DPDS_LONG, DPDS_LAT, DPDS_LOC,
               DANG_NUM, DPDS_NUM, DPDS_LEN, NOTE, UPD_DATE
        from ATT_DPDS_BASE
    </sql>

    <select id="selectAttDpdsBaseList" parameterType="AttDpdsBase" resultMap="AttDpdsBaseResult">
        <include refid="selectAttDpdsBaseVo"/>
        <where>
            <if test="dpdsName != null and dpdsName != ''">
                and DPDS_NAME like concat('%', #{dpdsName}, '%')
            </if>
            <if test="dpdsNum != null and dpdsNum != ''">
                and DPDS_NUM = #{dpdsNum}
            </if>
        </where>
        order by DPDS_CODE
    </select>

    <select id="selectAttDpdsBaseById" parameterType="String" resultMap="AttDpdsBaseResult">
        <include refid="selectAttDpdsBaseVo"/>
        where DPDS_CODE = #{dpdsCode}
    </select>

    <delete id="deleteAttDpdsBaseById" parameterType="String">
        delete from ATT_DPDS_BASE where DPDS_CODE = #{dpdsCode}
    </delete>

    <delete id="deleteAttDpdsBaseByIds" parameterType="String">
        delete from ATT_DPDS_BASE where DPDS_CODE in
        <foreach item="dpdsCode" collection="array" open="(" separator="," close=")">
            #{dpdsCode}
        </foreach>
    </delete>

    <insert id="insertAttDpdsBase" parameterType="AttDpdsBase">
        insert into ATT_DPDS_BASE
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="dpdsCode != null">DPDS_CODE,</if>
            <if test="collDate != null">COLL_DATE,</if>
            <if test="dpdsName != null">DPDS_NAME,</if>
            <if test="dpdsLong != null">DPDS_LONG,</if>
            <if test="dpdsLat != null">DPDS_LAT,</if>
            <if test="dpdsLoc != null">DPDS_LOC,</if>
            <if test="dangNum != null">DANG_NUM,</if>
            <if test="dpdsNum != null">DPDS_NUM,</if>
            <if test="dpdsLen != null">DPDS_LEN,</if>
            <if test="note != null">NOTE,</if>
            <if test="updDate != null">UPD_DATE,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="dpdsCode != null">#{dpdsCode},</if>
            <if test="collDate != null">#{collDate},</if>
            <if test="dpdsName != null">#{dpdsName},</if>
            <if test="dpdsLong != null">#{dpdsLong},</if>
            <if test="dpdsLat != null">#{dpdsLat},</if>
            <if test="dpdsLoc != null">#{dpdsLoc},</if>
            <if test="dangNum != null">#{dangNum},</if>
            <if test="dpdsNum != null">#{dpdsNum},</if>
            <if test="dpdsLen != null">#{dpdsLen},</if>
            <if test="note != null">#{note},</if>
            <if test="updDate != null">#{updDate},</if>
        </trim>
    </insert>

    <update id="updateAttDpdsBase" parameterType="AttDpdsBase">
        update ATT_DPDS_BASE
        <trim prefix="SET" suffixOverrides=",">
            <if test="collDate != null">COLL_DATE = #{collDate},</if>
            <if test="dpdsName != null">DPDS_NAME = #{dpdsName},</if>
            <if test="dpdsLong != null">DPDS_LONG = #{dpdsLong},</if>
            <if test="dpdsLat != null">DPDS_LAT = #{dpdsLat},</if>
            <if test="dpdsLoc != null">DPDS_LOC = #{dpdsLoc},</if>
            <if test="dangNum != null">DANG_NUM = #{dangNum},</if>
            <if test="dpdsNum != null">DPDS_NUM = #{dpdsNum},</if>
            <if test="dpdsLen != null">DPDS_LEN = #{dpdsLen},</if>
            <if test="note != null">NOTE = #{note},</if>
            <if test="updDate != null">UPD_DATE = #{updDate},</if>
        </trim>
        where DPDS_CODE = #{dpdsCode}
    </update>

</mapper>
