<?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.BisHazAssessRecMapper">
    <resultMap type="com.goldenwater.slaj.hazard.domain.BisHazAssessRec" id="BisHazAssessRecResult">
        <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="engSum" column="eng_sum"/>
        <result property="engBuildedSum" column="eng_builted_sum"/>
        <result property="engBuildtingSum" column="eng_builting_sum"/>
        <result property="engDxSum" column="eng_dx_sum"/>
        <result property="engZxSum" column="eng_zx_sum"/>
        <result property="hazSum" column="haz_sum"/>
        <result property="majorHazSum" column="major_haz_sum"/>
        <result property="normalHazSum" column="normal_haz_sum"/>
        <result property="gkHazSum" column="gk_haz_sum"/>
        <result property="gkMajorHazSum" column="gk_major_haz_sum"/>
        <result property="gkNormalHazSum" column="gk_normal_haz_sum"/>
        <result property="scalHazFinalSum" column="scal_haz_final_sum"/>
        <result property="dxHazSum" column="dx_haz_sum"/>
        <result property="zxHazSum" column="zx_haz_sum"/>
        <result property="dxHazGkSum" column="dx_haz_gk_sum"/>
        <result property="zxHazGkSum" column="zx_haz_gk_sum"/>
        <result property="hazRank" column="haz_rank"/>
    </resultMap>
    <sql id="selectBisHazAssessRecVo">
        select id, assess_id, org_guid, org_name, org_code, eng_sum,
               eng_builted_sum, eng_builting_sum, eng_dx_sum, eng_zx_sum,
               haz_sum, major_haz_sum, normal_haz_sum, gk_haz_sum,
               gk_major_haz_sum, gk_normal_haz_sum, scal_haz_final_sum,
               dx_haz_sum, zx_haz_sum, dx_haz_gk_sum, zx_haz_gk_sum, haz_rank
        from bis_haz_assess_rec
    </sql>
    <select id="selectBisHazAssessRecById" parameterType="Long" resultMap="BisHazAssessRecResult">
        <include refid="selectBisHazAssessRecVo"/>
        where id = #{id}
    </select>
    <select id="selectBisHazAssessRecList" parameterType="com.goldenwater.slaj.hazard.domain.BisHazAssessRec" resultMap="BisHazAssessRecResult">
        <include refid="selectBisHazAssessRecVo"/>
        <where>
            <if test="assessId != null">AND assess_id = #{assessId}</if>
            <if test="orgGuid != null and orgGuid != ''">AND org_guid = #{orgGuid}</if>
            <if test="id != null">AND id = #{id}</if>
        </where>
    </select>
    <insert id="insertBisHazAssessRec" parameterType="com.goldenwater.slaj.hazard.domain.BisHazAssessRec">
        insert into bis_haz_assess_rec (
            id, assess_id, org_guid, org_name, org_code, eng_sum,
            eng_builted_sum, eng_builting_sum, eng_dx_sum, eng_zx_sum,
            haz_sum, major_haz_sum, normal_haz_sum, gk_haz_sum,
            gk_major_haz_sum, gk_normal_haz_sum, scal_haz_final_sum,
            dx_haz_sum, zx_haz_sum, dx_haz_gk_sum, zx_haz_gk_sum, haz_rank
        ) values (
            #{id}, #{assessId}, #{orgGuid}, #{orgName}, #{orgCode}, #{engSum},
            #{engBuildedSum}, #{engBuildtingSum}, #{engDxSum}, #{engZxSum},
            #{hazSum}, #{majorHazSum}, #{normalHazSum}, #{gkHazSum},
            #{gkMajorHazSum}, #{gkNormalHazSum}, #{scalHazFinalSum},
            #{dxHazSum}, #{zxHazSum}, #{dxHazGkSum}, #{zxHazGkSum}, #{hazRank}
        )
    </insert>
    <update id="updateBisHazAssessRec" parameterType="com.goldenwater.slaj.hazard.domain.BisHazAssessRec">
        update bis_haz_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="engSum != null">eng_sum = #{engSum},</if>
            <if test="engBuildedSum != null">eng_builted_sum = #{engBuildedSum},</if>
            <if test="engBuildtingSum != null">eng_builting_sum = #{engBuildtingSum},</if>
            <if test="engDxSum != null">eng_dx_sum = #{engDxSum},</if>
            <if test="engZxSum != null">eng_zx_sum = #{engZxSum},</if>
            <if test="hazSum != null">haz_sum = #{hazSum},</if>
            <if test="majorHazSum != null">major_haz_sum = #{majorHazSum},</if>
            <if test="normalHazSum != null">normal_haz_sum = #{normalHazSum},</if>
            <if test="gkHazSum != null">gk_haz_sum = #{gkHazSum},</if>
            <if test="gkMajorHazSum != null">gk_major_haz_sum = #{gkMajorHazSum},</if>
            <if test="gkNormalHazSum != null">gk_normal_haz_sum = #{gkNormalHazSum},</if>
            <if test="scalHazFinalSum != null">scal_haz_final_sum = #{scalHazFinalSum},</if>
            <if test="dxHazSum != null">dx_haz_sum = #{dxHazSum},</if>
            <if test="zxHazSum != null">zx_haz_sum = #{zxHazSum},</if>
            <if test="dxHazGkSum != null">dx_haz_gk_sum = #{dxHazGkSum},</if>
            <if test="zxHazGkSum != null">zx_haz_gk_sum = #{zxHazGkSum},</if>
            <if test="hazRank != null">haz_rank = #{hazRank},</if>
        </set>
        where id = #{id}
    </update>
    <delete id="deleteBisHazAssessRecById" parameterType="Long">
        delete from bis_haz_assess_rec where id = #{id}
    </delete>
    <delete id="deleteBisHazAssessRecByIds" parameterType="Long">
        delete from bis_haz_assess_rec where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>
