<?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.web.work.mapper.NoticeMapper">

    <select id="selectList" resultType="com.ruoyi.web.work.domain.Notice">
        select id,type,title,state,top,create_time from tb_notice
        <where>
            <if test="title != null  and title != ''"> and title like concat('%', #{title}, '%')</if>
            <if test="state != null "> and state = #{state}</if>
            <if test="type != null "> and type = #{type}</if>
        </where>
        ORDER BY top DESC,id DESC
    </select>
    <select id="homeList" resultType="com.ruoyi.web.work.domain.Notice">
        SELECT id,title,create_time FROM tb_notice WHERE state=0 AND type = #{type} ORDER BY top DESC,id DESC LIMIT 5
    </select>

    <select id="selectByTitle" resultType="com.ruoyi.web.work.domain.Notice">
        SELECT * FROM tb_notice WHERE title = #{title}
    </select>

</mapper>
