<?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.TBusiControlTermMapper">
    <resultMap type="com.goldenwater.slaj.hazard.domain.TBusiControlTerm" id="TBusiControlTermResult">
        <result property="guid" column="guid"/>
        <result property="hazIdenGuid" column="haz_iden_guid"/>
        <result property="type" column="type"/>
        <result property="content" column="content"/>
        <result property="dataType" column="data_type"/>
        <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="measGuid" column="meas_guid"/>
    </resultMap>
    <sql id="selectTBusiControlTermVo">
        select guid, haz_iden_guid, type, content, data_type, create_per, create_time, update_per, update_time, meas_guid
        from t_busi_control_term
    </sql>
    <select id="selectTBusiControlTermByGuid" parameterType="String" resultMap="TBusiControlTermResult">
        <include refid="selectTBusiControlTermVo"/>
        where guid = #{guid}
    </select>
    <select id="selectTBusiControlTermList" parameterType="com.goldenwater.slaj.hazard.domain.TBusiControlTerm" resultMap="TBusiControlTermResult">
        <include refid="selectTBusiControlTermVo"/>
        <where>
            <if test="hazIdenGuid != null and hazIdenGuid != ''">AND haz_iden_guid like '%' || #{hazIdenGuid} || '%'</if>
            <if test="type != null and type != ''">AND type like '%' || #{type} || '%'</if>
            <if test="content != null and content != ''">AND content like '%' || #{content} || '%'</if>
            <if test="dataType != null and dataType != ''">AND data_type = #{dataType}</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="measGuid != null and measGuid != ''">AND meas_guid = #{measGuid}</if>
        </where>
    </select>
    <insert id="insertTBusiControlTerm" parameterType="com.goldenwater.slaj.hazard.domain.TBusiControlTerm">
        insert into t_busi_control_term (
            guid,
            haz_iden_guid,
            type,
            content,
            data_type,
            create_per,
            create_time,
            update_per,
            update_time,
            meas_guid
        ) values (
            #{guid},
            #{hazIdenGuid},
            #{type},
            #{content},
            #{dataType},
            #{createPer},
            #{createTime},
            #{updatePer},
            #{updateTime},
            #{measGuid}
        )
    </insert>
    <update id="updateTBusiControlTerm" parameterType="com.goldenwater.slaj.hazard.domain.TBusiControlTerm">
        update t_busi_control_term
        <set>
            <if test="hazIdenGuid != null">haz_iden_guid = #{hazIdenGuid},</if>
            <if test="type != null">type = #{type},</if>
            <if test="content != null">content = #{content},</if>
            <if test="dataType != null">data_type = #{dataType},</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="measGuid != null">meas_guid = #{measGuid},</if>
        </set>
        where guid = #{guid}
    </update>
    <delete id="deleteTBusiControlTermByGuid" parameterType="String">
        delete from t_busi_control_term where guid = #{guid}
    </delete>
    <delete id="deleteTBusiControlTermByGuids" parameterType="String">
        delete from t_busi_control_term where guid in
        <foreach item="guid" collection="array" open="(" separator="," close=")">
            #{guid}
        </foreach>
    </delete>
</mapper>
