<?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.BBusiWishUniversityMarjorsGroupMapper">
    
    <resultMap type="BBusiWishUniversityMarjorsGroup" id="BBusiWishUniversityMarjorsGroupResult">
        <result property="groupId"    column="group_id"    />
        <result property="universityId"    column="universityId"    />
        <result property="location"    column="location"    />
        <result property="level"    column="level"    />
        <result property="liberalScience"    column="liberalScience"    />
        <result property="marjorName"    column="marjorName"    />
        <result property="marjorSpecial"    column="marjorSpecial"    />
        <result property="createTime"    column="create_time"    />
        <result property="status"    column="status"    />
    </resultMap>

    <sql id="selectBBusiWishUniversityMarjorsGroupVo">
        select group_id, universityId, location, level, liberalScience, marjorName, marjorSpecial, create_time, status from b_busi_wish_university_marjors_group
    </sql>

    <select id="selectBBusiWishUniversityMarjorsGroupList" parameterType="BBusiWishUniversityMarjorsGroup" resultMap="BBusiWishUniversityMarjorsGroupResult">
        <include refid="selectBBusiWishUniversityMarjorsGroupVo"/>
        <where>  
            <if test="universityId != null  and universityId != ''"> and universityId = #{universityId}</if>
            <if test="location != null  and location != ''"> and location = #{location}</if>
            <if test="level != null"> and level = #{level}</if>
            <if test="liberalScience != null "> and liberalScience = #{liberalScience}</if>
            <if test="marjorName != null  and marjorName != ''"> and marjorName like concat('%', #{marjorName}, '%')</if>
            <if test="marjorSpecial != null  and marjorSpecial != ''"> and marjorSpecial = #{marjorSpecial}</if>
            <if test="status != null "> and status = #{status}</if>
        </where>
    </select>
    
    <select id="selectBBusiWishUniversityMarjorsGroupByGroupId" parameterType="Long" resultMap="BBusiWishUniversityMarjorsGroupResult">
        <include refid="selectBBusiWishUniversityMarjorsGroupVo"/>
        where group_id = #{groupId}
    </select>
        
    <insert id="insertBBusiWishUniversityMarjorsGroup" parameterType="BBusiWishUniversityMarjorsGroup" useGeneratedKeys="true" keyProperty="groupId">
        insert into b_busi_wish_university_marjors_group
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="universityId != null">universityId,</if>
            <if test="location != null">location,</if>
            <if test="level != null">level,</if>
            <if test="liberalScience != null">liberalScience,</if>
            <if test="marjorName != null">marjorName,</if>
            <if test="marjorSpecial != null">marjorSpecial,</if>
            <if test="createTime != null">create_time,</if>
            <if test="status != null">status,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="universityId != null">#{universityId},</if>
            <if test="location != null">#{location},</if>
            <if test="level != null">#{level},</if>
            <if test="liberalScience != null">#{liberalScience},</if>
            <if test="marjorName != null">#{marjorName},</if>
            <if test="marjorSpecial != null">#{marjorSpecial},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="status != null">#{status},</if>
         </trim>
    </insert>

    <update id="updateBBusiWishUniversityMarjorsGroup" parameterType="BBusiWishUniversityMarjorsGroup">
        update b_busi_wish_university_marjors_group
        <trim prefix="SET" suffixOverrides=",">
            <if test="universityId != null">universityId = #{universityId},</if>
            <if test="location != null">location = #{location},</if>
            <if test="level != null">level = #{level},</if>
            <if test="liberalScience != null">liberalScience = #{liberalScience},</if>
            <if test="marjorName != null">marjorName = #{marjorName},</if>
            <if test="marjorSpecial != null">marjorSpecial = #{marjorSpecial},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="status != null">status = #{status},</if>
        </trim>
        where group_id = #{groupId}
    </update>

    <delete id="deleteBBusiWishUniversityMarjorsGroupByGroupId" parameterType="Long">
        delete from b_busi_wish_university_marjors_group where group_id = #{groupId}
    </delete>

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