<?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.TBusiHazIdenMapper">
    <resultMap type="com.goldenwater.slaj.hazard.domain.TBusiHazIden" id="TBusiHazIdenResult">
        <result property="guid" column="guid"/>
        <result property="hazGuid" column="haz_guid"/>
        <result property="hazGrade" column="haz_grade"/>
        <result property="hazRemark" column="haz_remark"/>
        <result property="orgPer" column="org_per"/>
        <result property="orgPhone" column="org_phone"/>
        <result property="supePer" column="supe_per"/>
        <result property="supePhone" column="supe_phone"/>
        <result property="controlPer" column="control_per"/>
        <result property="controlPhone" column="control_phone"/>
        <result property="guideIn" column="guide_in"/>
        <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="acciCause" column="acci_cause"/>
    </resultMap>
    <sql id="selectTBusiHazIdenVo">
        select guid, haz_guid, haz_grade, haz_remark, org_per, org_phone,
               supe_per, supe_phone, control_per, control_phone, guide_in,
               create_per, create_time, update_per, update_time, acci_cause
        from t_busi_haz_iden
    </sql>
    <select id="selectTBusiHazIdenByGuid" parameterType="String" resultMap="TBusiHazIdenResult">
        <include refid="selectTBusiHazIdenVo"/>
        where guid = #{guid}
    </select>
    <select id="selectTBusiHazIdenList" parameterType="com.goldenwater.slaj.hazard.domain.TBusiHazIden" resultMap="TBusiHazIdenResult">
        <include refid="selectTBusiHazIdenVo"/>
        <where>
            <if test="hazGuid != null and hazGuid != ''">AND haz_guid = #{hazGuid}</if>
            <if test="hazGrade != null and hazGrade != ''">AND haz_grade = #{hazGrade}</if>
            <if test="guid != null and guid != ''">AND guid = #{guid}</if>
        </where>
    </select>
    <insert id="insertTBusiHazIden" parameterType="com.goldenwater.slaj.hazard.domain.TBusiHazIden">
        insert into t_busi_haz_iden (
            guid, haz_guid, haz_grade, haz_remark, org_per, org_phone,
            supe_per, supe_phone, control_per, control_phone, guide_in,
            create_per, create_time, update_per, update_time, acci_cause
        ) values (
            #{guid}, #{hazGuid}, #{hazGrade}, #{hazRemark}, #{orgPer}, #{orgPhone},
            #{supePer}, #{supePhone}, #{controlPer}, #{controlPhone}, #{guideIn},
            #{createPer}, #{createTime}, #{updatePer}, #{updateTime}, #{acciCause}
        )
    </insert>
    <update id="updateTBusiHazIden" parameterType="com.goldenwater.slaj.hazard.domain.TBusiHazIden">
        update t_busi_haz_iden
        <set>
            <if test="hazGuid != null">haz_guid = #{hazGuid},</if>
            <if test="hazGrade != null">haz_grade = #{hazGrade},</if>
            <if test="hazRemark != null">haz_remark = #{hazRemark},</if>
            <if test="orgPer != null">org_per = #{orgPer},</if>
            <if test="orgPhone != null">org_phone = #{orgPhone},</if>
            <if test="supePer != null">supe_per = #{supePer},</if>
            <if test="supePhone != null">supe_phone = #{supePhone},</if>
            <if test="controlPer != null">control_per = #{controlPer},</if>
            <if test="controlPhone != null">control_phone = #{controlPhone},</if>
            <if test="guideIn != null">guide_in = #{guideIn},</if>
            <if test="updatePer != null">update_per = #{updatePer},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="acciCause != null">acci_cause = #{acciCause},</if>
        </set>
        where guid = #{guid}
    </update>
    <delete id="deleteTBusiHazIdenByGuid" parameterType="String">
        delete from t_busi_haz_iden where guid = #{guid}
    </delete>
    <delete id="deleteTBusiHazIdenByGuids" parameterType="String">
        delete from t_busi_haz_iden where guid in
        <foreach item="guid" collection="array" open="(" separator="," close=")">
            #{guid}
        </foreach>
    </delete>
</mapper>
