Browse Source

feat: 消息查询添加消息级别

production
hanpaopao 1 year ago
parent
commit
1d0d45bd7e
  1. 5
      aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationInput.cs
  2. 4
      aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/Notifications/NotificationAppService.cs
  3. 4
      aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/INotificationManager.cs
  4. 2
      aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/INotificationRepository.cs
  5. 8
      aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/NotificationManager.cs
  6. 4
      aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.EntityFrameworkCore/EntityFrameworkCore/Notifications/EfCoreNotificationRepository.cs

5
aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationInput.cs

@ -52,5 +52,10 @@ namespace Lion.AbpPro.NotificationManagement.Notifications.Dtos
/// 消息类型
/// </summary>
public MessageType? MessageType { get; set; }
/// <summary>
/// 消息等级
/// </summary>
public MessageLevel? MessageLevel { get; set; }
}
}

4
aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/Notifications/NotificationAppService.cs

@ -94,8 +94,8 @@ namespace Lion.AbpPro.NotificationManagement.Notifications
/// </summary>
public virtual async Task<PagedResultDto<PagingNotificationOutput>> PageNotificationAsync(PagingNotificationInput input)
{
var totalCount = await _notificationManager.GetPagingCountAsync(input.Title, input.Content, input.SenderUserId, input.SenderUserName, input.ReceiverUserId, input.ReceiverUserName, input.Read, input.StartReadTime, input.EndReadTime, input.MessageType);
var list = await _notificationManager.GetPagingListAsync(input.Title, input.Content, input.SenderUserId, input.SenderUserName, input.ReceiverUserId, input.ReceiverUserName, input.Read, input.StartReadTime, input.EndReadTime, input.MessageType, input.PageSize, input.SkipCount);
var totalCount = await _notificationManager.GetPagingCountAsync(input.Title, input.Content, input.SenderUserId, input.SenderUserName, input.ReceiverUserId, input.ReceiverUserName, input.Read, input.StartReadTime, input.EndReadTime, input.MessageType,input.MessageLevel);
var list = await _notificationManager.GetPagingListAsync(input.Title, input.Content, input.SenderUserId, input.SenderUserName, input.ReceiverUserId, input.ReceiverUserName, input.Read, input.StartReadTime, input.EndReadTime, input.MessageType,input.MessageLevel, input.PageSize, input.SkipCount);
return new PagedResultDto<PagingNotificationOutput>(totalCount, ObjectMapper.Map<List<NotificationDto>, List<PagingNotificationOutput>>(list));
}

4
aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/INotificationManager.cs

@ -19,6 +19,7 @@ public interface INotificationManager
DateTime? startReadTime,
DateTime? endReadTime,
MessageType? messageType,
MessageLevel? messageLevel,
int maxResultCount = 10,
int skipCount = 0);
@ -35,7 +36,8 @@ public interface INotificationManager
bool? read,
DateTime? startReadTime,
DateTime? endReadTime,
MessageType? messageType);
MessageType? messageType,
MessageLevel? messageLevel);
/// <summary>
/// 发送警告文本消息

2
aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/INotificationRepository.cs

@ -19,6 +19,7 @@ namespace Lion.AbpPro.NotificationManagement.Notifications
DateTime? startReadTime,
DateTime? endReadTime,
MessageType? messageType,
MessageLevel? messageLevel,
int maxResultCount = 10,
int skipCount = 0,
CancellationToken cancellationToken = default);
@ -37,6 +38,7 @@ namespace Lion.AbpPro.NotificationManagement.Notifications
DateTime? startReadTime,
DateTime? endReadTime,
MessageType? messageType,
MessageLevel? messageLevel,
CancellationToken cancellationToken = default);
Task<List<Notification>> GetListAsync(List<Guid> ids);

8
aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/NotificationManager.cs

@ -29,10 +29,11 @@ namespace Lion.AbpPro.NotificationManagement.Notifications
DateTime? startReadTime,
DateTime? endReadTime,
MessageType? messageType,
MessageLevel? messageLevel,
int maxResultCount = 10,
int skipCount = 0)
{
var list = await _notificationRepository.GetPagingListAsync(title, content, senderUserId, senderUserName, receiverUserId, receiverUserName, read, startReadTime, endReadTime, messageType, maxResultCount, skipCount);
var list = await _notificationRepository.GetPagingListAsync(title, content, senderUserId, senderUserName, receiverUserId, receiverUserName, read, startReadTime, endReadTime, messageType,messageLevel, maxResultCount, skipCount);
return ObjectMapper.Map<List<Notification>, List<NotificationDto>>(list);
}
@ -49,9 +50,10 @@ namespace Lion.AbpPro.NotificationManagement.Notifications
bool? read,
DateTime? startReadTime,
DateTime? endReadTime,
MessageType? messageType)
MessageType? messageType,
MessageLevel? messageLevel)
{
return await _notificationRepository.GetPagingCountAsync(title, content, senderUserId, senderUserName, receiverUserId, receiverUserName, read, startReadTime, endReadTime, messageType);
return await _notificationRepository.GetPagingCountAsync(title, content, senderUserId, senderUserName, receiverUserId, receiverUserName, read, startReadTime, endReadTime, messageType, messageLevel);
}
public async Task SendCommonWarningMessageAsync(string title, string content, MessageLevel level, Guid receiveUserId, string receiveUserName)

4
aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.EntityFrameworkCore/EntityFrameworkCore/Notifications/EfCoreNotificationRepository.cs

@ -23,6 +23,7 @@ namespace Lion.AbpPro.NotificationManagement.EntityFrameworkCore.Notifications
DateTime? startReadTime,
DateTime? endReadTime,
MessageType? messageType,
MessageLevel? messageLevel,
int maxResultCount = 10,
int skipCount = 0,
CancellationToken cancellationToken = default)
@ -38,6 +39,7 @@ namespace Lion.AbpPro.NotificationManagement.EntityFrameworkCore.Notifications
.WhereIf(startReadTime.HasValue, e => e.ReadTime >= startReadTime.Value)
.WhereIf(endReadTime.HasValue, e => e.ReadTime <= endReadTime.Value)
.WhereIf(messageType.HasValue, e => e.MessageType == messageType.Value)
.WhereIf(messageLevel.HasValue, e => e.MessageLevel == messageLevel.Value)
.OrderByDescending(e => e.CreationTime)
.PageBy(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken));
@ -54,6 +56,7 @@ namespace Lion.AbpPro.NotificationManagement.EntityFrameworkCore.Notifications
DateTime? startReadTime,
DateTime? endReadTime,
MessageType? messageType,
MessageLevel? messageLevel,
CancellationToken cancellationToken = default)
{
return await (await GetDbSetAsync())
@ -67,6 +70,7 @@ namespace Lion.AbpPro.NotificationManagement.EntityFrameworkCore.Notifications
.WhereIf(startReadTime.HasValue, e => e.ReadTime >= startReadTime.Value)
.WhereIf(endReadTime.HasValue, e => e.ReadTime <= endReadTime.Value)
.WhereIf(messageType.HasValue, e => e.MessageType == messageType.Value)
.WhereIf(messageLevel.HasValue, e => e.MessageLevel == messageLevel.Value)
.CountAsync(cancellationToken);
}

Loading…
Cancel
Save