<?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.EduNoticeBuyMapper">
    <resultMap id="BaseResultMap" type="com.yida.data.common.core.entity.notice.EduNoticeBuy">
        <!--@mbg.generated-->
        <!--@Table edu_notice_buy-->
        <id column="id" property="id"/>
        <result column="create_date" property="createDate"/>
        <result column="create_id" property="createId"/>
        <result column="update_date" property="updateDate"/>
        <result column="update_id" property="updateId"/>
<!--        <result column="title" property="title"/>-->
<!--        <result column="cover_url" property="coverUrl"/>-->
        <result column="content" property="content"/>
        <result column="school_id" property="schoolId"/>
        <result column="school_name" property="schoolName"/>
        <result column="send_date" property="sendDate"/>
        <result column="status" property="status"/>
    </resultMap>
    <sql id="Base_Column_List">
        <!--@mbg.generated-->
        id, create_date, create_id, update_date, update_id, title, cover_url, content, school_id,
        school_name, send_date, `status`
    </sql>

    <select id="selectBuyNoticePage" resultType="com.yida.data.school.vo.news.BuyNoticePageVO">
        select a.id,
        school_name,
        title,
        send_date,
        status,
        create_name,
        create_date
        from edu_notice_buy a
        <where>
            a.del_flag=0
            <if test="schoolIds != null and schoolIds.size > 0">
                and a.school_id in
                <foreach collection="schoolIds" open="(" close=")" separator="," item="item">
                    #{item}
                </foreach>
            </if>
            <if test="status != null">
                and a.status=#{status}
            </if>
            <if test="title != null and title != ''">
                and a.title like concat('%',#{title},'%')
            </if>
            <if test="sendDate != null and sendDate != ''">
                and a.send_date =#{sendDate}
            </if>
        </where>
        order by create_date desc
    </select>
</mapper>
