<?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.hazard.mapper.ObjEngHazaMapper">
    <resultMap type="com.goldenwater.slaj.hazard.domain.ObjEngHaza" id="ObjEngHazaResult">
        <result property="guid" column="guid"/>
        <result property="hazaEngName" column="haza_eng_name"/>
        <result property="engGuid" column="eng_guid"/>
        <result property="tendGuid" column="tend_guid"/>
        <result property="wiunWsubGuid" column="wiun_wsub_guid"/>
        <result property="hazaEngType" column="haza_eng_type"/>
        <result property="implSuper" column="impl_super"/>
        <result property="ifExpeProof" column="if_expe_proof"/>
        <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="orgGuid" column="org_guid"/>
    </resultMap>
    <sql id="selectObjEngHazaVo">
        select guid, haza_eng_name, eng_guid, tend_guid, wiun_wsub_guid,
               haza_eng_type, impl_super, if_expe_proof, note, coll_time,
               upd_time, rec_pers, org_guid
        from obj_eng_haza
    </sql>
    <select id="selectObjEngHazaByGuid" parameterType="String" resultMap="ObjEngHazaResult">
        <include refid="selectObjEngHazaVo"/>
        where guid = #{guid}
    </select>
    <select id="selectObjEngHazaList" parameterType="com.goldenwater.slaj.hazard.domain.ObjEngHaza" resultMap="ObjEngHazaResult">
        <include refid="selectObjEngHazaVo"/>
        <where>
            <if test="hazaEngName != null and hazaEngName != ''">AND haza_eng_name like '%' || #{hazaEngName} || '%'</if>
            <if test="engGuid != null and engGuid != ''">AND eng_guid = #{engGuid}</if>
            <if test="orgGuid != null and orgGuid != ''">AND org_guid = #{orgGuid}</if>
            <if test="guid != null and guid != ''">AND guid = #{guid}</if>
        </where>
    </select>
    <insert id="insertObjEngHaza" parameterType="com.goldenwater.slaj.hazard.domain.ObjEngHaza">
        insert into obj_eng_haza (
            guid, haza_eng_name, eng_guid, tend_guid, wiun_wsub_guid,
            haza_eng_type, impl_super, if_expe_proof, note, coll_time,
            upd_time, rec_pers, org_guid
        ) values (
            #{guid}, #{hazaEngName}, #{engGuid}, #{tendGuid}, #{wiunWsubGuid},
            #{hazaEngType}, #{implSuper}, #{ifExpeProof}, #{note}, #{collTime},
            #{updTime}, #{recPers}, #{orgGuid}
        )
    </insert>
    <update id="updateObjEngHaza" parameterType="com.goldenwater.slaj.hazard.domain.ObjEngHaza">
        update obj_eng_haza
        <set>
            <if test="hazaEngName != null">haza_eng_name = #{hazaEngName},</if>
            <if test="engGuid != null">eng_guid = #{engGuid},</if>
            <if test="tendGuid != null">tend_guid = #{tendGuid},</if>
            <if test="wiunWsubGuid != null">wiun_wsub_guid = #{wiunWsubGuid},</if>
            <if test="hazaEngType != null">haza_eng_type = #{hazaEngType},</if>
            <if test="implSuper != null">impl_super = #{implSuper},</if>
            <if test="ifExpeProof != null">if_expe_proof = #{ifExpeProof},</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="recPers != null">rec_pers = #{recPers},</if>
            <if test="orgGuid != null">org_guid = #{orgGuid},</if>
        </set>
        where guid = #{guid}
    </update>
    <delete id="deleteObjEngHazaByGuid" parameterType="String">
        delete from obj_eng_haza where guid = #{guid}
    </delete>
    <delete id="deleteObjEngHazaByGuids" parameterType="String">
        delete from obj_eng_haza where guid in
        <foreach item="guid" collection="array" open="(" separator="," close=")">
            #{guid}
        </foreach>
    </delete>
</mapper>
