<?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.SyVocationalOverviewMapper">
    
    <resultMap type="SyVocationalOverview" id="SyVocationalOverviewResult">
        <result property="id"    column="id"    />
        <result property="code"    column="code"    />
        <result property="name"    column="name"    />
        <result property="description"    column="description"    />
        <result property="postJobs"    column="post_jobs"    />
        <result property="postMajors"    column="post_majors"    />
        <result property="jobs"    column="jobs"    />
        <result property="hits"    column="hits"    />
        <result property="level"    column="level"    />
        <result property="levelName"    column="level_name"    />
        <result property="levels"    column="levels"    />
        <result property="status"    column="status"    />
        <result property="summary"    column="summary"    />
        <result property="tags"    column="tags"    />
        <result property="createTime"    column="create_time"    />
    </resultMap>

    <sql id="selectSyVocationalOverviewVo">
        select id, code, name, description, post_jobs, post_majors, jobs, hits, level, level_name, levels, status, summary, tags, create_time from sy_vocational_overview
    </sql>

    <select id="selectSyVocationalOverviewList" parameterType="SyVocationalOverview" resultMap="SyVocationalOverviewResult">
        <include refid="selectSyVocationalOverviewVo"/>
        <where>  
            <if test="code != null  and code != ''"> and code = #{code}</if>
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
            <if test="description != null  and description != ''"> and description = #{description}</if>
            <if test="postJobs != null  and postJobs != ''"> and post_jobs = #{postJobs}</if>
            <if test="postMajors != null  and postMajors != ''"> and post_majors = #{postMajors}</if>
            <if test="jobs != null  and jobs != ''"> and jobs = #{jobs}</if>
            <if test="hits != null  and hits != ''"> and hits = #{hits}</if>
            <if test="level != null "> and level = #{level}</if>
            <if test="levelName != null  and levelName != ''"> and level_name like concat('%', #{levelName}, '%')</if>
            <if test="levels != null  and levels != ''"> and levels = #{levels}</if>
            <if test="status != null "> and status = #{status}</if>
            <if test="summary != null  and summary != ''"> and summary = #{summary}</if>
            <if test="tags != null  and tags != ''"> and tags = #{tags}</if>
        </where>
    </select>
    
    <select id="selectSyVocationalOverviewByCode" parameterType="String" resultMap="SyVocationalOverviewResult">
        <include refid="selectSyVocationalOverviewVo"/>
        where code = #{code}
    </select>

    <select id="selectSyVocationalOverviewById" parameterType="Long" resultMap="SyVocationalOverviewResult">
        <include refid="selectSyVocationalOverviewVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertSyVocationalOverview" parameterType="SyVocationalOverview" useGeneratedKeys="true" keyProperty="id">
        insert into sy_vocational_overview
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="code != null">code,</if>
            <if test="name != null">name,</if>
            <if test="description != null">description,</if>
            <if test="postJobs != null">post_jobs,</if>
            <if test="postMajors != null">post_majors,</if>
            <if test="jobs != null">jobs,</if>
            <if test="hits != null">hits,</if>
            <if test="level != null">level,</if>
            <if test="levelName != null">level_name,</if>
            <if test="levels != null">levels,</if>
            <if test="status != null">status,</if>
            <if test="summary != null">summary,</if>
            <if test="tags != null">tags,</if>
            <if test="createTime != null">create_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="code != null">#{code},</if>
            <if test="name != null">#{name},</if>
            <if test="description != null">#{description},</if>
            <if test="postJobs != null">#{postJobs},</if>
            <if test="postMajors != null">#{postMajors},</if>
            <if test="jobs != null">#{jobs},</if>
            <if test="hits != null">#{hits},</if>
            <if test="level != null">#{level},</if>
            <if test="levelName != null">#{levelName},</if>
            <if test="levels != null">#{levels},</if>
            <if test="status != null">#{status},</if>
            <if test="summary != null">#{summary},</if>
            <if test="tags != null">#{tags},</if>
            <if test="createTime != null">#{createTime},</if>
         </trim>
    </insert>

    <update id="updateSyVocationalOverview" parameterType="SyVocationalOverview">
        update sy_vocational_overview
        <trim prefix="SET" suffixOverrides=",">
            <if test="code != null">code = #{code},</if>
            <if test="name != null">name = #{name},</if>
            <if test="description != null">description = #{description},</if>
            <if test="postJobs != null">post_jobs = #{postJobs},</if>
            <if test="postMajors != null">post_majors = #{postMajors},</if>
            <if test="jobs != null">jobs = #{jobs},</if>
            <if test="hits != null">hits = #{hits},</if>
            <if test="level != null">level = #{level},</if>
            <if test="levelName != null">level_name = #{levelName},</if>
            <if test="levels != null">levels = #{levels},</if>
            <if test="status != null">status = #{status},</if>
            <if test="summary != null">summary = #{summary},</if>
            <if test="tags != null">tags = #{tags},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteSyVocationalOverviewById" parameterType="Long">
        delete from sy_vocational_overview where id = #{id}
    </delete>

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