<?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.TBusiControlMeasureMapper">
    <resultMap type="com.goldenwater.slaj.hazard.domain.TBusiControlMeasure" id="TBusiControlMeasureResult">
        <result property="guid" column="guid"/>
        <result property="hazIdenGuid" column="haz_iden_guid"/>
        <result property="orgPerGuid" column="org_per_guid"/>
        <result property="consOrgPerGuid" column="cons_org_per_guid"/>
        <result property="supeOrgPerGuid" column="supe_org_per_guid"/>
        <result property="supePerGuid" column="supe_per_guid"/>
        <result property="scenePerGuid" column="scene_per_guid"/>
        <result property="orgGuid" column="org_guid"/>
        <result property="createPer" column="create_per"/>
        <result property="createTime" column="create_time"/>
        <result property="updatePer" column="update_per"/>
        <result property="updateTime" column="update_time"/>
    </resultMap>
    <sql id="selectTBusiControlMeasureVo">
        select guid, haz_iden_guid, org_per_guid, cons_org_per_guid, supe_org_per_guid, supe_per_guid, scene_per_guid, org_guid, create_per, create_time, update_per, update_time
        from t_busi_control_measure
    </sql>
    <select id="selectTBusiControlMeasureByGuid" parameterType="String" resultMap="TBusiControlMeasureResult">
        <include refid="selectTBusiControlMeasureVo"/>
        where guid = #{guid}
    </select>
    <select id="selectTBusiControlMeasureList" parameterType="com.goldenwater.slaj.hazard.domain.TBusiControlMeasure" resultMap="TBusiControlMeasureResult">
        <include refid="selectTBusiControlMeasureVo"/>
        <where>
            <if test="hazIdenGuid != null and hazIdenGuid != ''">AND haz_iden_guid like '%' || #{hazIdenGuid} || '%'</if>
            <if test="orgPerGuid != null and orgPerGuid != ''">AND org_per_guid like '%' || #{orgPerGuid} || '%'</if>
            <if test="consOrgPerGuid != null and consOrgPerGuid != ''">AND cons_org_per_guid like '%' || #{consOrgPerGuid} || '%'</if>
            <if test="supeOrgPerGuid != null and supeOrgPerGuid != ''">AND supe_org_per_guid = #{supeOrgPerGuid}</if>
            <if test="supePerGuid != null and supePerGuid != ''">AND supe_per_guid = #{supePerGuid}</if>
            <if test="scenePerGuid != null and scenePerGuid != ''">AND scene_per_guid = #{scenePerGuid}</if>
            <if test="orgGuid != null and orgGuid != ''">AND org_guid = #{orgGuid}</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>
        </where>
    </select>
    <insert id="insertTBusiControlMeasure" parameterType="com.goldenwater.slaj.hazard.domain.TBusiControlMeasure">
        insert into t_busi_control_measure (
            guid,
            haz_iden_guid,
            org_per_guid,
            cons_org_per_guid,
            supe_org_per_guid,
            supe_per_guid,
            scene_per_guid,
            org_guid,
            create_per,
            create_time,
            update_per,
            update_time
        ) values (
            #{guid},
            #{hazIdenGuid},
            #{orgPerGuid},
            #{consOrgPerGuid},
            #{supeOrgPerGuid},
            #{supePerGuid},
            #{scenePerGuid},
            #{orgGuid},
            #{createPer},
            #{createTime},
            #{updatePer},
            #{updateTime}
        )
    </insert>
    <update id="updateTBusiControlMeasure" parameterType="com.goldenwater.slaj.hazard.domain.TBusiControlMeasure">
        update t_busi_control_measure
        <set>
            <if test="hazIdenGuid != null">haz_iden_guid = #{hazIdenGuid},</if>
            <if test="orgPerGuid != null">org_per_guid = #{orgPerGuid},</if>
            <if test="consOrgPerGuid != null">cons_org_per_guid = #{consOrgPerGuid},</if>
            <if test="supeOrgPerGuid != null">supe_org_per_guid = #{supeOrgPerGuid},</if>
            <if test="supePerGuid != null">supe_per_guid = #{supePerGuid},</if>
            <if test="scenePerGuid != null">scene_per_guid = #{scenePerGuid},</if>
            <if test="orgGuid != null">org_guid = #{orgGuid},</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>
        </set>
        where guid = #{guid}
    </update>
    <delete id="deleteTBusiControlMeasureByGuid" parameterType="String">
        delete from t_busi_control_measure where guid = #{guid}
    </delete>
    <delete id="deleteTBusiControlMeasureByGuids" parameterType="String">
        delete from t_busi_control_measure where guid in
        <foreach item="guid" collection="array" open="(" separator="," close=")">
            #{guid}
        </foreach>
    </delete>
</mapper>
