From c81aaa34b01cf9ea44475e97dd8c1bae1cec2aaf Mon Sep 17 00:00:00 2001 From: wangliwen Date: Wed, 22 Jun 2022 09:49:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=91=E7=9A=84=E9=80=9A=E7=9F=A5=E6=9D=A5?= =?UTF-8?q?=E6=BA=90=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../notice/service/impl/SysNoticeServiceImpl.java | 13 ++++++++++--- .../main/resources/mapper/notice/SysNoticeDao.xml | 3 +++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/notice/service/impl/SysNoticeServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/notice/service/impl/SysNoticeServiceImpl.java index 9eab13e2..e1dffe8b 100644 --- a/renren-admin/src/main/java/io/renren/modules/notice/service/impl/SysNoticeServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/notice/service/impl/SysNoticeServiceImpl.java @@ -44,10 +44,17 @@ public class SysNoticeServiceImpl extends CrudServiceImpl getWrapper(Map params) { - String type = (String) params.get("type"); - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq(StringUtils.isNotBlank(type), "type", type); + params.keySet().stream().filter(index -> null != params.get(index)).forEach(index -> { + switch (index) { + case "type": + wrapper.eq(StringUtils.isNotBlank((String) params.get("type")), "type", (String) params.get("type")); + break; + case "from": + wrapper.eq(StringUtils.isNotBlank((String) params.get("from")), "from", (String) params.get("from")); + break; + } + }); wrapper.orderByDesc(Constant.CREATE_DATE); return wrapper; } diff --git a/renren-admin/src/main/resources/mapper/notice/SysNoticeDao.xml b/renren-admin/src/main/resources/mapper/notice/SysNoticeDao.xml index ddcb68e2..538ed962 100644 --- a/renren-admin/src/main/resources/mapper/notice/SysNoticeDao.xml +++ b/renren-admin/src/main/resources/mapper/notice/SysNoticeDao.xml @@ -16,6 +16,9 @@ AND read_status = #{readStatus} + + AND from = #{from} + order by t2.create_date desc \ No newline at end of file