From 4dc5b067ebfc7b7d0204515b7f6580ca3d709f2c Mon Sep 17 00:00:00 2001
From: MSuMshk <2039814060@qq.com>
Date: Thu, 29 Jan 2026 13:52:36 +0000
Subject: [PATCH] =?UTF-8?q?feat:=20=E5=95=86=E6=88=B7=E6=A8=A1=E5=9D=97?=
=?UTF-8?q?=E7=A7=BB=E9=99=A4=E7=A7=9F=E6=88=B7=E4=B8=8A=E4=B8=8B=E6=96=87?=
=?UTF-8?q?=E4=BE=9D=E8=B5=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../MerchantCategoriesController.cs | 30 ++++++++++++---
.../Controllers/MerchantsController.cs | 7 +++-
.../Commands/CreateMerchantCategoryCommand.cs | 28 ++++++++++++--
.../Commands/CreateMerchantCommand.cs | 6 +++
.../Commands/DeleteMerchantCategoryCommand.cs | 4 +-
.../ReorderMerchantCategoriesCommand.cs | 16 +++++++-
.../AddMerchantDocumentCommandHandler.cs | 13 +++----
.../CreateMerchantCategoryCommandHandler.cs | 17 ++++-----
.../Handlers/CreateMerchantCommandHandler.cs | 1 +
.../CreateMerchantContractCommandHandler.cs | 13 +++----
.../DeleteMerchantCategoryCommandHandler.cs | 11 ++----
.../Handlers/DeleteMerchantCommandHandler.cs | 11 ++----
.../Handlers/ExportMerchantPdfQueryHandler.cs | 26 +++----------
.../GetMerchantAuditHistoryQueryHandler.cs | 25 ++-----------
.../GetMerchantAuditLogsQueryHandler.cs | 20 ++++++----
.../Handlers/GetMerchantByIdQueryHandler.cs | 10 ++---
.../GetMerchantCategoriesQueryHandler.cs | 11 ++----
.../GetMerchantChangeHistoryQueryHandler.cs | 25 ++-----------
.../GetMerchantContractsQueryHandler.cs | 13 +++----
.../Handlers/GetMerchantDetailQueryHandler.cs | 29 +++------------
.../GetMerchantDocumentsQueryHandler.cs | 13 +++----
.../Handlers/GetMerchantListQueryHandler.cs | 37 ++++---------------
.../ListMerchantCategoriesQueryHandler.cs | 11 ++----
...ReorderMerchantCategoriesCommandHandler.cs | 13 +++----
.../ReviewMerchantDocumentCommandHandler.cs | 18 +++++----
.../Handlers/SearchMerchantsQueryHandler.cs | 20 +++++-----
.../Handlers/UpdateMerchantCommandHandler.cs | 29 +++------------
...ateMerchantContractStatusCommandHandler.cs | 14 ++++---
.../Queries/GetMerchantCategoriesQuery.cs | 2 +-
.../Queries/ListMerchantCategoriesQuery.cs | 8 +++-
.../Merchants/Queries/SearchMerchantsQuery.cs | 5 +++
31 files changed, 218 insertions(+), 268 deletions(-)
diff --git a/src/Api/TakeoutSaaS.AdminApi/Controllers/MerchantCategoriesController.cs b/src/Api/TakeoutSaaS.AdminApi/Controllers/MerchantCategoriesController.cs
index 497cc87..6358aac 100644
--- a/src/Api/TakeoutSaaS.AdminApi/Controllers/MerchantCategoriesController.cs
+++ b/src/Api/TakeoutSaaS.AdminApi/Controllers/MerchantCategoriesController.cs
@@ -1,3 +1,4 @@
+using System.ComponentModel.DataAnnotations;
using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@@ -22,15 +23,18 @@ public sealed class MerchantCategoriesController(IMediator mediator) : BaseApiCo
///
/// 列出所有类目。
///
+ /// 租户 ID。
/// 取消标记。
/// 类目列表。
[HttpGet]
[PermissionAuthorize("merchant_category:read")]
[ProducesResponseType(typeof(ApiResponse>), StatusCodes.Status200OK)]
- public async Task>> List(CancellationToken cancellationToken)
+ public async Task>> List(
+ [FromQuery, Range(1, long.MaxValue)] long tenantId,
+ CancellationToken cancellationToken)
{
// 1. 查询所有类目
- var result = await mediator.Send(new ListMerchantCategoriesQuery(), cancellationToken);
+ var result = await mediator.Send(new ListMerchantCategoriesQuery { TenantId = tenantId }, cancellationToken);
// 2. 返回类目列表
return ApiResponse>.Ok(result);
@@ -39,15 +43,20 @@ public sealed class MerchantCategoriesController(IMediator mediator) : BaseApiCo
///
/// 新增类目。
///
+ /// 租户 ID。
/// 创建命令。
/// 取消标记。
/// 创建的类目。
[HttpPost]
[PermissionAuthorize("merchant_category:create")]
[ProducesResponseType(typeof(ApiResponse), StatusCodes.Status200OK)]
- public async Task> Create([FromBody] CreateMerchantCategoryCommand command, CancellationToken cancellationToken)
+ public async Task> Create(
+ [FromQuery, Range(1, long.MaxValue)] long tenantId,
+ [FromBody] CreateMerchantCategoryCommand command,
+ CancellationToken cancellationToken)
{
// 1. 创建类目
+ command = command with { TenantId = tenantId };
var result = await mediator.Send(command, cancellationToken);
// 2. 返回创建结果
@@ -57,6 +66,7 @@ public sealed class MerchantCategoriesController(IMediator mediator) : BaseApiCo
///
/// 删除类目。
///
+ /// 租户 ID。
/// 类目 ID。
/// 取消标记。
/// 删除结果,未找到则返回错误。
@@ -64,10 +74,13 @@ public sealed class MerchantCategoriesController(IMediator mediator) : BaseApiCo
[PermissionAuthorize("merchant_category:delete")]
[ProducesResponseType(typeof(ApiResponse