<?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.NewsMapper">
    <select id="selectList" resultType="com.ruoyi.web.work.domain.News">
        select id,title,state,type,top,create_time from tb_news
        <where>
            <if test="title != null  and title != ''"> and title like concat('%', #{title}, '%')</if>
            <if test="type != null  and type != ''"> and type = #{type}</if>
            <if test="state != null "> and state = #{state}</if>
        </where>
        ORDER BY top DESC,id DESC
    </select>

    <select id="homeList" resultType="com.ruoyi.web.work.domain.News">
        SELECT id,title,create_time FROM tb_news WHERE state = 0 ORDER BY id DESC LIMIT 5
    </select>

</mapper>