<?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.SyMajorCareerProspectsMapper">
    
    <resultMap type="SyMajorCareerProspects" id="SyMajorCareerProspectsResult">
        <result property="id"    column="id"    />
        <result property="code"    column="code"    />
        <result property="jobDirection"    column="job_direction"    />
        <result property="vocationalDistribution"    column="vocational_distribution"    />
        <result property="industryDistribution"    column="industry_distribution"    />
        <result property="jobRegionDistribution"    column="job_region_distribution"    />
        <result property="averageSalary"    column="average_salary"    />
        <result property="description"    column="description"    />
        <result property="createTime"    column="create_time"    />
    </resultMap>

    <sql id="selectSyMajorCareerProspectsVo">
        select id, code, job_direction, vocational_distribution, industry_distribution, job_region_distribution, average_salary, description, create_time from sy_major_career_prospects
    </sql>

    <select id="selectSyMajorCareerProspectsList" parameterType="SyMajorCareerProspects" resultMap="SyMajorCareerProspectsResult">
        <include refid="selectSyMajorCareerProspectsVo"/>
        <where>  
            <if test="code != null  and code != ''"> and code = #{code}</if>
            <if test="jobDirection != null  and jobDirection != ''"> and job_direction = #{jobDirection}</if>
            <if test="vocationalDistribution != null  and vocationalDistribution != ''"> and vocational_distribution = #{vocationalDistribution}</if>
            <if test="industryDistribution != null  and industryDistribution != ''"> and industry_distribution = #{industryDistribution}</if>
            <if test="jobRegionDistribution != null  and jobRegionDistribution != ''"> and job_region_distribution = #{jobRegionDistribution}</if>
            <if test="averageSalary != null  and averageSalary != ''"> and average_salary = #{averageSalary}</if>
            <if test="description != null  and description != ''"> and description = #{description}</if>
        </where>
    </select>
    
    <select id="selectSyMajorCareerProspectsById" parameterType="Long" resultMap="SyMajorCareerProspectsResult">
        <include refid="selectSyMajorCareerProspectsVo"/>
        where id = #{id}
    </select>

    <select id="selectSyMajorCareerProspectsByCode" parameterType="String" resultMap="SyMajorCareerProspectsResult">
        <include refid="selectSyMajorCareerProspectsVo"/>
        where code = #{code}
    </select>
    <select id="selectSyMajorCareerProspectsByCodes" parameterType="List" resultMap="SyMajorCareerProspectsResult">
        <include refid="selectSyMajorCareerProspectsVo"/>
        where code in
        <foreach collection="list" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
    </select>
        
    <insert id="insertSyMajorCareerProspects" parameterType="SyMajorCareerProspects" useGeneratedKeys="true" keyProperty="id">
        insert into sy_major_career_prospects
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="code != null">code,</if>
            <if test="jobDirection != null">job_direction,</if>
            <if test="vocationalDistribution != null">vocational_distribution,</if>
            <if test="industryDistribution != null">industry_distribution,</if>
            <if test="jobRegionDistribution != null">job_region_distribution,</if>
            <if test="averageSalary != null">average_salary,</if>
            <if test="description != null">description,</if>
            <if test="createTime != null">create_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="code != null">#{code},</if>
            <if test="jobDirection != null">#{jobDirection},</if>
            <if test="vocationalDistribution != null">#{vocationalDistribution},</if>
            <if test="industryDistribution != null">#{industryDistribution},</if>
            <if test="jobRegionDistribution != null">#{jobRegionDistribution},</if>
            <if test="averageSalary != null">#{averageSalary},</if>
            <if test="description != null">#{description},</if>
            <if test="createTime != null">#{createTime},</if>
         </trim>
    </insert>

    <update id="updateSyMajorCareerProspects" parameterType="SyMajorCareerProspects">
        update sy_major_career_prospects
        <trim prefix="SET" suffixOverrides=",">
            <if test="code != null">code = #{code},</if>
            <if test="jobDirection != null">job_direction = #{jobDirection},</if>
            <if test="vocationalDistribution != null">vocational_distribution = #{vocationalDistribution},</if>
            <if test="industryDistribution != null">industry_distribution = #{industryDistribution},</if>
            <if test="jobRegionDistribution != null">job_region_distribution = #{jobRegionDistribution},</if>
            <if test="averageSalary != null">average_salary = #{averageSalary},</if>
            <if test="description != null">description = #{description},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteSyMajorCareerProspectsById" parameterType="Long">
        delete from sy_major_career_prospects where id = #{id}
    </delete>

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