diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/NotificationStore.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/NotificationStore.cs index 156ec794b..3273505b2 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/NotificationStore.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/NotificationStore.cs @@ -207,21 +207,9 @@ namespace LINGYUN.Abp.MessageService.Notifications { using (_currentTenant.Change(tenantId)) { - var userSubscriptions = new List(); - - if (identifiers == null) - { - userSubscriptions = await _userSubscribeRepository - .GetUserSubscribesAsync(notificationName, null, cancellationToken); - } - else - { - userSubscriptions = await _userSubscribeRepository - .GetUserSubscribesAsync( - notificationName, - identifiers.Select(ids => ids.UserId), - cancellationToken); - } + var userIds = identifiers?.Select(ids => ids.UserId); + var userSubscriptions = await _userSubscribeRepository + .GetUserSubscribesAsync(notificationName, userIds, cancellationToken); return _objectMapper.Map, List>(userSubscriptions); } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Subscriptions/EfCoreUserSubscribeRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Subscriptions/EfCoreUserSubscribeRepository.cs index 1f187299d..4ed47147c 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Subscriptions/EfCoreUserSubscribeRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Subscriptions/EfCoreUserSubscribeRepository.cs @@ -29,7 +29,7 @@ namespace LINGYUN.Abp.MessageService.Subscriptions var userSubscribes = await (await GetDbSetAsync()) .Distinct() .Where(x => x.NotificationName.Equals(notificationName)) - .WhereIf(userIds != null, x => userIds.Contains(x.UserId)) + .WhereIf(userIds?.Any() == true, x => userIds.Contains(x.UserId)) .AsNoTracking() .ToListAsync(GetCancellationToken(cancellationToken));