<?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.BBusiWishUniversityMarjorsCollegeMapper">
    
    <resultMap type="BBusiWishUniversityMarjorsCollege" id="BBusiWishUniversityMarjorsCollegeResult">
        <result property="id"    column="id"    />
        <result property="universityId"    column="universityId"    />
        <result property="location"    column="location"    />
        <result property="year"    column="year"    />
        <result property="level"    column="level"    />
        <result property="liberalScience"    column="liberalScience"    />
        <result property="collegeCode"    column="collegeCode"    />
        <result property="marjorCount"    column="marjorCount"    />
        <result property="planCount"    column="planCount"    />
        <result property="score"    column="score"    />
        <result property="createTime"    column="createTime"    />
        <result property="status"    column="status"    />
        <result property="stats"    column="stats"  typeHandler="com.ruoyi.mxjb.handlers.SubmitYearsStatsHandler"   />
    </resultMap>

    <sql id="selectBBusiWishUniversityMarjorsCollegeVo">
        select id, universityId, location, year, level, liberalScience, collegeCode, marjorCount, planCount, score, createTime, status, stats from b_busi_wish_university_marjors_college
    </sql>

    <select id="selectBBusiWishUniversityMarjorsCollegeList" parameterType="BBusiWishUniversityMarjorsCollege" resultMap="BBusiWishUniversityMarjorsCollegeResult">
        <include refid="selectBBusiWishUniversityMarjorsCollegeVo"/>
        <where>  
            <if test="universityId != null  and universityId != ''"> and universityId = #{universityId}</if>
            <if test="location != null  and location != ''"> and location = #{location}</if>
            <if test="year != null  and year != ''"> and year = #{year}</if>
            <if test="level != null  and level != ''"> and level = #{level}</if>
            <if test="liberalScience != null "> and liberalScience = #{liberalScience}</if>
            <if test="collegeCode != null  and collegeCode != ''"> and collegeCode = #{collegeCode}</if>
            <if test="marjorCount != null "> and marjorCount = #{marjorCount}</if>
            <if test="planCount != null "> and planCount = #{planCount}</if>
            <if test="score != null "> and score = #{score}</if>
            <if test="createTime != null "> and createTime = #{createTime}</if>
            <if test="status != null "> and status = #{status}</if>
            <if test="stats != null "> and stats = #{stats, typeHandler=com.ruoyi.mxjb.handlers.SubmitYearsStatsHandler}</if>
        </where>
    </select>
    
    <select id="selectBBusiWishUniversityMarjorsCollegeById" parameterType="Long" resultMap="BBusiWishUniversityMarjorsCollegeResult">
        <include refid="selectBBusiWishUniversityMarjorsCollegeVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertBBusiWishUniversityMarjorsCollege" parameterType="BBusiWishUniversityMarjorsCollege" useGeneratedKeys="true" keyProperty="id">
        insert into b_busi_wish_university_marjors_college
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="universityId != null">universityId,</if>
            <if test="location != null">location,</if>
            <if test="year != null and year != ''">year,</if>
            <if test="level != null">level,</if>
            <if test="liberalScience != null">liberalScience,</if>
            <if test="collegeCode != null">collegeCode,</if>
            <if test="marjorCount != null">marjorCount,</if>
            <if test="planCount != null">planCount,</if>
            <if test="score != null">score,</if>
            <if test="createTime != null">createTime,</if>
            <if test="status != null">status,</if>
            <if test="stats != null">stats,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="universityId != null">#{universityId},</if>
            <if test="location != null">#{location},</if>
            <if test="year != null and year != ''">#{year},</if>
            <if test="level != null">#{level},</if>
            <if test="liberalScience != null">#{liberalScience},</if>
            <if test="collegeCode != null">#{collegeCode},</if>
            <if test="marjorCount != null">#{marjorCount},</if>
            <if test="planCount != null">#{planCount},</if>
            <if test="score != null">#{score},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="status != null">#{status},</if>
            <if test="stats != null">#{stats, typeHandler=com.ruoyi.mxjb.handlers.SubmitYearsStatsHandler},</if>
         </trim>
    </insert>

    <update id="updateBBusiWishUniversityMarjorsCollege" parameterType="BBusiWishUniversityMarjorsCollege">
        update b_busi_wish_university_marjors_college
        <trim prefix="SET" suffixOverrides=",">
            <if test="universityId != null">universityId = #{universityId},</if>
            <if test="location != null">location = #{location},</if>
            <if test="year != null and year != ''">year = #{year},</if>
            <if test="level != null">level = #{level},</if>
            <if test="liberalScience != null">liberalScience = #{liberalScience},</if>
            <if test="collegeCode != null">collegeCode = #{collegeCode},</if>
            <if test="marjorCount != null">marjorCount = #{marjorCount},</if>
            <if test="planCount != null">planCount = #{planCount},</if>
            <if test="score != null">score = #{score},</if>
            <if test="createTime != null">createTime = #{createTime},</if>
            <if test="status != null">status = #{status},</if>
            <if test="stats != null">stats = #{stats, typeHandler=com.ruoyi.mxjb.handlers.SubmitYearsStatsHandler},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteBBusiWishUniversityMarjorsCollegeById" parameterType="Long">
        delete from b_busi_wish_university_marjors_college where id = #{id}
    </delete>

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