<?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.AttEngHystMapper">
    <resultMap type="com.goldenwater.slaj.eng.domain.AttEngHyst" id="AttEngHystResult">
        <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="hystCode" column="hyst_code"/>
        <result property="ifRsPow" column="if_rs_pow"/>
        <result property="resCode" column="res_code"/>
        <result property="resName" column="res_name"/>
        <result property="cenLong" column="cen_long"/>
        <result property="cenLat" column="cen_lat"/>
        <result property="hystSite" column="hyst_site"/>
        <result property="adGuid" column="ad_guid"/>
        <result property="rvGuid" column="rv_guid"/>
        <result property="hystType" column="hyst_type"/>
        <result property="ifRhyst" column="if_rhyst"/>
        <result property="insCap" column="ins_cap"/>
        <result property="damRegCode" column="dam_reg_code"/>
        <result property="damIdenCate" column="dam_iden_cate"/>
        <result property="damIdenOrg" column="dam_iden_org"/>
        <result property="damIdenDate" column="dam_iden_date"/>
        <result property="engGrad" column="eng_grad"/>
        <result property="engScal" column="eng_scal"/>
        <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="totCap" column="tot_cap"/>
        <result property="damHig" column="dam_hig"/>
        <result property="engReinForceGuid" column="eng_rein_force_guid"/>
    </resultMap>

    <sql id="selectAttEngHystVo">
        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, hyst_code, if_rs_pow, res_code, res_name, cen_long, cen_lat, hyst_site, ad_guid, rv_guid, hyst_type, if_rhyst, ins_cap, dam_reg_code, dam_iden_cate, dam_iden_org, dam_iden_date, eng_grad, eng_scal, note, coll_time, upd_time, rec_pers, tot_cap, dam_hig, eng_rein_force_guid from att_eng_hyst
    </sql>

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

    <select id="selectList" parameterType="com.goldenwater.slaj.eng.domain.AttEngHyst" resultMap="AttEngHystResult">
        <include refid="selectAttEngHystVo"/>
        <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.AttEngHyst">
        insert into att_eng_hyst (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, hyst_code, if_rs_pow, res_code, res_name, cen_long, cen_lat, hyst_site, ad_guid, rv_guid, hyst_type, if_rhyst, ins_cap, dam_reg_code, dam_iden_cate, dam_iden_org, dam_iden_date, eng_grad, eng_scal, note, coll_time, upd_time, rec_pers, tot_cap, dam_hig, eng_rein_force_guid)
        values (#{guid}, #{pGuid}, #{engName}, #{engGuid}, #{impoGrad}, #{apprBudg}, #{startDate}, #{compDate}, #{engStat}, #{orgGuid}, #{oflpCode}, #{ifReinForce}, #{projGuid}, #{stat}, #{hystCode}, #{ifRsPow}, #{resCode}, #{resName}, #{cenLong}, #{cenLat}, #{hystSite}, #{adGuid}, #{rvGuid}, #{hystType}, #{ifRhyst}, #{insCap}, #{damRegCode}, #{damIdenCate}, #{damIdenOrg}, #{damIdenDate}, #{engGrad}, #{engScal}, #{note}, #{collTime}, #{updTime}, #{recPers}, #{totCap}, #{damHig}, #{engReinForceGuid})
    </insert>

    <update id="update" parameterType="com.goldenwater.slaj.eng.domain.AttEngHyst">
        update att_eng_hyst
        <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="hystCode != null and hystCode != ''">hyst_code = #{hystCode},</if>
            <if test="ifRsPow != null and ifRsPow != ''">if_rs_pow = #{ifRsPow},</if>
            <if test="resCode != null and resCode != ''">res_code = #{resCode},</if>
            <if test="resName != null and resName != ''">res_name = #{resName},</if>
            <if test="cenLong != null and cenLong != ''">cen_long = #{cenLong},</if>
            <if test="cenLat != null and cenLat != ''">cen_lat = #{cenLat},</if>
            <if test="hystSite != null and hystSite != ''">hyst_site = #{hystSite},</if>
            <if test="adGuid != null and adGuid != ''">ad_guid = #{adGuid},</if>
            <if test="rvGuid != null and rvGuid != ''">rv_guid = #{rvGuid},</if>
            <if test="hystType != null and hystType != ''">hyst_type = #{hystType},</if>
            <if test="ifRhyst != null and ifRhyst != ''">if_rhyst = #{ifRhyst},</if>
            <if test="insCap != null and insCap != ''">ins_cap = #{insCap},</if>
            <if test="damRegCode != null and damRegCode != ''">dam_reg_code = #{damRegCode},</if>
            <if test="damIdenCate != null and damIdenCate != ''">dam_iden_cate = #{damIdenCate},</if>
            <if test="damIdenOrg != null and damIdenOrg != ''">dam_iden_org = #{damIdenOrg},</if>
            <if test="damIdenDate != null">dam_iden_date = #{damIdenDate},</if>
            <if test="engGrad != null and engGrad != ''">eng_grad = #{engGrad},</if>
            <if test="engScal != null and engScal != ''">eng_scal = #{engScal},</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="totCap != null and totCap != ''">tot_cap = #{totCap},</if>
            <if test="damHig != null and damHig != ''">dam_hig = #{damHig},</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_hyst where guid = #{guid}
    </delete>

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