<?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.sins.mapper.AttEngResMapper">
    <resultMap type="com.goldenwater.slaj.sins.domain.AttEngRes" id="AttEngResResult">
        <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="resCode" column="res_code"/>
        <result property="cenLong" column="cen_long"/>
        <result property="cenLat" column="cen_lat"/>
        <result property="resLoc" column="res_loc"/>
        <result property="rvGuid" column="rv_guid"/>
        <result property="adGuid" column="ad_guid"/>
        <result property="engGrad" column="eng_grad"/>
        <result property="engScal" column="eng_scal"/>
        <result property="damTypeMat" column="dam_type_mat"/>
        <result property="damTypeStr" column="dam_type_str"/>
        <result property="damSizeHig" column="dam_size_hig"/>
        <result property="damSizeLen" column="dam_size_len"/>
        <result property="damCreElv" column="dam_cre_elv"/>
        <result property="desFlStand" column="des_fl_stand"/>
        <result property="flLowLimLev" column="fl_low_lim_lev"/>
        <result property="flLowLimLevStart" column="fl_low_lim_lev_start"/>
        <result property="flLowLimLevEnd" column="fl_low_lim_lev_end"/>
        <result property="desFlStag" column="des_fl_stag"/>
        <result property="mainFlType" column="main_fl_type"/>
        <result property="deadLev" column="dead_lev"/>
        <result property="totCap" column="tot_cap"/>
        <result property="deadCap" column="dead_cap"/>
        <result property="flcoCap" column="flco_cap"/>
        <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="selectAttEngResVo">
        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, res_code, cen_long, cen_lat, res_loc, rv_guid, ad_guid, eng_grad, eng_scal, dam_type_mat, dam_type_str, dam_size_hig, dam_size_len, dam_cre_elv, des_fl_stand, fl_low_lim_lev, fl_low_lim_lev_start, fl_low_lim_lev_end, des_fl_stag, main_fl_type, dead_lev, tot_cap, dead_cap, flco_cap, note, coll_time, upd_time, rec_pers, eng_rein_force_guid from att_eng_res
    </sql>

    <select id="selectAttEngResByGuid" parameterType="String" resultMap="AttEngResResult">
        <include refid="selectAttEngResVo"/> where guid = #{guid}
    </select>

    <select id="selectAttEngResList" parameterType="com.goldenwater.slaj.sins.domain.AttEngRes" resultMap="AttEngResResult">
        <include refid="selectAttEngResVo"/>
        <where>
            <if test="engName != null and engName != ''">
                and eng_name like '%' || #{engName} || '%'
            </if>
            <if test="engGuid != null and engGuid != ''">
                and eng_guid = #{engGuid}
            </if>
            <if test="engGrad != null and engGrad != ''">
                and eng_grad = #{engGrad}
            </if>
            <if test="resCode != null and resCode != ''">
                and res_code = #{resCode}
            </if>
        </where>
    </select>

    <insert id="insertAttEngRes" parameterType="com.goldenwater.slaj.sins.domain.AttEngRes">
        insert into att_eng_res (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, res_code, cen_long, cen_lat, res_loc, rv_guid, ad_guid, eng_grad, eng_scal, dam_type_mat, dam_type_str, dam_size_hig, dam_size_len, dam_cre_elv, des_fl_stand, fl_low_lim_lev, fl_low_lim_lev_start, fl_low_lim_lev_end, des_fl_stag, main_fl_type, dead_lev, tot_cap, dead_cap, flco_cap, 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}, #{resCode}, #{cenLong}, #{cenLat}, #{resLoc}, #{rvGuid}, #{adGuid}, #{engGrad}, #{engScal}, #{damTypeMat}, #{damTypeStr}, #{damSizeHig}, #{damSizeLen}, #{damCreElv}, #{desFlStand}, #{flLowLimLev}, #{flLowLimLevStart}, #{flLowLimLevEnd}, #{desFlStag}, #{mainFlType}, #{deadLev}, #{totCap}, #{deadCap}, #{flcoCap}, #{note}, #{collTime}, #{updTime}, #{recPers}, #{engReinForceGuid})
    </insert>

    <update id="updateAttEngRes" parameterType="com.goldenwater.slaj.sins.domain.AttEngRes">
        update att_eng_res
        <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="resCode != null and resCode != ''">res_code = #{resCode},</if>
            <if test="cenLong != null and cenLong != ''">cen_long = #{cenLong},</if>
            <if test="cenLat != null and cenLat != ''">cen_lat = #{cenLat},</if>
            <if test="resLoc != null and resLoc != ''">res_loc = #{resLoc},</if>
            <if test="rvGuid != null and rvGuid != ''">rv_guid = #{rvGuid},</if>
            <if test="adGuid != null and adGuid != ''">ad_guid = #{adGuid},</if>
            <if test="engGrad != null and engGrad != ''">eng_grad = #{engGrad},</if>
            <if test="engScal != null and engScal != ''">eng_scal = #{engScal},</if>
            <if test="damTypeMat != null and damTypeMat != ''">dam_type_mat = #{damTypeMat},</if>
            <if test="damTypeStr != null and damTypeStr != ''">dam_type_str = #{damTypeStr},</if>
            <if test="damSizeHig != null and damSizeHig != ''">dam_size_hig = #{damSizeHig},</if>
            <if test="damSizeLen != null and damSizeLen != ''">dam_size_len = #{damSizeLen},</if>
            <if test="damCreElv != null and damCreElv != ''">dam_cre_elv = #{damCreElv},</if>
            <if test="desFlStand != null and desFlStand != ''">des_fl_stand = #{desFlStand},</if>
            <if test="flLowLimLev != null and flLowLimLev != ''">fl_low_lim_lev = #{flLowLimLev},</if>
            <if test="flLowLimLevStart != null and flLowLimLevStart != ''">fl_low_lim_lev_start = #{flLowLimLevStart},</if>
            <if test="flLowLimLevEnd != null and flLowLimLevEnd != ''">fl_low_lim_lev_end = #{flLowLimLevEnd},</if>
            <if test="desFlStag != null and desFlStag != ''">des_fl_stag = #{desFlStag},</if>
            <if test="mainFlType != null and mainFlType != ''">main_fl_type = #{mainFlType},</if>
            <if test="deadLev != null and deadLev != ''">dead_lev = #{deadLev},</if>
            <if test="totCap != null and totCap != ''">tot_cap = #{totCap},</if>
            <if test="deadCap != null and deadCap != ''">dead_cap = #{deadCap},</if>
            <if test="flcoCap != null and flcoCap != ''">flco_cap = #{flcoCap},</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="deleteAttEngResByGuid" parameterType="String">
        delete from att_eng_res where guid = #{guid}
    </delete>

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