<?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.TBusiRiskThresholdMapper">
    <resultMap type="com.goldenwater.slaj.hazard.domain.TBusiRiskThreshold" id="TBusiRiskThresholdResult">
        <result property="guid" column="guid"/>
        <result property="lowRisk" column="low_risk"/>
        <result property="ordinaryRisk" column="ordinary_risk"/>
        <result property="largerRisk" column="larger_risk"/>
        <result property="seriousRisk" column="serious_risk"/>
        <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="toDate" column="to_date"/>
    </resultMap>
    <sql id="selectTBusiRiskThresholdVo">
        select guid, low_risk, ordinary_risk, larger_risk, serious_risk, note, coll_time, upd_time, rec_pers, to_date
        from t_busi_risk_threshold
    </sql>
    <select id="selectTBusiRiskThresholdByGuid" parameterType="String" resultMap="TBusiRiskThresholdResult">
        <include refid="selectTBusiRiskThresholdVo"/>
        where guid = #{guid}
    </select>
    <select id="selectTBusiRiskThresholdList" parameterType="com.goldenwater.slaj.hazard.domain.TBusiRiskThreshold" resultMap="TBusiRiskThresholdResult">
        <include refid="selectTBusiRiskThresholdVo"/>
        <where>
            <if test="note != null and note != ''">AND note like '%' || #{note} || '%'</if>
            <if test="collTime != null and collTime != ''">AND coll_time like '%' || #{collTime} || '%'</if>
            <if test="updTime != null and updTime != ''">AND upd_time like '%' || #{updTime} || '%'</if>
            <if test="recPers != null and recPers != ''">AND rec_pers = #{recPers}</if>
            <if test="toDate != null and toDate != ''">AND to_date = #{toDate}</if>
        </where>
    </select>
    <insert id="insertTBusiRiskThreshold" parameterType="com.goldenwater.slaj.hazard.domain.TBusiRiskThreshold">
        insert into t_busi_risk_threshold (
            guid,
            low_risk,
            ordinary_risk,
            larger_risk,
            serious_risk,
            note,
            coll_time,
            upd_time,
            rec_pers,
            to_date
        ) values (
            #{guid},
            #{lowRisk},
            #{ordinaryRisk},
            #{largerRisk},
            #{seriousRisk},
            #{note},
            #{collTime},
            #{updTime},
            #{recPers},
            #{toDate}
        )
    </insert>
    <update id="updateTBusiRiskThreshold" parameterType="com.goldenwater.slaj.hazard.domain.TBusiRiskThreshold">
        update t_busi_risk_threshold
        <set>
            <if test="lowRisk != null">low_risk = #{lowRisk},</if>
            <if test="ordinaryRisk != null">ordinary_risk = #{ordinaryRisk},</if>
            <if test="largerRisk != null">larger_risk = #{largerRisk},</if>
            <if test="seriousRisk != null">serious_risk = #{seriousRisk},</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="toDate != null">to_date = #{toDate},</if>
        </set>
        where guid = #{guid}
    </update>
    <delete id="deleteTBusiRiskThresholdByGuid" parameterType="String">
        delete from t_busi_risk_threshold where guid = #{guid}
    </delete>
    <delete id="deleteTBusiRiskThresholdByGuids" parameterType="String">
        delete from t_busi_risk_threshold where guid in
        <foreach item="guid" collection="array" open="(" separator="," close=")">
            #{guid}
        </foreach>
    </delete>
</mapper>
