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