<?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.SyVocationalHitsLackMapper">
    
    <resultMap type="SyVocationalHitsLack" id="SyVocationalHitsLackResult">
        <result property="id"    column="id"    />
        <result property="code"    column="code"    />
        <result property="name"    column="name"    />
        <result property="hits"    column="hits"    />
        <result property="level"    column="level"    />
        <result property="levels"    column="levels"    />
        <result property="summary"    column="summary"    />
        <result property="createTime"    column="create_time"    />
        <result property="type"    column="type"    />
    </resultMap>

    <sql id="selectSyVocationalHitsLackVo">
        select id, code, name, hits, level, levels, summary, create_time, type from sy_vocational_hits_lack
    </sql>

    <select id="selectSyVocationalHitsLackList" parameterType="SyVocationalHitsLack" resultMap="SyVocationalHitsLackResult">
        <include refid="selectSyVocationalHitsLackVo"/>
        where 1=1
            <if test="code != null  and code != ''"> and code = #{code}</if>
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
            <if test="hits != null  and hits != ''"> and hits = #{hits}</if>
            <if test="level != null "> and level = #{level}</if>
            <if test="levels != null  and levels != ''"> and levels = #{levels}</if>
            <if test="summary != null  and summary != ''"> and summary = #{summary}</if>
            <if test="type != null "> and type = #{type}</if>
        order by hits desc
    </select>
    
    <select id="selectSyVocationalHitsLackById" parameterType="Long" resultMap="SyVocationalHitsLackResult">
        <include refid="selectSyVocationalHitsLackVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertSyVocationalHitsLack" parameterType="SyVocationalHitsLack" useGeneratedKeys="true" keyProperty="id">
        insert into sy_vocational_hits_lack
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="code != null">code,</if>
            <if test="name != null">name,</if>
            <if test="hits != null">hits,</if>
            <if test="level != null">level,</if>
            <if test="levels != null">levels,</if>
            <if test="summary != null">summary,</if>
            <if test="createTime != null">create_time,</if>
            <if test="type != null">type,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="code != null">#{code},</if>
            <if test="name != null">#{name},</if>
            <if test="hits != null">#{hits},</if>
            <if test="level != null">#{level},</if>
            <if test="levels != null">#{levels},</if>
            <if test="summary != null">#{summary},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="type != null">#{type},</if>
         </trim>
    </insert>

    <update id="updateSyVocationalHitsLack" parameterType="SyVocationalHitsLack">
        update sy_vocational_hits_lack
        <trim prefix="SET" suffixOverrides=",">
            <if test="code != null">code = #{code},</if>
            <if test="name != null">name = #{name},</if>
            <if test="hits != null">hits = #{hits},</if>
            <if test="level != null">level = #{level},</if>
            <if test="levels != null">levels = #{levels},</if>
            <if test="summary != null">summary = #{summary},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="type != null">type = #{type},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteSyVocationalHitsLackById" parameterType="Long">
        delete from sy_vocational_hits_lack where id = #{id}
    </delete>

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