<?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.BBusiWishUniversityMarjorsPlanSubmitMapper">
    
    <resultMap type="BBusiWishUniversityMarjorsPlanSubmit" id="BBusiWishUniversityMarjorsPlanSubmitResult">
        <result property="planId"    column="plan_id"    />
        <result property="submitId"    column="submit_id"    />
        <result property="groupId"    column="group_id"    />
        <result property="universityId"    column="universityId"    />
        <result property="location"    column="location"    />
        <result property="year"    column="year"    />
        <result property="collegeCode"    column="collegeCode"    />
        <result property="level"    column="level"    />
        <result property="liberalScience"    column="liberalScience"    />
        <result property="course"    column="course"    />
        <result property="course0"    column="course0"    />
        <result property="course1"    column="course1"    />
        <result property="course2"    column="course2"    />
        <result property="marjorName"    column="marjorName"    />
        <result property="marjorCollegeId"    column="marjorCollegeId"    />
        <result property="createTime"    column="createTime"    />
        <result property="status"    column="status"    />
        <result property="stats"    column="stats"  typeHandler="com.ruoyi.mxjb.handlers.SubmitYearsStatsHandler"   />
    </resultMap>

    <sql id="selectBBusiWishUniversityMarjorsPlanSubmitVo">
        select plan_id, submit_id, group_id, universityId, location, year, collegeCode, level, liberalScience, course, course0, course1, course2, marjorName, marjorCollegeId, createTime, status, stats from b_busi_wish_university_marjors_plan_submit
    </sql>

    <select id="selectBBusiWishUniversityMarjorsPlanSubmitList" parameterType="BBusiWishUniversityMarjorsPlanSubmit" resultMap="BBusiWishUniversityMarjorsPlanSubmitResult">
        <include refid="selectBBusiWishUniversityMarjorsPlanSubmitVo"/>
        <where>  
            <if test="submitId != null "> and submit_id = #{submitId}</if>
            <if test="groupId != null "> and group_id = #{groupId}</if>
            <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="collegeCode != null  and collegeCode != ''"> and collegeCode = #{collegeCode}</if>
            <if test="level != null  and level != ''"> and level = #{level}</if>
            <if test="liberalScience != null "> and liberalScience = #{liberalScience}</if>
            <if test="course != null "> and course = #{course}</if>
            <if test="course0 != null "> and course0 = #{course0}</if>
            <if test="course1 != null "> and course1 = #{course1}</if>
            <if test="course2 != null "> and course2 = #{course2}</if>
            <if test="marjorName != null  and marjorName != ''"> and marjorName like concat('%', #{marjorName}, '%')</if>
            <if test="marjorCollegeId != null "> and marjorCollegeId = #{marjorCollegeId}</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="selectBBusiWishUniversityMarjorsPlanSubmitByIds" parameterType="Long" resultMap="BBusiWishUniversityMarjorsPlanSubmitResult">
        <include refid="selectBBusiWishUniversityMarjorsPlanSubmitVo"/> where plan_id in <foreach item="planId" collection="collection" open="(" separator="," close=")">#{planId}</foreach>
    </select>

    <select id="selectBBusiWishUniversityMarjorsPlanSubmitById" parameterType="Long" resultMap="BBusiWishUniversityMarjorsPlanSubmitResult">
        <include refid="selectBBusiWishUniversityMarjorsPlanSubmitVo"/>
        where plan_id = #{planId}
    </select>
        
    <insert id="insertBBusiWishUniversityMarjorsPlanSubmit" parameterType="BBusiWishUniversityMarjorsPlanSubmit">
        insert into b_busi_wish_university_marjors_plan_submit
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="planId != null">plan_id,</if>
            <if test="submitId != null">submit_id,</if>
            <if test="groupId != null">group_id,</if>
            <if test="universityId != null">universityId,</if>
            <if test="location != null">location,</if>
            <if test="year != null and year != ''">year,</if>
            <if test="collegeCode != null">collegeCode,</if>
            <if test="level != null">level,</if>
            <if test="liberalScience != null">liberalScience,</if>
            <if test="course != null">course,</if>
            <if test="course0 != null">course0,</if>
            <if test="course1 != null">course1,</if>
            <if test="course2 != null">course2,</if>
            <if test="marjorName != null">marjorName,</if>
            <if test="marjorCollegeId != null">marjorCollegeId,</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="planId != null">#{planId},</if>
            <if test="submitId != null">#{submitId},</if>
            <if test="groupId != null">#{groupId},</if>
            <if test="universityId != null">#{universityId},</if>
            <if test="location != null">#{location},</if>
            <if test="year != null and year != ''">#{year},</if>
            <if test="collegeCode != null">#{collegeCode},</if>
            <if test="level != null">#{level},</if>
            <if test="liberalScience != null">#{liberalScience},</if>
            <if test="course != null">#{course},</if>
            <if test="course0 != null">#{course0},</if>
            <if test="course1 != null">#{course1},</if>
            <if test="course2 != null">#{course2},</if>
            <if test="marjorName != null">#{marjorName},</if>
            <if test="marjorCollegeId != null">#{marjorCollegeId},</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="updateBBusiWishUniversityMarjorsPlanSubmit" parameterType="BBusiWishUniversityMarjorsPlanSubmit">
        update b_busi_wish_university_marjors_plan_submit
        <trim prefix="SET" suffixOverrides=",">
            <if test="submitId != null">submit_id = #{submitId},</if>
            <if test="groupId != null">group_id = #{groupId},</if>
            <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="collegeCode != null">collegeCode = #{collegeCode},</if>
            <if test="level != null">level = #{level},</if>
            <if test="liberalScience != null">liberalScience = #{liberalScience},</if>
            <if test="course != null">course = #{course},</if>
            <if test="course0 != null">course0 = #{course0},</if>
            <if test="course1 != null">course1 = #{course1},</if>
            <if test="course2 != null">course2 = #{course2},</if>
            <if test="marjorName != null">marjorName = #{marjorName},</if>
            <if test="marjorCollegeId != null">marjorCollegeId = #{marjorCollegeId},</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 plan_id = #{planId}
    </update>

    <delete id="deleteBBusiWishUniversityMarjorsPlanSubmitById" parameterType="Long">
        delete from b_busi_wish_university_marjors_plan_submit where plan_id = #{planId}
    </delete>

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