From d23c9a5fe918304f73296c0d28de9cb60a2b5335 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Fri, 29 Nov 2024 17:17:11 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E7=94=B1token=E6=98=BE=E7=A4=BA=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E6=8B=A5=E6=9C=89=E7=9A=84=E5=8E=82=E5=8C=BA=E6=9D=83?= =?UTF-8?q?=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/Implements/TenantService.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Src/Dlhis.Sys/Identity/Services/Implements/TenantService.cs b/Src/Dlhis.Sys/Identity/Services/Implements/TenantService.cs index 42ebbb7d..59eb1319 100644 --- a/Src/Dlhis.Sys/Identity/Services/Implements/TenantService.cs +++ b/Src/Dlhis.Sys/Identity/Services/Implements/TenantService.cs @@ -69,18 +69,17 @@ public class TenantService : ITenantService public async Task> GetMyTenantsAsync() { - var userId = _currentUser.GetIntSubjectId(); var tenantId = _currentUser.GetStringTenantId(); + var tenantIds = _currentUser.GetUserClaim("tenants").Split(",").ToList(); - var myTenants = await _dbContext.Queryable() - .LeftJoin((ut, t) => ut.TenantCode == t.Code) - .Where(ut => ut.UserId == userId) - .Select((ut, t) => new TenantResponse + var myTenants = await _dbContext.Queryable() + .Where(x => tenantIds.Contains(x.Code)) + .Select(x => new TenantResponse { - Id = t.Id, - PCode = t.PCode, - Code = t.Code, - Name = t.Name, + Id = x.Id, + PCode = x.PCode, + Code = x.Code, + Name = x.Name, }) .ToListAsync();