<?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.ObjHazardMapper">
    <resultMap type="com.goldenwater.slaj.hazard.domain.ObjHazard" id="ObjHazardResult">
        <result property="guid" column="guid"/>
        <result property="hazName" column="haz_name"/>
        <result property="guideGuid" column="guide_guid"/>
        <result property="partGuid" column="part_guid"/>
        <result property="orgGuid" column="org_guid"/>
        <result property="veriStatus" column="veri_status"/>
        <result property="veriPer" column="veri_per"/>
        <result property="veriTime" column="veri_time"/>
        <result property="createPer" column="create_per"/>
        <result property="createTime" column="create_time"/>
        <result property="updatePer" column="update_per"/>
        <result property="updateTime" column="update_time"/>
        <result property="pguid" column="pguid"/>
        <result property="changeStatus" column="change_status"/>
        <result property="type" column="type"/>
        <result property="engGuid" column="eng_guid"/>
    </resultMap>
    <sql id="selectObjHazardVo">
        select guid, haz_name, guide_guid, part_guid, org_guid, veri_status, veri_per, veri_time, create_per, create_time, update_per, update_time, pguid, change_status, type, eng_guid
        from obj_hazard
    </sql>
    <select id="selectObjHazardByGuid" parameterType="String" resultMap="ObjHazardResult">
        <include refid="selectObjHazardVo"/>
        where guid = #{guid}
    </select>
    <select id="selectObjHazardList" parameterType="com.goldenwater.slaj.hazard.domain.ObjHazard" resultMap="ObjHazardResult">
        <include refid="selectObjHazardVo"/>
        <where>
            <if test="hazName != null and hazName != ''">AND haz_name like '%' || #{hazName} || '%'</if>
            <if test="guideGuid != null and guideGuid != ''">AND guide_guid like '%' || #{guideGuid} || '%'</if>
            <if test="partGuid != null and partGuid != ''">AND part_guid like '%' || #{partGuid} || '%'</if>
            <if test="orgGuid != null and orgGuid != ''">AND org_guid = #{orgGuid}</if>
            <if test="veriStatus != null and veriStatus != ''">AND veri_status = #{veriStatus}</if>
            <if test="veriPer != null and veriPer != ''">AND veri_per = #{veriPer}</if>
            <if test="veriTime != null and veriTime != ''">AND veri_time = #{veriTime}</if>
            <if test="createPer != null and createPer != ''">AND create_per = #{createPer}</if>
            <if test="createTime != null and createTime != ''">AND create_time = #{createTime}</if>
            <if test="updatePer != null and updatePer != ''">AND update_per = #{updatePer}</if>
            <if test="updateTime != null and updateTime != ''">AND update_time = #{updateTime}</if>
            <if test="pguid != null and pguid != ''">AND pguid = #{pguid}</if>
            <if test="changeStatus != null and changeStatus != ''">AND change_status = #{changeStatus}</if>
            <if test="type != null and type != ''">AND type = #{type}</if>
            <if test="engGuid != null and engGuid != ''">AND eng_guid = #{engGuid}</if>
        </where>
    </select>
    <insert id="insertObjHazard" parameterType="com.goldenwater.slaj.hazard.domain.ObjHazard">
        insert into obj_hazard (
            guid,
            haz_name,
            guide_guid,
            part_guid,
            org_guid,
            veri_status,
            veri_per,
            veri_time,
            create_per,
            create_time,
            update_per,
            update_time,
            pguid,
            change_status,
            type,
            eng_guid
        ) values (
            #{guid},
            #{hazName},
            #{guideGuid},
            #{partGuid},
            #{orgGuid},
            #{veriStatus},
            #{veriPer},
            #{veriTime},
            #{createPer},
            #{createTime},
            #{updatePer},
            #{updateTime},
            #{pguid},
            #{changeStatus},
            #{type},
            #{engGuid}
        )
    </insert>
    <update id="updateObjHazard" parameterType="com.goldenwater.slaj.hazard.domain.ObjHazard">
        update obj_hazard
        <set>
            <if test="hazName != null">haz_name = #{hazName},</if>
            <if test="guideGuid != null">guide_guid = #{guideGuid},</if>
            <if test="partGuid != null">part_guid = #{partGuid},</if>
            <if test="orgGuid != null">org_guid = #{orgGuid},</if>
            <if test="veriStatus != null">veri_status = #{veriStatus},</if>
            <if test="veriPer != null">veri_per = #{veriPer},</if>
            <if test="veriTime != null">veri_time = #{veriTime},</if>
            <if test="createPer != null">create_per = #{createPer},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updatePer != null">update_per = #{updatePer},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="pguid != null">pguid = #{pguid},</if>
            <if test="changeStatus != null">change_status = #{changeStatus},</if>
            <if test="type != null">type = #{type},</if>
            <if test="engGuid != null">eng_guid = #{engGuid},</if>
        </set>
        where guid = #{guid}
    </update>
    <delete id="deleteObjHazardByGuid" parameterType="String">
        delete from obj_hazard where guid = #{guid}
    </delete>
    <delete id="deleteObjHazardByGuids" parameterType="String">
        delete from obj_hazard where guid in
        <foreach item="guid" collection="array" open="(" separator="," close=")">
            #{guid}
        </foreach>
    </delete>
</mapper>
