通知中心修改

This commit is contained in:
张松 2025-04-12 10:31:17 +08:00
parent 4c15fc12d2
commit 4b9587bae5
3 changed files with 4 additions and 2 deletions

View File

@ -50,7 +50,7 @@ public class SyncNoticeController {
/**
* 已读消息
* 已读消息, 不传递已读所有
* @return 是否成功
*/
@PutMapping("/read")

View File

@ -13,6 +13,5 @@ public class SyncNoticeReadDTO {
/**
* 消息id
*/
@NotEmpty
private List<Long> noticeIdList;
}

View File

@ -83,6 +83,9 @@ public class SyncNoticeServiceImpl extends ServiceImpl<SyncNoticeMapper, SyncNot
@Override
public Boolean read(Long shopId, SyncNoticeReadDTO syncNoticeReadDTO) {
if (syncNoticeReadDTO.getNoticeIdList() == null || syncNoticeReadDTO.getNoticeIdList().isEmpty()) {
return updateChain().eq(SyncNotice::getShopId, shopId).set(SyncNotice::getIsRead, 1).set(SyncNotice::getReadTime, DateUtil.date().toLocalDateTime()).update();
}
List<SyncNotice> listed = list(new QueryWrapper().eq(SyncNotice::getShopId, shopId).in(SyncNotice::getId, syncNoticeReadDTO.getNoticeIdList()));
listed.forEach(item -> {
if (item.getIsRead() == 0) {