<?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.syzy.mapper.BBusiWishUniversitiesSubjectMapper">
    
    <resultMap type="BBusiWishUniversitiesSubject" id="BBusiWishUniversitiesSubjectResult">
        <result property="id"    column="id"    />
        <result property="collegeCode"    column="collegeCode"    />
        <result property="dataType"    column="dataType"    />
        <result property="subjects"    column="subjects"    />
        <result property="subjectCount"    column="subjectCount"    />
        <result property="evaluations"    column="evaluations"    />
        <result property="category"    column="category"    />
        <result property="typeName"    column="typeName"    />
        <result property="createTime"    column="createTime"    />
        <result property="updateTime"    column="updateTime"    />
    </resultMap>

    <sql id="selectBBusiWishUniversitiesSubjectVo">
        select id, collegeCode, dataType, subjects, subjectCount, evaluations, category, typeName, createTime, updateTime from b_busi_wish_universities_subject
    </sql>

    <select id="selectBBusiWishUniversitiesSubjectList" parameterType="BBusiWishUniversitiesSubject" resultMap="BBusiWishUniversitiesSubjectResult">
        <include refid="selectBBusiWishUniversitiesSubjectVo"/>
        <where>  
            <if test="collegeCode != null  and collegeCode != ''"> and collegeCode = #{collegeCode}</if>
            <if test="dataType != null  and dataType != ''"> and dataType = #{dataType}</if>
            <if test="subjects != null  and subjects != ''"> and subjects = #{subjects}</if>
            <if test="subjectCount != null "> and subjectCount = #{subjectCount}</if>
            <if test="evaluations != null  and evaluations != ''"> and evaluations = #{evaluations}</if>
            <if test="category != null  and category != ''"> and category = #{category}</if>
            <if test="typeName != null  and typeName != ''"> and typeName like concat('%', #{typeName}, '%')</if>
            <if test="createTime != null "> and createTime = #{createTime}</if>
            <if test="updateTime != null "> and updateTime = #{updateTime}</if>
        </where>
    </select>
    
    <select id="selectBBusiWishUniversitiesSubjectById" parameterType="String" resultMap="BBusiWishUniversitiesSubjectResult">
        <include refid="selectBBusiWishUniversitiesSubjectVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertBBusiWishUniversitiesSubject" parameterType="BBusiWishUniversitiesSubject">
        insert into b_busi_wish_universities_subject
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="collegeCode != null and collegeCode != ''">collegeCode,</if>
            <if test="dataType != null">dataType,</if>
            <if test="subjects != null">subjects,</if>
            <if test="subjectCount != null">subjectCount,</if>
            <if test="evaluations != null">evaluations,</if>
            <if test="category != null">category,</if>
            <if test="typeName != null">typeName,</if>
            <if test="createTime != null">createTime,</if>
            <if test="updateTime != null">updateTime,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="collegeCode != null and collegeCode != ''">#{collegeCode},</if>
            <if test="dataType != null">#{dataType},</if>
            <if test="subjects != null">#{subjects},</if>
            <if test="subjectCount != null">#{subjectCount},</if>
            <if test="evaluations != null">#{evaluations},</if>
            <if test="category != null">#{category},</if>
            <if test="typeName != null">#{typeName},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>

    <update id="updateBBusiWishUniversitiesSubject" parameterType="BBusiWishUniversitiesSubject">
        update b_busi_wish_universities_subject
        <trim prefix="SET" suffixOverrides=",">
            <if test="collegeCode != null and collegeCode != ''">collegeCode = #{collegeCode},</if>
            <if test="dataType != null">dataType = #{dataType},</if>
            <if test="subjects != null">subjects = #{subjects},</if>
            <if test="subjectCount != null">subjectCount = #{subjectCount},</if>
            <if test="evaluations != null">evaluations = #{evaluations},</if>
            <if test="category != null">category = #{category},</if>
            <if test="typeName != null">typeName = #{typeName},</if>
            <if test="createTime != null">createTime = #{createTime},</if>
            <if test="updateTime != null">updateTime = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteBBusiWishUniversitiesSubjectById" parameterType="String">
        delete from b_busi_wish_universities_subject where id = #{id}
    </delete>

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