<?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.BBusiMbtiMajorMapper">
    
    <resultMap type="BBusiMbtiMajor" id="BBusiMbtiMajorResult">
        <result property="id"    column="id"    />
        <result property="code"    column="code"    />
        <result property="category"    column="category"    />
        <result property="major"    column="major"    />
    </resultMap>

    <sql id="selectBBusiMbtiMajorVo">
        select id, code, category, major from b_busi_mbti_major
    </sql>

    <select id="selectBBusiMbtiMajorList" parameterType="BBusiMbtiMajor" resultMap="BBusiMbtiMajorResult">
        <include refid="selectBBusiMbtiMajorVo"/>
        <where>  
            <if test="code != null  and code != ''"> and code = #{code}</if>
            <if test="category != null  and category != ''"> and category = #{category}</if>
            <if test="major != null  and major != ''"> and major = #{major}</if>
        </where>
    </select>
    
    <select id="selectBBusiMbtiMajorById" parameterType="Long" resultMap="BBusiMbtiMajorResult">
        <include refid="selectBBusiMbtiMajorVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertBBusiMbtiMajor" parameterType="BBusiMbtiMajor" useGeneratedKeys="true" keyProperty="id">
        insert into b_busi_mbti_major
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="code != null and code != ''">code,</if>
            <if test="category != null and category != ''">category,</if>
            <if test="major != null and major != ''">major,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="code != null and code != ''">#{code},</if>
            <if test="category != null and category != ''">#{category},</if>
            <if test="major != null and major != ''">#{major},</if>
         </trim>
    </insert>

    <update id="updateBBusiMbtiMajor" parameterType="BBusiMbtiMajor">
        update b_busi_mbti_major
        <trim prefix="SET" suffixOverrides=",">
            <if test="code != null and code != ''">code = #{code},</if>
            <if test="category != null and category != ''">category = #{category},</if>
            <if test="major != null and major != ''">major = #{major},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteBBusiMbtiMajorById" parameterType="Long">
        delete from b_busi_mbti_major where id = #{id}
    </delete>

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