fix(项目管理): 修复消息中心全部已读还是未读状态问题

--bug=1039289 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001039289
This commit is contained in:
guoyuqi 2024-04-22 14:02:49 +08:00 committed by Craftsman
parent 0ae4b87190
commit 4104a5b0b1
2 changed files with 3 additions and 3 deletions

View File

@ -50,7 +50,7 @@ public class NotificationController {
@Operation(summary = "消息中心-获取未读的消息") @Operation(summary = "消息中心-获取未读的消息")
@CheckOwner(resourceId = "#projectId", resourceType = "project") @CheckOwner(resourceId = "#projectId", resourceType = "project")
public Integer getUnRead(@PathVariable(value = "projectId") String projectId) { public Integer getUnRead(@PathVariable(value = "projectId") String projectId) {
return notificationService.getUnRead(projectId); return notificationService.getUnRead(projectId, SessionUtils.getUserId());
} }
@PostMapping(value = "/count") @PostMapping(value = "/count")

View File

@ -107,12 +107,12 @@ public class NotificationService {
} }
public Integer getUnRead(String projectId) { public Integer getUnRead(String projectId, String userId) {
NotificationExample example = new NotificationExample(); NotificationExample example = new NotificationExample();
if (StringUtils.isBlank(projectId)) { if (StringUtils.isBlank(projectId)) {
return 0; return 0;
} }
example.createCriteria().andProjectIdEqualTo(projectId).andStatusEqualTo(NotificationConstants.Status.UNREAD.name()); example.createCriteria().andProjectIdEqualTo(projectId).andStatusEqualTo(NotificationConstants.Status.UNREAD.name()).andReceiverEqualTo(userId);
return (int) notificationMapper.countByExample(example); return (int) notificationMapper.countByExample(example);
} }
} }