<?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.SyVocationalPostDetailMapper">
    
    <resultMap type="SyVocationalPostDetail" id="SyVocationalPostDetailResult">
        <result property="id"    column="id"    />
        <result property="name"    column="name"    />
        <result property="experience"    column="experience"    />
        <result property="salary"    column="salary"    />
        <result property="edu"    column="edu"    />
        <result property="exp"    column="exp"    />
        <result property="demand"    column="demand"    />
        <result property="industrySalary"    column="industry_salary"    />
        <result property="citySalary"    column="city_salary"    />
        <result property="salaryAvg"    column="salary_avg"    />
        <result property="sampleDesc"    column="sample_desc"    />
        <result property="vocationalSource"    column="vocational_source"    />
        <result property="salarySource"    column="salary_source"    />
    </resultMap>

    <sql id="selectSyVocationalPostDetailVo">
        select id, name, experience, salary, edu, exp, demand, industry_salary, city_salary, salary_avg, sample_desc, vocational_source, salary_source from sy_vocational_post_detail
    </sql>

    <select id="selectSyVocationalPostDetailList" parameterType="SyVocationalPostDetail" resultMap="SyVocationalPostDetailResult">
        <include refid="selectSyVocationalPostDetailVo"/>
        <where>  
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
            <if test="experience != null  and experience != ''"> and experience = #{experience}</if>
            <if test="salary != null  and salary != ''"> and salary = #{salary}</if>
            <if test="edu != null  and edu != ''"> and edu = #{edu}</if>
            <if test="exp != null  and exp != ''"> and exp = #{exp}</if>
            <if test="demand != null  and demand != ''"> and demand = #{demand}</if>
            <if test="industrySalary != null  and industrySalary != ''"> and industry_salary = #{industrySalary}</if>
            <if test="citySalary != null  and citySalary != ''"> and city_salary = #{citySalary}</if>
            <if test="salaryAvg != null  and salaryAvg != ''"> and salary_avg = #{salaryAvg}</if>
            <if test="sampleDesc != null  and sampleDesc != ''"> and sample_desc = #{sampleDesc}</if>
            <if test="vocationalSource != null  and vocationalSource != ''"> and vocational_source = #{vocationalSource}</if>
            <if test="salarySource != null  and salarySource != ''"> and salary_source = #{salarySource}</if>
        </where>
    </select>
    
    <select id="selectSyVocationalPostDetailById" parameterType="Long" resultMap="SyVocationalPostDetailResult">
        <include refid="selectSyVocationalPostDetailVo"/>
        where id = #{id}
    </select>


    <select id="selectSyVocationalPostDetailByName" parameterType="String" resultMap="SyVocationalPostDetailResult">
        <include refid="selectSyVocationalPostDetailVo"/>
        where name = #{name}
    </select>
        
    <insert id="insertSyVocationalPostDetail" parameterType="SyVocationalPostDetail" useGeneratedKeys="true" keyProperty="id">
        insert into sy_vocational_post_detail
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="name != null">name,</if>
            <if test="experience != null">experience,</if>
            <if test="salary != null">salary,</if>
            <if test="edu != null">edu,</if>
            <if test="exp != null">exp,</if>
            <if test="demand != null">demand,</if>
            <if test="industrySalary != null">industry_salary,</if>
            <if test="citySalary != null">city_salary,</if>
            <if test="salaryAvg != null">salary_avg,</if>
            <if test="sampleDesc != null">sample_desc,</if>
            <if test="vocationalSource != null">vocational_source,</if>
            <if test="salarySource != null">salary_source,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="name != null">#{name},</if>
            <if test="experience != null">#{experience},</if>
            <if test="salary != null">#{salary},</if>
            <if test="edu != null">#{edu},</if>
            <if test="exp != null">#{exp},</if>
            <if test="demand != null">#{demand},</if>
            <if test="industrySalary != null">#{industrySalary},</if>
            <if test="citySalary != null">#{citySalary},</if>
            <if test="salaryAvg != null">#{salaryAvg},</if>
            <if test="sampleDesc != null">#{sampleDesc},</if>
            <if test="vocationalSource != null">#{vocationalSource},</if>
            <if test="salarySource != null">#{salarySource},</if>
         </trim>
    </insert>

    <update id="updateSyVocationalPostDetail" parameterType="SyVocationalPostDetail">
        update sy_vocational_post_detail
        <trim prefix="SET" suffixOverrides=",">
            <if test="name != null">name = #{name},</if>
            <if test="experience != null">experience = #{experience},</if>
            <if test="salary != null">salary = #{salary},</if>
            <if test="edu != null">edu = #{edu},</if>
            <if test="exp != null">exp = #{exp},</if>
            <if test="demand != null">demand = #{demand},</if>
            <if test="industrySalary != null">industry_salary = #{industrySalary},</if>
            <if test="citySalary != null">city_salary = #{citySalary},</if>
            <if test="salaryAvg != null">salary_avg = #{salaryAvg},</if>
            <if test="sampleDesc != null">sample_desc = #{sampleDesc},</if>
            <if test="vocationalSource != null">vocational_source = #{vocationalSource},</if>
            <if test="salarySource != null">salary_source = #{salarySource},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteSyVocationalPostDetailById" parameterType="Long">
        delete from sy_vocational_post_detail where id = #{id}
    </delete>

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