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

    <resultMap type="AttGrpjBase" id="AttGrpjBaseResult">
        <result property="grpjCode" column="GRPJ_CODE"/>
        <result property="collDate" column="COLL_DATE"/>
        <result property="grpjName" column="GRPJ_NAME"/>
        <result property="grpjLong" column="GRPJ_LONG"/>
        <result property="grpjLat" column="GRPJ_LAT"/>
        <result property="grpjLoc" column="GRPJ_LOC"/>
        <result property="engNum" column="ENG_NUM"/>
        <result property="engLen" column="ENG_LEN"/>
        <result property="mangReaLen" column="MANG_REA_LEN"/>
        <result property="bank" column="BANK"/>
        <result property="grpjBrin" column="GRPJ_BRIN"/>
        <result property="note" column="NOTE"/>
        <result property="updDate" column="UPD_DATE"/>
    </resultMap>

    <sql id="selectAttGrpjBaseVo">
        select GRPJ_CODE, COLL_DATE, GRPJ_NAME, GRPJ_LONG, GRPJ_LAT, GRPJ_LOC,
               ENG_NUM, ENG_LEN, MANG_REA_LEN, BANK, GRPJ_BRIN, NOTE, UPD_DATE
        from ATT_GRPJ_BASE
    </sql>

    <select id="selectAttGrpjBaseList" parameterType="AttGrpjBase" resultMap="AttGrpjBaseResult">
        <include refid="selectAttGrpjBaseVo"/>
        <where>
            <if test="grpjName != null and grpjName != ''">
                and GRPJ_NAME like concat('%', #{grpjName}, '%')
            </if>
            <if test="bank != null and bank != ''">
                and BANK = #{bank}
            </if>
            <if test="grpjBrin != null and grpjBrin != ''">
                and GRPJ_BRIN = #{grpjBrin}
            </if>
        </where>
        order by GRPJ_CODE
    </select>

    <select id="selectAttGrpjBaseById" parameterType="String" resultMap="AttGrpjBaseResult">
        <include refid="selectAttGrpjBaseVo"/>
        where GRPJ_CODE = #{grpjCode}
    </select>

    <delete id="deleteAttGrpjBaseById" parameterType="String">
        delete from ATT_GRPJ_BASE where GRPJ_CODE = #{grpjCode}
    </delete>

    <delete id="deleteAttGrpjBaseByIds" parameterType="String">
        delete from ATT_GRPJ_BASE where GRPJ_CODE in
        <foreach item="grpjCode" collection="array" open="(" separator="," close=")">
            #{grpjCode}
        </foreach>
    </delete>

    <insert id="insertAttGrpjBase" parameterType="AttGrpjBase">
        insert into ATT_GRPJ_BASE
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="grpjCode != null">GRPJ_CODE,</if>
            <if test="collDate != null">COLL_DATE,</if>
            <if test="grpjName != null">GRPJ_NAME,</if>
            <if test="grpjLong != null">GRPJ_LONG,</if>
            <if test="grpjLat != null">GRPJ_LAT,</if>
            <if test="grpjLoc != null">GRPJ_LOC,</if>
            <if test="engNum != null">ENG_NUM,</if>
            <if test="engLen != null">ENG_LEN,</if>
            <if test="mangReaLen != null">MANG_REA_LEN,</if>
            <if test="bank != null">BANK,</if>
            <if test="grpjBrin != null">GRPJ_BRIN,</if>
            <if test="note != null">NOTE,</if>
            <if test="updDate != null">UPD_DATE,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="grpjCode != null">#{grpjCode},</if>
            <if test="collDate != null">#{collDate},</if>
            <if test="grpjName != null">#{grpjName},</if>
            <if test="grpjLong != null">#{grpjLong},</if>
            <if test="grpjLat != null">#{grpjLat},</if>
            <if test="grpjLoc != null">#{grpjLoc},</if>
            <if test="engNum != null">#{engNum},</if>
            <if test="engLen != null">#{engLen},</if>
            <if test="mangReaLen != null">#{mangReaLen},</if>
            <if test="bank != null">#{bank},</if>
            <if test="grpjBrin != null">#{grpjBrin},</if>
            <if test="note != null">#{note},</if>
            <if test="updDate != null">#{updDate},</if>
        </trim>
    </insert>

    <update id="updateAttGrpjBase" parameterType="AttGrpjBase">
        update ATT_GRPJ_BASE
        <trim prefix="SET" suffixOverrides=",">
            <if test="collDate != null">COLL_DATE = #{collDate},</if>
            <if test="grpjName != null">GRPJ_NAME = #{grpjName},</if>
            <if test="grpjLong != null">GRPJ_LONG = #{grpjLong},</if>
            <if test="grpjLat != null">GRPJ_LAT = #{grpjLat},</if>
            <if test="grpjLoc != null">GRPJ_LOC = #{grpjLoc},</if>
            <if test="engNum != null">ENG_NUM = #{engNum},</if>
            <if test="engLen != null">ENG_LEN = #{engLen},</if>
            <if test="mangReaLen != null">MANG_REA_LEN = #{mangReaLen},</if>
            <if test="bank != null">BANK = #{bank},</if>
            <if test="grpjBrin != null">GRPJ_BRIN = #{grpjBrin},</if>
            <if test="note != null">NOTE = #{note},</if>
            <if test="updDate != null">UPD_DATE = #{updDate},</if>
        </trim>
        where GRPJ_CODE = #{grpjCode}
    </update>

</mapper>
