<?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.slaj.eng.mapper.AttEngWadiMapper">
    <resultMap type="com.goldenwater.slaj.eng.domain.AttEngWadi" id="AttEngWadiResult">
        <result property="guid" column="guid"/>
        <result property="pGuid" column="p_guid"/>
        <result property="engName" column="eng_name"/>
        <result property="engGuid" column="eng_guid"/>
        <result property="impoGrad" column="impo_grad"/>
        <result property="apprBudg" column="appr_budg"/>
        <result property="startDate" column="start_date"/>
        <result property="compDate" column="comp_date"/>
        <result property="engStat" column="eng_stat"/>
        <result property="orgGuid" column="org_guid"/>
        <result property="oflpCode" column="oflp_code"/>
        <result property="ifReinForce" column="if_rein_force"/>
        <result property="projGuid" column="proj_guid"/>
        <result property="stat" column="stat"/>
        <result property="wadiCode" column="wadi_code"/>
        <result property="startLong" column="start_long"/>
        <result property="startLat" column="start_lat"/>
        <result property="endLong" column="end_long"/>
        <result property="endLat" column="end_lat"/>
        <result property="startLoc" column="start_loc"/>
        <result property="endLoc" column="end_loc"/>
        <result property="firsPoinAdGuid" column="firs_poin_ad_guid"/>
        <result property="endAdGuid" column="end_ad_guid"/>
        <result property="rvGuid" column="rv_guid"/>
        <result property="engGrad" column="eng_grad"/>
        <result property="engScal" column="eng_scal"/>
        <result property="lineTotLen" column="line_tot_len"/>
        <result property="desPumpDis" column="des_pump_dis"/>
        <result property="desPumpVol" column="des_pump_vol"/>
        <result property="note" column="note"/>
        <result property="collTime" column="coll_time"/>
        <result property="updTime" column="upd_time"/>
        <result property="recPers" column="rec_pers"/>
        <result property="engReinForceGuid" column="eng_rein_force_guid"/>
    </resultMap>

    <sql id="selectAttEngWadiVo">
        select guid, p_guid, eng_name, eng_guid, impo_grad, appr_budg, start_date, comp_date, eng_stat, org_guid, oflp_code, if_rein_force, proj_guid, stat, wadi_code, start_long, start_lat, end_long, end_lat, start_loc, end_loc, firs_poin_ad_guid, end_ad_guid, rv_guid, eng_grad, eng_scal, line_tot_len, des_pump_dis, des_pump_vol, note, coll_time, upd_time, rec_pers, eng_rein_force_guid from att_eng_wadi
    </sql>

    <select id="selectByGuid" parameterType="String" resultMap="AttEngWadiResult">
        <include refid="selectAttEngWadiVo"/> where guid = #{guid}
    </select>

    <select id="selectList" parameterType="com.goldenwater.slaj.eng.domain.AttEngWadi" resultMap="AttEngWadiResult">
        <include refid="selectAttEngWadiVo"/>
        <where>
            <if test="engName != null and engName != ''">and eng_name like '%' || #{engName} || '%'</if>
            <if test="engGuid != null and engGuid != ''">and eng_guid = #{engGuid}</if>
        </where>
    </select>

    <insert id="insert" parameterType="com.goldenwater.slaj.eng.domain.AttEngWadi">
        insert into att_eng_wadi (guid, p_guid, eng_name, eng_guid, impo_grad, appr_budg, start_date, comp_date, eng_stat, org_guid, oflp_code, if_rein_force, proj_guid, stat, wadi_code, start_long, start_lat, end_long, end_lat, start_loc, end_loc, firs_poin_ad_guid, end_ad_guid, rv_guid, eng_grad, eng_scal, line_tot_len, des_pump_dis, des_pump_vol, note, coll_time, upd_time, rec_pers, eng_rein_force_guid)
        values (#{guid}, #{pGuid}, #{engName}, #{engGuid}, #{impoGrad}, #{apprBudg}, #{startDate}, #{compDate}, #{engStat}, #{orgGuid}, #{oflpCode}, #{ifReinForce}, #{projGuid}, #{stat}, #{wadiCode}, #{startLong}, #{startLat}, #{endLong}, #{endLat}, #{startLoc}, #{endLoc}, #{firsPoinAdGuid}, #{endAdGuid}, #{rvGuid}, #{engGrad}, #{engScal}, #{lineTotLen}, #{desPumpDis}, #{desPumpVol}, #{note}, #{collTime}, #{updTime}, #{recPers}, #{engReinForceGuid})
    </insert>

    <update id="update" parameterType="com.goldenwater.slaj.eng.domain.AttEngWadi">
        update att_eng_wadi
        <set>
            <if test="pGuid != null and pGuid != ''">p_guid = #{pGuid},</if>
            <if test="engName != null and engName != ''">eng_name = #{engName},</if>
            <if test="engGuid != null and engGuid != ''">eng_guid = #{engGuid},</if>
            <if test="impoGrad != null and impoGrad != ''">impo_grad = #{impoGrad},</if>
            <if test="apprBudg != null and apprBudg != ''">appr_budg = #{apprBudg},</if>
            <if test="startDate != null">start_date = #{startDate},</if>
            <if test="compDate != null">comp_date = #{compDate},</if>
            <if test="engStat != null and engStat != ''">eng_stat = #{engStat},</if>
            <if test="orgGuid != null and orgGuid != ''">org_guid = #{orgGuid},</if>
            <if test="oflpCode != null and oflpCode != ''">oflp_code = #{oflpCode},</if>
            <if test="ifReinForce != null and ifReinForce != ''">if_rein_force = #{ifReinForce},</if>
            <if test="projGuid != null and projGuid != ''">proj_guid = #{projGuid},</if>
            <if test="stat != null and stat != ''">stat = #{stat},</if>
            <if test="wadiCode != null and wadiCode != ''">wadi_code = #{wadiCode},</if>
            <if test="startLong != null and startLong != ''">start_long = #{startLong},</if>
            <if test="startLat != null and startLat != ''">start_lat = #{startLat},</if>
            <if test="endLong != null and endLong != ''">end_long = #{endLong},</if>
            <if test="endLat != null and endLat != ''">end_lat = #{endLat},</if>
            <if test="startLoc != null and startLoc != ''">start_loc = #{startLoc},</if>
            <if test="endLoc != null and endLoc != ''">end_loc = #{endLoc},</if>
            <if test="firsPoinAdGuid != null and firsPoinAdGuid != ''">firs_poin_ad_guid = #{firsPoinAdGuid},</if>
            <if test="endAdGuid != null and endAdGuid != ''">end_ad_guid = #{endAdGuid},</if>
            <if test="rvGuid != null and rvGuid != ''">rv_guid = #{rvGuid},</if>
            <if test="engGrad != null and engGrad != ''">eng_grad = #{engGrad},</if>
            <if test="engScal != null and engScal != ''">eng_scal = #{engScal},</if>
            <if test="lineTotLen != null and lineTotLen != ''">line_tot_len = #{lineTotLen},</if>
            <if test="desPumpDis != null and desPumpDis != ''">des_pump_dis = #{desPumpDis},</if>
            <if test="desPumpVol != null and desPumpVol != ''">des_pump_vol = #{desPumpVol},</if>
            <if test="note != null and note != ''">note = #{note},</if>
            <if test="collTime != null">coll_time = #{collTime},</if>
            <if test="updTime != null">upd_time = #{updTime},</if>
            <if test="recPers != null and recPers != ''">rec_pers = #{recPers},</if>
            <if test="engReinForceGuid != null and engReinForceGuid != ''">eng_rein_force_guid = #{engReinForceGuid},</if>
        </set>
        where guid = #{guid}
    </update>

    <delete id="deleteByGuid" parameterType="String">
        delete from att_eng_wadi where guid = #{guid}
    </delete>

    <delete id="deleteByGuids" parameterType="String">
        delete from att_eng_wadi where guid in
        <foreach item="guid" collection="array" open="(" separator="," close=")">#{guid}</foreach>
    </delete>
</mapper>
