From 0a47bfc47c51f3fbf43c6e7d4ddb97f45a2a5350 Mon Sep 17 00:00:00 2001 From: maliming Date: Thu, 3 Apr 2025 19:30:52 +0800 Subject: [PATCH] Fix merge problem of `GetQueryableAsync` method. --- .../MongoDB/MongoIdentityUserRepository.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs index 0a84a429f0..80ea4fca3d 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs @@ -362,8 +362,21 @@ public class MongoIdentityUserRepository : MongoDbRepository(cancellationToken)) + .Where(x => x.Id == sourceOrganizationId) + .FirstOrDefaultAsync(cancellationToken: cancellationToken); + if (sourceOrganizationUnit == null) + { + throw new EntityNotFoundException(typeof(OrganizationUnit), sourceOrganizationId); + } + + var allSourceOrganizationIds = await (await GetQueryableAsync(cancellationToken)) + .Where(x => x.Code.StartsWith(sourceOrganizationUnit.Code)) + .Select(x => x.Id) + .ToListAsync(cancellationToken: cancellationToken); + var users = await (await GetQueryableAsync(cancellationToken)) - .Where(x => x.OrganizationUnits.Any(r => r.OrganizationUnitId == sourceOrganizationId)) + .Where(x => x.OrganizationUnits.Any(r => allSourceOrganizationIds.Contains(r.OrganizationUnitId))) .ToListAsync(GetCancellationToken(cancellationToken)); foreach (var user in users) @@ -458,7 +471,7 @@ public class MongoIdentityUserRepository : MongoDbRepository x.Id == id); } - + if (roleId.HasValue) { var organizationUnitIds = (await GetQueryableAsync(cancellationToken))