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