fix: 菜单固定为全局
This commit is contained in:
@@ -10,12 +10,15 @@ namespace TakeoutSaaS.Infrastructure.Identity.Repositories;
|
||||
/// </summary>
|
||||
public sealed class EfMenuRepository(IdentityDbContext dbContext) : IMenuRepository
|
||||
{
|
||||
private const long PlatformRootTenantId = 1000000000001;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<IReadOnlyList<MenuDefinition>> GetByTenantAsync(long tenantId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return dbContext.MenuDefinitions
|
||||
.AsNoTracking()
|
||||
.Where(x => x.TenantId == tenantId)
|
||||
.IgnoreQueryFilters()
|
||||
.Where(x => x.TenantId == PlatformRootTenantId && x.DeletedAt == null)
|
||||
.OrderBy(x => x.ParentId)
|
||||
.ThenBy(x => x.SortOrder)
|
||||
.ToListAsync(cancellationToken)
|
||||
@@ -27,7 +30,10 @@ public sealed class EfMenuRepository(IdentityDbContext dbContext) : IMenuReposit
|
||||
{
|
||||
return dbContext.MenuDefinitions
|
||||
.AsNoTracking()
|
||||
.FirstOrDefaultAsync(x => x.Id == id && x.TenantId == tenantId, cancellationToken);
|
||||
.IgnoreQueryFilters()
|
||||
.FirstOrDefaultAsync(
|
||||
x => x.Id == id && x.TenantId == PlatformRootTenantId && x.DeletedAt == null,
|
||||
cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in New Issue
Block a user