<?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.BisHazAssessMapper">
    <resultMap type="com.goldenwater.slaj.hazard.domain.BisHazAssess" id="BisHazAssessResult">
        <result property="id" column="id"/>
        <result property="orgGuid" column="org_guid"/>
        <result property="orgName" column="org_name"/>
        <result property="orgCode" column="org_code"/>
        <result property="assessYear" column="assess_year"/>
        <result property="assessDateNum" column="assess_date_num"/>
        <result property="unitRange" column="unit_range"/>
        <result property="orderCol" column="order_col"/>
        <result property="coeffZjEng" column="coeff_zj_eng"/>
        <result property="coeffYjEng" column="coeff_yj_eng"/>
        <result property="coeffDxEng" column="coeff_dx_eng"/>
        <result property="coeffZxEng" column="coeff_zx_eng"/>
        <result property="coeffHazScore" column="coeff_haz_score"/>
        <result property="coeffHazGk" column="coeff_haz_gk"/>
        <result property="coeffHazGkMajor" column="coeff_haz_gk_major"/>
        <result property="coeffHazGkNormal" column="coeff_haz_gk_normal"/>
        <result property="coeffHazMissing" column="coeff_haz_missing"/>
        <result property="collTime" column="coll_time"/>
    </resultMap>
    <sql id="selectBisHazAssessVo">
        select id, org_guid, org_name, org_code, assess_year, assess_date_num,
               unit_range, order_col, coeff_zj_eng, coeff_yj_eng, coeff_dx_eng,
               coeff_zx_eng, coeff_haz_score, coeff_haz_gk, coeff_haz_gk_major,
               coeff_haz_gk_normal, coeff_haz_missing, coll_time
        from bis_haz_assess
    </sql>
    <select id="selectBisHazAssessById" parameterType="Long" resultMap="BisHazAssessResult">
        <include refid="selectBisHazAssessVo"/>
        where id = #{id}
    </select>
    <select id="selectBisHazAssessList" parameterType="com.goldenwater.slaj.hazard.domain.BisHazAssess" resultMap="BisHazAssessResult">
        <include refid="selectBisHazAssessVo"/>
        <where>
            <if test="orgGuid != null and orgGuid != ''">AND org_guid = #{orgGuid}</if>
            <if test="assessYear != null">AND assess_year = #{assessYear}</if>
            <if test="assessDateNum != null">AND assess_date_num = #{assessDateNum}</if>
            <if test="id != null">AND id = #{id}</if>
        </where>
    </select>
    <insert id="insertBisHazAssess" parameterType="com.goldenwater.slaj.hazard.domain.BisHazAssess">
        insert into bis_haz_assess (
            id, org_guid, org_name, org_code, assess_year, assess_date_num,
            unit_range, order_col, coeff_zj_eng, coeff_yj_eng, coeff_dx_eng,
            coeff_zx_eng, coeff_haz_score, coeff_haz_gk, coeff_haz_gk_major,
            coeff_haz_gk_normal, coeff_haz_missing, coll_time
        ) values (
            #{id}, #{orgGuid}, #{orgName}, #{orgCode}, #{assessYear}, #{assessDateNum},
            #{unitRange}, #{orderCol}, #{coeffZjEng}, #{coeffYjEng}, #{coeffDxEng},
            #{coeffZxEng}, #{coeffHazScore}, #{coeffHazGk}, #{coeffHazGkMajor},
            #{coeffHazGkNormal}, #{coeffHazMissing}, #{collTime}
        )
    </insert>
    <update id="updateBisHazAssess" parameterType="com.goldenwater.slaj.hazard.domain.BisHazAssess">
        update bis_haz_assess
        <set>
            <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="assessYear != null">assess_year = #{assessYear},</if>
            <if test="assessDateNum != null">assess_date_num = #{assessDateNum},</if>
            <if test="unitRange != null">unit_range = #{unitRange},</if>
            <if test="orderCol != null">order_col = #{orderCol},</if>
            <if test="coeffZjEng != null">coeff_zj_eng = #{coeffZjEng},</if>
            <if test="coeffYjEng != null">coeff_yj_eng = #{coeffYjEng},</if>
            <if test="coeffDxEng != null">coeff_dx_eng = #{coeffDxEng},</if>
            <if test="coeffZxEng != null">coeff_zx_eng = #{coeffZxEng},</if>
            <if test="coeffHazScore != null">coeff_haz_score = #{coeffHazScore},</if>
            <if test="coeffHazGk != null">coeff_haz_gk = #{coeffHazGk},</if>
            <if test="coeffHazGkMajor != null">coeff_haz_gk_major = #{coeffHazGkMajor},</if>
            <if test="coeffHazGkNormal != null">coeff_haz_gk_normal = #{coeffHazGkNormal},</if>
            <if test="coeffHazMissing != null">coeff_haz_missing = #{coeffHazMissing},</if>
            <if test="collTime != null">coll_time = #{collTime},</if>
        </set>
        where id = #{id}
    </update>
    <delete id="deleteBisHazAssessById" parameterType="Long">
        delete from bis_haz_assess where id = #{id}
    </delete>
    <delete id="deleteBisHazAssessByIds" parameterType="Long">
        delete from bis_haz_assess where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>
