<?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.sy.mapper.SyOccupationInterstMajorMapper">
    
    <resultMap type="SyOccupationInterstMajor" id="SyOccupationInterstMajorResult">
        <result property="id"    column="id"    />
        <result property="matchCode"    column="match_code"    />
        <result property="majorCategoryCode"    column="major_category_code"    />
        <result property="majorCategory"    column="major_category"    />
    </resultMap>

    <sql id="selectSyOccupationInterstMajorVo">
        select id, match_code, major_category_code, major_category from sy_occupation_interst_major
    </sql>

    <select id="selectSyOccupationInterstMajorList" parameterType="SyOccupationInterstMajor" resultMap="SyOccupationInterstMajorResult">
        <include refid="selectSyOccupationInterstMajorVo"/>
        <where>  
            <if test="matchCode != null  and matchCode != ''"> and match_code = #{matchCode}</if>
            <if test="majorCategoryCode != null  and majorCategoryCode != ''"> and major_category_code = #{majorCategoryCode}</if>
            <if test="majorCategory != null  and majorCategory != ''"> and major_category = #{majorCategory}</if>
        </where>
    </select>
    
    <select id="selectSyOccupationInterstMajorById" parameterType="Long" resultMap="SyOccupationInterstMajorResult">
        <include refid="selectSyOccupationInterstMajorVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertSyOccupationInterstMajor" parameterType="SyOccupationInterstMajor" useGeneratedKeys="true" keyProperty="id">
        insert into sy_occupation_interst_major
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="matchCode != null">match_code,</if>
            <if test="majorCategoryCode != null">major_category_code,</if>
            <if test="majorCategory != null">major_category,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="matchCode != null">#{matchCode},</if>
            <if test="majorCategoryCode != null">#{majorCategoryCode},</if>
            <if test="majorCategory != null">#{majorCategory},</if>
         </trim>
    </insert>

    <update id="updateSyOccupationInterstMajor" parameterType="SyOccupationInterstMajor">
        update sy_occupation_interst_major
        <trim prefix="SET" suffixOverrides=",">
            <if test="matchCode != null">match_code = #{matchCode},</if>
            <if test="majorCategoryCode != null">major_category_code = #{majorCategoryCode},</if>
            <if test="majorCategory != null">major_category = #{majorCategory},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteSyOccupationInterstMajorById" parameterType="Long">
        delete from sy_occupation_interst_major where id = #{id}
    </delete>

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