<?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.yida.data.school.news.mapper.EduSchoolMatterMapper">
    <select id="listMatterPage" resultType="com.yida.data.school.vo.index.MatterPageInfoVO">
        select distinct esm.id,
        esm.name,
        esm.url,
        esm.type,
        esm.cover_url,
        esm.create_date
        from edu_school_matter esm
        left join edu_school_matter_matter_group esmmg on esm.id = esmmg.matter_id
        <where>
            esm.del_flag=0
            and esm.type=#{type}
            and esm.school_id=#{schoolId}
            <if test="keyword != null and keyword != ''">
                and esm.name like concat('%',#{keyword},'%')
            </if>
            <if test="groupId != null">
                and esmmg.matter_group_id=#{groupId}
            </if>
        </where>
        order by esm.create_date desc
    </select>
</mapper>
