<?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.AttEngIrrMapper">
    <resultMap type="com.goldenwater.slaj.eng.domain.AttEngIrr" id="AttEngIrrResult">
        <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="irrCode" column="irr_code"/>
        <result property="cenLong" column="cen_long"/>
        <result property="cenLat" column="cen_lat"/>
        <result property="irrLoc" column="irr_loc"/>
        <result property="adGuid" column="ad_guid"/>
        <result property="rvGuid" column="rv_guid"/>
        <result property="engScal" column="eng_scal"/>
        <result property="totIrrArea" column="tot_irr_area"/>
        <result property="effIrrArea" column="eff_irr_area"/>
        <result property="desIrrArea" column="des_irr_area"/>
        <result property="chanHignLeve" column="chan_hign_leve"/>
        <result property="chanNum" column="chan_num"/>
        <result property="chanLenTot" column="chan_len_tot"/>
        <result property="chanDesFlow" column="chan_des_flow"/>
        <result property="chsyGateNum" column="chsy_gate_num"/>
        <result property="chsyAquNum" column="chsy_aqu_num"/>
        <result property="chsyDropNum" column="chsy_drop_num"/>
        <result property="chsyInvSiphNum" column="chsy_inv_siph_num"/>
        <result property="chsyTunNum" column="chsy_tun_num"/>
        <result property="chsyCulNum" column="chsy_cul_num"/>
        <result property="chsyFarmBriNum" column="chsy_farm_bri_num"/>
        <result property="chsyMeaNum" column="chsy_mea_num"/>
        <result property="chsyDitPustStNum" column="chsy_dit_pust_st_num"/>
        <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="selectAttEngIrrVo">
        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, irr_code, cen_long, cen_lat, irr_loc, ad_guid, rv_guid, eng_scal, tot_irr_area, eff_irr_area, des_irr_area, chan_hign_leve, chan_num, chan_len_tot, chan_des_flow, chsy_gate_num, chsy_aqu_num, chsy_drop_num, chsy_inv_siph_num, chsy_tun_num, chsy_cul_num, chsy_farm_bri_num, chsy_mea_num, chsy_dit_pust_st_num, note, coll_time, upd_time, rec_pers, eng_rein_force_guid from att_eng_irr
    </sql>

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

    <select id="selectList" parameterType="com.goldenwater.slaj.eng.domain.AttEngIrr" resultMap="AttEngIrrResult">
        <include refid="selectAttEngIrrVo"/>
        <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.AttEngIrr">
        insert into att_eng_irr (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, irr_code, cen_long, cen_lat, irr_loc, ad_guid, rv_guid, eng_scal, tot_irr_area, eff_irr_area, des_irr_area, chan_hign_leve, chan_num, chan_len_tot, chan_des_flow, chsy_gate_num, chsy_aqu_num, chsy_drop_num, chsy_inv_siph_num, chsy_tun_num, chsy_cul_num, chsy_farm_bri_num, chsy_mea_num, chsy_dit_pust_st_num, 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}, #{irrCode}, #{cenLong}, #{cenLat}, #{irrLoc}, #{adGuid}, #{rvGuid}, #{engScal}, #{totIrrArea}, #{effIrrArea}, #{desIrrArea}, #{chanHignLeve}, #{chanNum}, #{chanLenTot}, #{chanDesFlow}, #{chsyGateNum}, #{chsyAquNum}, #{chsyDropNum}, #{chsyInvSiphNum}, #{chsyTunNum}, #{chsyCulNum}, #{chsyFarmBriNum}, #{chsyMeaNum}, #{chsyDitPustStNum}, #{note}, #{collTime}, #{updTime}, #{recPers}, #{engReinForceGuid})
    </insert>

    <update id="update" parameterType="com.goldenwater.slaj.eng.domain.AttEngIrr">
        update att_eng_irr
        <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="irrCode != null and irrCode != ''">irr_code = #{irrCode},</if>
            <if test="cenLong != null and cenLong != ''">cen_long = #{cenLong},</if>
            <if test="cenLat != null and cenLat != ''">cen_lat = #{cenLat},</if>
            <if test="irrLoc != null and irrLoc != ''">irr_loc = #{irrLoc},</if>
            <if test="adGuid != null and adGuid != ''">ad_guid = #{adGuid},</if>
            <if test="rvGuid != null and rvGuid != ''">rv_guid = #{rvGuid},</if>
            <if test="engScal != null and engScal != ''">eng_scal = #{engScal},</if>
            <if test="totIrrArea != null and totIrrArea != ''">tot_irr_area = #{totIrrArea},</if>
            <if test="effIrrArea != null and effIrrArea != ''">eff_irr_area = #{effIrrArea},</if>
            <if test="desIrrArea != null and desIrrArea != ''">des_irr_area = #{desIrrArea},</if>
            <if test="chanHignLeve != null and chanHignLeve != ''">chan_hign_leve = #{chanHignLeve},</if>
            <if test="chanNum != null and chanNum != ''">chan_num = #{chanNum},</if>
            <if test="chanLenTot != null and chanLenTot != ''">chan_len_tot = #{chanLenTot},</if>
            <if test="chanDesFlow != null and chanDesFlow != ''">chan_des_flow = #{chanDesFlow},</if>
            <if test="chsyGateNum != null and chsyGateNum != ''">chsy_gate_num = #{chsyGateNum},</if>
            <if test="chsyAquNum != null and chsyAquNum != ''">chsy_aqu_num = #{chsyAquNum},</if>
            <if test="chsyDropNum != null and chsyDropNum != ''">chsy_drop_num = #{chsyDropNum},</if>
            <if test="chsyInvSiphNum != null and chsyInvSiphNum != ''">chsy_inv_siph_num = #{chsyInvSiphNum},</if>
            <if test="chsyTunNum != null and chsyTunNum != ''">chsy_tun_num = #{chsyTunNum},</if>
            <if test="chsyCulNum != null and chsyCulNum != ''">chsy_cul_num = #{chsyCulNum},</if>
            <if test="chsyFarmBriNum != null and chsyFarmBriNum != ''">chsy_farm_bri_num = #{chsyFarmBriNum},</if>
            <if test="chsyMeaNum != null and chsyMeaNum != ''">chsy_mea_num = #{chsyMeaNum},</if>
            <if test="chsyDitPustStNum != null and chsyDitPustStNum != ''">chsy_dit_pust_st_num = #{chsyDitPustStNum},</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_irr where guid = #{guid}
    </delete>

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