23 lines
768 B
C#
23 lines
768 B
C#
using MediatR;
|
|
using TakeoutSaaS.Application.App.Tenants.Dto;
|
|
using TakeoutSaaS.Application.App.Tenants.Queries;
|
|
using TakeoutSaaS.Domain.Tenants.Repositories;
|
|
|
|
namespace TakeoutSaaS.Application.App.Tenants.Handlers;
|
|
|
|
/// <summary>
|
|
/// 账单详情查询处理器。
|
|
/// </summary>
|
|
public sealed class GetTenantBillQueryHandler(ITenantBillingRepository billingRepository)
|
|
: IRequestHandler<GetTenantBillQuery, TenantBillingDto?>
|
|
{
|
|
public async Task<TenantBillingDto?> Handle(GetTenantBillQuery request, CancellationToken cancellationToken)
|
|
{
|
|
// 1. 查询账单
|
|
var bill = await billingRepository.FindByIdAsync(request.TenantId, request.BillingId, cancellationToken);
|
|
|
|
// 2. 返回 DTO 或 null
|
|
return bill?.ToDto();
|
|
}
|
|
}
|