From 4104a5b0b1a9aeebbdd735124937092ccf4615b8 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Mon, 22 Apr 2024 14:02:49 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E9=A1=B9=E7=9B=AE=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B6=88=E6=81=AF=E4=B8=AD=E5=BF=83=E5=85=A8?= =?UTF-8?q?=E9=83=A8=E5=B7=B2=E8=AF=BB=E8=BF=98=E6=98=AF=E6=9C=AA=E8=AF=BB?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1039289 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001039289 --- .../metersphere/system/controller/NotificationController.java | 2 +- .../io/metersphere/system/service/NotificationService.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/NotificationController.java b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/NotificationController.java index eb42802d1d..6126e41175 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/NotificationController.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/NotificationController.java @@ -50,7 +50,7 @@ public class NotificationController { @Operation(summary = "消息中心-获取未读的消息") @CheckOwner(resourceId = "#projectId", resourceType = "project") public Integer getUnRead(@PathVariable(value = "projectId") String projectId) { - return notificationService.getUnRead(projectId); + return notificationService.getUnRead(projectId, SessionUtils.getUserId()); } @PostMapping(value = "/count") diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/service/NotificationService.java b/backend/services/system-setting/src/main/java/io/metersphere/system/service/NotificationService.java index e283f0a4c6..3a0ef704ef 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/service/NotificationService.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/service/NotificationService.java @@ -107,12 +107,12 @@ public class NotificationService { } - public Integer getUnRead(String projectId) { + public Integer getUnRead(String projectId, String userId) { NotificationExample example = new NotificationExample(); if (StringUtils.isBlank(projectId)) { 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); } }