<?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.acci.mapper.BisAcciAssessRecMapper">
    <resultMap type="com.goldenwater.slaj.acci.domain.BisAcciAssessRec" id="BisAcciAssessRecResult">
        <result property="id" column="id"/>
        <result property="assessId" column="assess_id"/>
        <result property="orgGuid" column="org_guid"/>
        <result property="orgName" column="org_name"/>
        <result property="orgCode" column="org_code"/>
        <result property="acciSum" column="acci_sum"/>
        <result property="jumboAcciSum" column="jumbo_acci_sum"/>
        <result property="majorAcciSum" column="major_acci_sum"/>
        <result property="largerAcciSum" column="larger_acci_sum"/>
        <result property="normalAcciSum" column="normal_acci_sum"/>
        <result property="acciRisk" column="acci_risk"/>
        <result property="acciRank" column="acci_rank"/>
    </resultMap>
    <sql id="selectBisAcciAssessRecVo">
        select id, assess_id, org_guid, org_name, org_code, acci_sum,
               jumbo_acci_sum, major_acci_sum, larger_acci_sum, normal_acci_sum,
               acci_risk, acci_rank
        from bis_acci_assess_rec
    </sql>
    <select id="selectBisAcciAssessRecById" parameterType="Long" resultMap="BisAcciAssessRecResult">
        <include refid="selectBisAcciAssessRecVo"/>
        where id = #{id}
    </select>
    <select id="selectBisAcciAssessRecList" parameterType="com.goldenwater.slaj.acci.domain.BisAcciAssessRec" resultMap="BisAcciAssessRecResult">
        <include refid="selectBisAcciAssessRecVo"/>
        <where>
            <if test="assessId != null">AND assess_id = #{assessId}</if>
            <if test="orgGuid != null and orgGuid != ''">AND org_guid = #{orgGuid}</if>
            <if test="orgName != null and orgName != ''">AND org_name like '%' || #{orgName} || '%'</if>
            <if test="orgCode != null and orgCode != ''">AND org_code = #{orgCode}</if>
        </where>
    </select>
    <insert id="insertBisAcciAssessRec" parameterType="com.goldenwater.slaj.acci.domain.BisAcciAssessRec">
        insert into bis_acci_assess_rec (
            id, assess_id, org_guid, org_name, org_code, acci_sum,
            jumbo_acci_sum, major_acci_sum, larger_acci_sum, normal_acci_sum,
            acci_risk, acci_rank
        ) values (
            #{id}, #{assessId}, #{orgGuid}, #{orgName}, #{orgCode}, #{acciSum},
            #{jumboAcciSum}, #{majorAcciSum}, #{largerAcciSum}, #{normalAcciSum},
            #{acciRisk}, #{acciRank}
        )
    </insert>
    <update id="updateBisAcciAssessRec" parameterType="com.goldenwater.slaj.acci.domain.BisAcciAssessRec">
        update bis_acci_assess_rec
        <set>
            <if test="assessId != null">assess_id = #{assessId},</if>
            <if test="orgGuid != null">org_guid = #{orgGuid},</if>
            <if test="orgName != null">org_name = #{orgName},</if>
            <if test="orgCode != null">org_code = #{orgCode},</if>
            <if test="acciSum != null">acci_sum = #{acciSum},</if>
            <if test="jumboAcciSum != null">jumbo_acci_sum = #{jumboAcciSum},</if>
            <if test="majorAcciSum != null">major_acci_sum = #{majorAcciSum},</if>
            <if test="largerAcciSum != null">larger_acci_sum = #{largerAcciSum},</if>
            <if test="normalAcciSum != null">normal_acci_sum = #{normalAcciSum},</if>
            <if test="acciRisk != null">acci_risk = #{acciRisk},</if>
            <if test="acciRank != null">acci_rank = #{acciRank},</if>
        </set>
        where id = #{id}
    </update>
    <delete id="deleteBisAcciAssessRecById" parameterType="Long">
        delete from bis_acci_assess_rec where id = #{id}
    </delete>
    <delete id="deleteBisAcciAssessRecByIds" parameterType="Long">
        delete from bis_acci_assess_rec where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>
