<?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.ruoyi.web.modules.epidemic.mapper.BizRiskFactorWeightMapper">

    <resultMap type="com.ruoyi.web.modules.epidemic.domain.BizRiskFactorWeight" id="BizRiskFactorWeightResult">
        <id     property="id"                              column="id"/>
        <result property="weightBreedingDensity"           column="weight_breeding_density"/>
        <result property="weightTrafficMobility"           column="weight_traffic_mobility"/>
        <result property="weightQuarantineIntensity"       column="weight_quarantine_intensity"/>
        <result property="weightMeteorologicalSuitability" column="weight_meteorological_suitability"/>
        <result property="weightPastDiseaseLevel"          column="weight_past_disease_level"/>
        <result property="createBy"                        column="create_by"/>
        <result property="createTime"                      column="create_time"/>
        <result property="updateBy"                        column="update_by"/>
        <result property="updateTime"                      column="update_time"/>
    </resultMap>

    <sql id="selectVo">
        select id, weight_breeding_density, weight_traffic_mobility, weight_quarantine_intensity,
               weight_meteorological_suitability, weight_past_disease_level,
               create_by, create_time, update_by, update_time
        from biz_risk_factor_weight
    </sql>

    <select id="selectBizRiskFactorWeightById" parameterType="long" resultMap="BizRiskFactorWeightResult">
        <include refid="selectVo"/>
        where id = #{id}
    </select>

    <insert id="insertBizRiskFactorWeight" parameterType="com.ruoyi.web.modules.epidemic.domain.BizRiskFactorWeight">
        insert into biz_risk_factor_weight (
            id, weight_breeding_density, weight_traffic_mobility, weight_quarantine_intensity,
            weight_meteorological_suitability, weight_past_disease_level,
            create_by, create_time
        ) values (
            #{id}, #{weightBreedingDensity}, #{weightTrafficMobility}, #{weightQuarantineIntensity},
            #{weightMeteorologicalSuitability}, #{weightPastDiseaseLevel},
            #{createBy}, sysdate()
        )
    </insert>

    <update id="updateBizRiskFactorWeight" parameterType="com.ruoyi.web.modules.epidemic.domain.BizRiskFactorWeight">
        update biz_risk_factor_weight set
            weight_breeding_density = #{weightBreedingDensity},
            weight_traffic_mobility = #{weightTrafficMobility},
            weight_quarantine_intensity = #{weightQuarantineIntensity},
            weight_meteorological_suitability = #{weightMeteorologicalSuitability},
            weight_past_disease_level = #{weightPastDiseaseLevel},
            update_by = #{updateBy},
            update_time = sysdate()
        where id = #{id}
    </update>
</mapper>
