feat: 租户列表 API 支持按状态过滤
- ListTenantsQuery 添加 Status 可选参数 - ITenantRepository.GetAllAsync 添加 status 参数 - EfTenantRepository 实现状态过滤逻辑 - TenantsController.List 添加 status 查询参数 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -16,8 +16,8 @@ public sealed class ListTenantsQueryHandler(ITenantRepository tenantRepository)
|
||||
/// <inheritdoc />
|
||||
public async Task<PagedResult<TenantListItemDto>> Handle(ListTenantsQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
// 1. 查询租户列表
|
||||
var tenants = await tenantRepository.GetAllAsync(request.Keyword, cancellationToken);
|
||||
// 1. 查询租户列表(支持状态过滤)
|
||||
var tenants = await tenantRepository.GetAllAsync(request.Keyword, request.Status, cancellationToken);
|
||||
|
||||
// 2. 计算分页参数
|
||||
var totalCount = tenants.Count;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using MediatR;
|
||||
using TakeoutSaaS.Application.App.Tenants.Contracts;
|
||||
using TakeoutSaaS.Domain.Tenants.Enums;
|
||||
using TakeoutSaaS.Shared.Abstractions.Results;
|
||||
|
||||
namespace TakeoutSaaS.Application.App.Tenants.Queries;
|
||||
@@ -14,6 +15,11 @@ public sealed record ListTenantsQuery : IRequest<PagedResult<TenantListItemDto>>
|
||||
/// </summary>
|
||||
public string? Keyword { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 租户状态过滤(可选)。
|
||||
/// </summary>
|
||||
public TenantStatus? Status { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 页码(从 1 开始)。
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user