<?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.hidd.mapper.AttEngBaseMapper">
    <resultMap type="com.goldenwater.slaj.hidd.domain.AttEngBase" id="AttEngBaseResult">
        <result property="guid" column="guid"/>
        <result property="pguid" column="pguid"/>
        <result property="adGuid" column="ad_guid"/>
        <result property="adCode" column="ad_code"/>
        <result property="lkGuid" column="lk_guid"/>
        <result property="engName" column="eng_name"/>
        <result property="engGuid" column="eng_guid"/>
        <result property="orgRest" column="org_rest"/>
        <result property="orgJurd" column="org_jurd"/>
        <result property="oldCode" column="old_code"/>
        <result property="impoGrad" column="impo_grad"/>
        <result property="engScal" column="eng_scal"/>
        <result property="apprBudg" column="appr_budg"/>
        <result property="ifReinForce" column="if_rein_force"/>
        <result property="engGrad" column="eng_grad"/>
        <result property="totCap" column="tot_cap"/>
        <result property="resCode" column="res_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="desFlStand" column="des_fl_stand"/>
        <result property="oflpCode" column="oflp_code"/>
        <result property="projGuid" column="proj_guid"/>
        <result property="cenLong" column="cen_long"/>
        <result property="cenLat" column="cen_lat"/>
        <result property="stat" column="stat"/>
        <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="engReinForceGuid" column="eng_rein_force_guid"/>
        <result property="note" column="note"/>
        <result property="collTime" column="coll_time"/>
        <result property="updTime" column="upd_time"/>
        <result property="fromDate" column="from_date"/>
        <result property="toDate" column="to_date"/>
        <result property="recPers" column="rec_pers"/>
        <result property="engCode" column="eng_code"/>
        <result property="engType" column="eng_type"/>
    </resultMap>
    <sql id="selectAttEngBaseVo">
        select guid, pguid, ad_guid, ad_code, lk_guid, eng_name, eng_guid, org_rest, org_jurd,
               old_code, impo_grad, eng_scal, appr_budg, if_rein_force, eng_grad, tot_cap, res_code,
               start_long, start_lat, end_long, end_lat, start_loc, end_loc, firs_poin_ad_guid,
               end_ad_guid, rv_guid, des_fl_stand, oflp_code, proj_guid, cen_long, cen_lat, stat,
               start_date, comp_date, eng_stat, org_guid, eng_rein_force_guid, note, coll_time,
               upd_time, from_date, to_date, rec_pers, eng_code, eng_type
        from att_eng_base
    </sql>
    <select id="selectAttEngBaseByGuid" parameterType="String" resultMap="AttEngBaseResult">
        <include refid="selectAttEngBaseVo"/>
        where guid = #{guid}
    </select>
    <select id="selectAttEngBaseList" parameterType="com.goldenwater.slaj.hidd.domain.AttEngBase" resultMap="AttEngBaseResult">
        <include refid="selectAttEngBaseVo"/>
        <where>
            <if test="engName != null and engName != ''">AND eng_name like '%' || #{engName} || '%'</if>
            <if test="engCode != null and engCode != ''">AND eng_code = #{engCode}</if>
            <if test="engGuid != null and engGuid != ''">AND eng_guid = #{engGuid}</if>
            <if test="orgGuid != null and orgGuid != ''">AND org_guid = #{orgGuid}</if>
        </where>
    </select>
    <insert id="insertAttEngBase" parameterType="com.goldenwater.slaj.hidd.domain.AttEngBase">
        insert into att_eng_base (guid, pguid, ad_guid, ad_code, lk_guid, eng_name, eng_guid, org_rest, org_jurd,
                                  old_code, impo_grad, eng_scal, appr_budg, if_rein_force, eng_grad, tot_cap, res_code,
                                  start_long, start_lat, end_long, end_lat, start_loc, end_loc, firs_poin_ad_guid,
                                  end_ad_guid, rv_guid, des_fl_stand, oflp_code, proj_guid, cen_long, cen_lat, stat,
                                  start_date, comp_date, eng_stat, org_guid, eng_rein_force_guid, note, coll_time,
                                  upd_time, from_date, to_date, rec_pers, eng_code, eng_type)
        values (#{guid}, #{pguid}, #{adGuid}, #{adCode}, #{lkGuid}, #{engName}, #{engGuid}, #{orgRest}, #{orgJurd},
                #{oldCode}, #{impoGrad}, #{engScal}, #{apprBudg}, #{ifReinForce}, #{engGrad}, #{totCap}, #{resCode},
                #{startLong}, #{startLat}, #{endLong}, #{endLat}, #{startLoc}, #{endLoc}, #{firsPoinAdGuid},
                #{endAdGuid}, #{rvGuid}, #{desFlStand}, #{oflpCode}, #{projGuid}, #{cenLong}, #{cenLat}, #{stat},
                #{startDate}, #{compDate}, #{engStat}, #{orgGuid}, #{engReinForceGuid}, #{note}, #{collTime},
                #{updTime}, #{fromDate}, #{toDate}, #{recPers}, #{engCode}, #{engType})
    </insert>
    <update id="updateAttEngBase" parameterType="com.goldenwater.slaj.hidd.domain.AttEngBase">
        update att_eng_base
        <set>
            <if test="pguid != null">pguid = #{pguid},</if>
            <if test="adGuid != null">ad_guid = #{adGuid},</if>
            <if test="adCode != null">ad_code = #{adCode},</if>
            <if test="lkGuid != null">lk_guid = #{lkGuid},</if>
            <if test="engName != null">eng_name = #{engName},</if>
            <if test="engGuid != null">eng_guid = #{engGuid},</if>
            <if test="orgRest != null">org_rest = #{orgRest},</if>
            <if test="orgJurd != null">org_jurd = #{orgJurd},</if>
            <if test="oldCode != null">old_code = #{oldCode},</if>
            <if test="impoGrad != null">impo_grad = #{impoGrad},</if>
            <if test="engScal != null">eng_scal = #{engScal},</if>
            <if test="apprBudg != null">appr_budg = #{apprBudg},</if>
            <if test="ifReinForce != null">if_rein_force = #{ifReinForce},</if>
            <if test="engGrad != null">eng_grad = #{engGrad},</if>
            <if test="totCap != null">tot_cap = #{totCap},</if>
            <if test="resCode != null">res_code = #{resCode},</if>
            <if test="startLong != null">start_long = #{startLong},</if>
            <if test="startLat != null">start_lat = #{startLat},</if>
            <if test="endLong != null">end_long = #{endLong},</if>
            <if test="endLat != null">end_lat = #{endLat},</if>
            <if test="startLoc != null">start_loc = #{startLoc},</if>
            <if test="endLoc != null">end_loc = #{endLoc},</if>
            <if test="firsPoinAdGuid != null">firs_poin_ad_guid = #{firsPoinAdGuid},</if>
            <if test="endAdGuid != null">end_ad_guid = #{endAdGuid},</if>
            <if test="rvGuid != null">rv_guid = #{rvGuid},</if>
            <if test="desFlStand != null">des_fl_stand = #{desFlStand},</if>
            <if test="oflpCode != null">oflp_code = #{oflpCode},</if>
            <if test="projGuid != null">proj_guid = #{projGuid},</if>
            <if test="cenLong != null">cen_long = #{cenLong},</if>
            <if test="cenLat != null">cen_lat = #{cenLat},</if>
            <if test="stat != null">stat = #{stat},</if>
            <if test="startDate != null">start_date = #{startDate},</if>
            <if test="compDate != null">comp_date = #{compDate},</if>
            <if test="engStat != null">eng_stat = #{engStat},</if>
            <if test="orgGuid != null">org_guid = #{orgGuid},</if>
            <if test="engReinForceGuid != null">eng_rein_force_guid = #{engReinForceGuid},</if>
            <if test="note != null">note = #{note},</if>
            <if test="collTime != null">coll_time = #{collTime},</if>
            <if test="updTime != null">upd_time = #{updTime},</if>
            <if test="fromDate != null">from_date = #{fromDate},</if>
            <if test="toDate != null">to_date = #{toDate},</if>
            <if test="recPers != null">rec_pers = #{recPers},</if>
            <if test="engCode != null">eng_code = #{engCode},</if>
            <if test="engType != null">eng_type = #{engType},</if>
        </set>
        where guid = #{guid}
    </update>
    <delete id="deleteAttEngBaseByGuid" parameterType="String">
        delete from att_eng_base where guid = #{guid}
    </delete>
    <delete id="deleteAttEngBaseByGuids" parameterType="String">
        delete from att_eng_base where guid in
        <foreach item="guid" collection="array" open="(" separator="," close=")">
            #{guid}
        </foreach>
    </delete>
</mapper>
