From f5b6ef2388250eb4c742254ff9b0b0331299702d Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Tue, 8 Sep 2020 18:06:58 +0800 Subject: [PATCH] add paged --- .../Volo/Abp/Identity/IOrganizationUnitRepository.cs | 8 ++++++-- .../EfCoreOrganizationUnitRepository.cs | 10 ++++++++-- .../MongoDB/MongoOrganizationUnitRepository.cs | 10 ++++++++-- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IOrganizationUnitRepository.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IOrganizationUnitRepository.cs index 81474425db..4d5bf7d060 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IOrganizationUnitRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IOrganizationUnitRepository.cs @@ -57,8 +57,10 @@ namespace Volo.Abp.Identity Task> GetUnaddedRolesAsync( OrganizationUnit organizationUnit, - string filter = null, string sorting = null, + int maxResultCount = int.MaxValue, + int skipCount = 0, + string filter = null, bool includeDetails = false, CancellationToken cancellationToken = default ); @@ -81,8 +83,10 @@ namespace Volo.Abp.Identity Task> GetUnaddedUsersAsync( OrganizationUnit organizationUnit, - string filter = null, string sorting = null, + int maxResultCount = int.MaxValue, + int skipCount = 0, + string filter = null, bool includeDetails = false, CancellationToken cancellationToken = default ); diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreOrganizationUnitRepository.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreOrganizationUnitRepository.cs index d50745ab1d..ebfa9b8ebb 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreOrganizationUnitRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreOrganizationUnitRepository.cs @@ -114,8 +114,10 @@ namespace Volo.Abp.Identity.EntityFrameworkCore public virtual async Task> GetUnaddedRolesAsync( OrganizationUnit organizationUnit, - string filter = null, string sorting = null, + int maxResultCount = int.MaxValue, + int skipCount = 0, + string filter = null, bool includeDetails = false, CancellationToken cancellationToken = default) { @@ -126,6 +128,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore .IncludeDetails(includeDetails) .WhereIf(!filter.IsNullOrWhiteSpace(), r => r.Name.Contains(filter)) .OrderBy(sorting ?? nameof(IdentityRole.Name)) + .PageBy(skipCount, maxResultCount) .ToListAsync(cancellationToken); } @@ -157,8 +160,10 @@ namespace Volo.Abp.Identity.EntityFrameworkCore public virtual async Task> GetUnaddedUsersAsync( OrganizationUnit organizationUnit, - string filter = null, string sorting = null, + int maxResultCount = int.MaxValue, + int skipCount = 0, + string filter = null, bool includeDetails = false, CancellationToken cancellationToken = default) { @@ -181,6 +186,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore return await query .IncludeDetails(includeDetails) .OrderBy(sorting ?? nameof(IdentityUser.Name)) + .PageBy(skipCount, maxResultCount) .ToListAsync(cancellationToken); } diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoOrganizationUnitRepository.cs b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoOrganizationUnitRepository.cs index 2823c99a6c..2b28a2e3a1 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoOrganizationUnitRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoOrganizationUnitRepository.cs @@ -109,8 +109,10 @@ namespace Volo.Abp.Identity.MongoDB public async Task> GetUnaddedRolesAsync( OrganizationUnit organizationUnit, - string filter = null, string sorting = null, + int maxResultCount = int.MaxValue, + int skipCount = 0, + string filter = null, bool includeDetails = false, CancellationToken cancellationToken = default) { @@ -120,6 +122,7 @@ namespace Volo.Abp.Identity.MongoDB .WhereIf(!filter.IsNullOrWhiteSpace(), r => r.Name.Contains(filter)) .OrderBy(sorting ?? nameof(IdentityRole.Name)) .As>() + .PageBy>(skipCount, maxResultCount) .ToListAsync(cancellationToken); } @@ -153,8 +156,10 @@ namespace Volo.Abp.Identity.MongoDB public async Task> GetUnaddedUsersAsync( OrganizationUnit organizationUnit, - string filter = null, string sorting = null, + int maxResultCount = int.MaxValue, + int skipCount = 0, + string filter = null, bool includeDetails = false, CancellationToken cancellationToken = default) { @@ -169,6 +174,7 @@ namespace Volo.Abp.Identity.MongoDB ) .OrderBy(sorting ?? nameof(IdentityUser.UserName)) .As>() + .PageBy>(skipCount, maxResultCount) .ToListAsync(GetCancellationToken(cancellationToken)); }