<?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.mxjb.mapper.MxjbWishScoreRateMapper">
    
    <resultMap type="MxjbWishScoreRate" id="MxjbWishScoreRateResult">
        <result property="id"    column="id"    />
        <result property="year"    column="year"    />
        <result property="diff"    column="diff"    />
        <result property="enrollLevel"    column="enroll_level"    />
        <result property="ratio"    column="ratio"    />
        <result property="riskLevel"    column="risk_level"    />
    </resultMap>

    <sql id="selectMxjbWishScoreRateVo">
        select id, year, diff, enroll_level, ratio, risk_level from mxjb_wish_score_rate
    </sql>

    <select id="selectMxjbWishScoreRateList" parameterType="MxjbWishScoreRate" resultMap="MxjbWishScoreRateResult">
        <include refid="selectMxjbWishScoreRateVo"/>
        <where>  
            <if test="year != null "> and year = #{year}</if>
            <if test="diff != null "> and diff = #{diff}</if>
            <if test="enrollLevel != null "> and enroll_level = #{enrollLevel}</if>
            <if test="ratio != null "> and ratio = #{ratio}</if>
            <if test="riskLevel != null  and riskLevel != ''"> and risk_level = #{riskLevel}</if>
        </where>
    </select>
    
    <select id="selectMxjbWishScoreRateById" parameterType="Long" resultMap="MxjbWishScoreRateResult">
        <include refid="selectMxjbWishScoreRateVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertMxjbWishScoreRate" parameterType="MxjbWishScoreRate" useGeneratedKeys="true" keyProperty="id">
        insert into mxjb_wish_score_rate
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="year != null">year,</if>
            <if test="diff != null">diff,</if>
            <if test="enrollLevel != null">enroll_level,</if>
            <if test="ratio != null">ratio,</if>
            <if test="riskLevel != null">risk_level,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="year != null">#{year},</if>
            <if test="diff != null">#{diff},</if>
            <if test="enrollLevel != null">#{enrollLevel},</if>
            <if test="ratio != null">#{ratio},</if>
            <if test="riskLevel != null">#{riskLevel},</if>
         </trim>
    </insert>

    <update id="updateMxjbWishScoreRate" parameterType="MxjbWishScoreRate">
        update mxjb_wish_score_rate
        <trim prefix="SET" suffixOverrides=",">
            <if test="year != null">year = #{year},</if>
            <if test="diff != null">diff = #{diff},</if>
            <if test="enrollLevel != null">enroll_level = #{enrollLevel},</if>
            <if test="ratio != null">ratio = #{ratio},</if>
            <if test="riskLevel != null">risk_level = #{riskLevel},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteMxjbWishScoreRateById" parameterType="Long">
        delete from mxjb_wish_score_rate where id = #{id}
    </delete>

    <delete id="deleteMxjbWishScoreRateByIds" parameterType="String">
        delete from mxjb_wish_score_rate where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>