You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.1 KiB

using MediatR;
using CellularManagement.Application.Common;
using System;
using CellularManagement.Domain.Common;
using System.Collections.Generic;
namespace CellularManagement.Application.Features.Roles.Queries;
/// <summary>
/// 获取所有角色的查询,支持分页和按名称模糊查询
/// </summary>
public sealed record GetAllRolesQuery(
int PageNumber = 1,
int PageSize = 10,
string? RoleName = null
) : IRequest<OperationResult<GetAllRolesResponse>>;
/// <summary>
/// 获取所有角色响应,包含角色列表和分页信息
/// </summary>
public sealed record GetAllRolesResponse(
List<RoleDto> Roles,
int TotalCount,
int PageNumber,
int PageSize
)
{
public int TotalPages => (int)Math.Ceiling(TotalCount / (double)PageSize);
public bool HasPreviousPage => PageNumber > 1;
public bool HasNextPage => PageNumber < TotalPages;
}
/// <summary>
/// 角色数据传输对象
/// </summary>
public record RoleDto(
string Id,
string Name,
string Description,
DateTime CreatedAt,
DateTime UpdatedAt);