<?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.api.app.dao.butler.AppAnnouncementDao">
    <select id="list" parameterType="com.api.model.app.TypeAndNowDate" resultType="com.api.vo.app.AppAnnouncementVo">
        select *,(case scheduled_release_time is null when true then create_date else scheduled_release_time end) as release_time from sys_announcement_management
        where #{nowDate} <![CDATA[ > ]]> (case scheduled_release_time is null when true then create_date else scheduled_release_time end) and push_object in (3,#{type})
        order by (case scheduled_release_time is null when true then create_date else scheduled_release_time end) DESC
    </select>

    <select id="findById" parameterType="com.api.model.app.TypeAndAnnouncementId" resultType="com.api.vo.app.AppAnnouncementDetailVo">
        select *,(case scheduled_release_time is null when true then create_date else scheduled_release_time end) as release_time from sys_announcement_management where id = #{announcementId} and push_object in (3,#{type})
    </select>
</mapper>