diff --git a/renren-admin/src/main/java/io/renren/modules/notice/dao/SysNoticeDao.java b/renren-admin/src/main/java/io/renren/modules/notice/dao/SysNoticeDao.java index 1438a4b9..216577fe 100644 --- a/renren-admin/src/main/java/io/renren/modules/notice/dao/SysNoticeDao.java +++ b/renren-admin/src/main/java/io/renren/modules/notice/dao/SysNoticeDao.java @@ -23,4 +23,9 @@ public interface SysNoticeDao extends BaseDao { * 获取我的通知列表 */ List getMyNoticeList(Map params); + + /** + * 更新 apply state + */ + int updateApplyState(Long userId, Integer applyState, String applyId); } \ No newline at end of file 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 45b4f6bf..17ba31e3 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 @@ -110,13 +110,7 @@ public class SysNoticeServiceImpl extends CrudServiceImpl list = this.list(params); - list.stream().filter(it -> it.getReceiverTypeIds().contains(SecurityUser.getUserId().toString())).forEach(it -> { - it.setApplyState(state); - this.update(it); - }); + baseDao.updateApplyState(SecurityUser.getUserId(), state, id); } @Override diff --git a/renren-admin/src/main/resources/mapper/notice/SysNoticeDao.xml b/renren-admin/src/main/resources/mapper/notice/SysNoticeDao.xml index c2182de8..a8fedc1c 100644 --- a/renren-admin/src/main/resources/mapper/notice/SysNoticeDao.xml +++ b/renren-admin/src/main/resources/mapper/notice/SysNoticeDao.xml @@ -23,4 +23,8 @@ order by t2.create_date desc + + + update sys_notice set apply_state = #{applyState} where receiver_type_ids like concat('%', #{userId}, '%') and apply_id=#{applyId} + \ No newline at end of file