<?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.project.benyi.mapper.ByRecruitstudentsNoticeMapper">

    <resultMap type="ByRecruitstudentsNotice" id="ByRecruitstudentsNoticeResult">
        <result property="id" column="id"/>
        <result property="title" column="title"/>
        <result property="content" column="content"/>
        <result property="type" column="type"/>
        <result property="schoolid" column="schoolid"/>
        <result property="createTime" column="create_time"/>
    </resultMap>

    <sql id="selectByRecruitstudentsNoticeVo">
        select id, title, content, type, schoolid, create_time from by_recruitstudents_notice
    </sql>

    <select id="selectByRecruitstudentsNoticeList" parameterType="ByRecruitstudentsNotice"
            resultMap="ByRecruitstudentsNoticeResult">
        <include refid="selectByRecruitstudentsNoticeVo"/>
        where type='1'
        <if test="title != null  and title != ''">and title like concat('%', #{title}, '%')</if>
        <if test="content != null  and content != ''">and content = #{content}</if>
        <if test="type != null  and type != ''">and type = #{type}</if>
        <if test="schoolid != null ">or schoolid = #{schoolid}</if>
    </select>

    <select id="selectByRecruitstudentsNoticeById" parameterType="Long" resultMap="ByRecruitstudentsNoticeResult">
        <include refid="selectByRecruitstudentsNoticeVo"/>
        where id = #{id}
    </select>

    <insert id="insertByRecruitstudentsNotice" parameterType="ByRecruitstudentsNotice" useGeneratedKeys="true"
            keyProperty="id">
        insert into by_recruitstudents_notice
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="title != null  and title != ''">title,</if>
            <if test="content != null  and content != ''">content,</if>
            <if test="type != null  and type != ''">type,</if>
            <if test="schoolid != null ">schoolid,</if>
            <if test="createTime != null ">create_time,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="title != null  and title != ''">#{title},</if>
            <if test="content != null  and content != ''">#{content},</if>
            <if test="type != null  and type != ''">#{type},</if>
            <if test="schoolid != null ">#{schoolid},</if>
            <if test="createTime != null ">#{createTime},</if>
        </trim>
    </insert>

    <update id="updateByRecruitstudentsNotice" parameterType="ByRecruitstudentsNotice">
        update by_recruitstudents_notice
        <trim prefix="SET" suffixOverrides=",">
            <if test="title != null  and title != ''">title = #{title},</if>
            <if test="content != null  and content != ''">content = #{content},</if>
            <if test="type != null  and type != ''">type = #{type},</if>
            <if test="schoolid != null ">schoolid = #{schoolid},</if>
            <if test="createTime != null ">create_time = #{createTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteByRecruitstudentsNoticeById" parameterType="Long">
        delete from by_recruitstudents_notice where id = #{id}
    </delete>

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

</mapper>