rtos-mini-service4/mapper/target/classes/mappers/admin/AnnouncementAdminMapper.xml

61 lines
2.0 KiB
XML
Raw Normal View History

2024-06-13 15:27:54 +08:00
<?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.haitongauto.mapper.admin.AnnouncementAdminMapper">
<!--获取发布人员(作者)去重列表-->
<select id="getAuthorList" resultType="String">
select
distinct author
from applet_announcement
where is_del=0
</select>
<!--根据特定条件查询历史公告:(tilKeywords, dateStart,dateEnd,sort,author);-->
<select id="AnnouncementListForCondition" resultType="com.haitongauto.models.pojo.Announcement">
select
id,
title,
abstracts,
sort,
announcement,
announcement_text,
author,
reading_volume,
create_time,
update_time,
is_del
from applet_announcement
where is_del=0
<if test="tilKeywords!=null and tilKeywords != ''">
and title like concat('%',#{tilKeywords},'%')
</if>
<if test="dateStart!=null and dateStart!=null">
and to_char(update_time,'yyyy-mm-dd')&gt;=#{dateStart}
</if>
<if test="dateEnd!=null and dateEnd!=null">
and to_char(update_time,'yyyy-mm-dd')&lt;=#{dateEnd}
</if>
<if test="sort!=null">
and sort =#{sort}
</if>
<if test="list!=null">
and author in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
order by create_time desc
</select>
<!--根据特定条件查询历史公告:(tilKeywords, dateStart,dateEnd,sort,author);-->
<select id="AnnouncementListForWeek" resultType="com.haitongauto.models.pojo.Announcement">
select
*
from applet_announcement
where is_del=0
and create_time >= now() - interval '1 week'
order by create_time desc
</select>
</mapper>