<?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.unis.homePage.modular.hmpartyhistoryedu.mapper.BizHmPartyHistoryEduMapper">

    <select id="findPage" resultType="java.util.Map">
        select id,carousel,title,publishTime,source,announcementContent, attachments,status,type,createUser from (
            SELECT
            a.id id,
            a.carousel carousel,
            a.title title,
            DATE_FORMAT(a.publish_time, '%Y-%m-%d %H:%i:%s') publishTime,
            a.source source,
            a.announcement_content announcementContent,
            a.attachments attachments,
            a.status status,
            '1' type,
            a.create_user createUser
            FROM
            biz_hm_party_history_edu a
            UNION
            SELECT
            b.id id,
            b.carousel_image carousel,
            '' title,
            DATE_FORMAT(b.create_time, '%Y-%m-%d %H:%i:%s') publishTime,
            '' source,
            '' announcementContent,
            '' attachments,
            b.status status,
            '2' type,
            b.create_user createUser
            FROM
            biz_hm_carousel_config b
        ) a
        <if test="ew.sqlSegment != null and ew.sqlSegment != ''">
            where  ${ew.sqlSegment}
        </if>
        order  by publishTime desc
    </select>
</mapper>