feat: 实现动态租户解析与移除菜单回退逻辑

1. 新增 ITenantCodeResolver 接口和 DatabaseTenantCodeResolver 实现
2. 修改 TenantResolutionMiddleware 支持从数据库动态解析租户编码
3. ITenantRepository 新增 FindIdByCodeAsync 方法
4. 移除 EfMenuRepository 中危险的系统菜单回退逻辑
5. 调整服务注册顺序确保依赖正确注入

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
MSuMshk
2026-02-03 13:05:52 +08:00
parent cfacbf8363
commit e88c41c11e
10 changed files with 103 additions and 49 deletions

View File

@@ -84,6 +84,14 @@ public interface ITenantRepository
/// <returns>存在返回 true否则 false。</returns>
Task<bool> ExistsByCodeAsync(string code, CancellationToken cancellationToken = default);
/// <summary>
/// 依据租户编码查询租户 ID。
/// </summary>
/// <param name="code">租户编码。</param>
/// <param name="cancellationToken">取消标记。</param>
/// <returns>租户 ID未找到返回 null。</returns>
Task<long?> FindIdByCodeAsync(string code, CancellationToken cancellationToken = default);
/// <summary>
/// 判断租户名称是否存在(支持排除指定租户)。
/// </summary>