Browse Source
Merge pull request #14433 from abpframework/TotalCount
Improve the performance when `totalCount` is 0.
pull/14442/head
liangshiwei
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
10 additions and
5 deletions
-
framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyReadOnlyAppService.cs
|
|
@ -63,14 +63,19 @@ public abstract class AbstractKeyReadOnlyAppService<TEntity, TGetOutputDto, TGet |
|
|
await CheckGetListPolicyAsync(); |
|
|
await CheckGetListPolicyAsync(); |
|
|
|
|
|
|
|
|
var query = await CreateFilteredQueryAsync(input); |
|
|
var query = await CreateFilteredQueryAsync(input); |
|
|
|
|
|
|
|
|
var totalCount = await AsyncExecuter.CountAsync(query); |
|
|
var totalCount = await AsyncExecuter.CountAsync(query); |
|
|
|
|
|
|
|
|
query = ApplySorting(query, input); |
|
|
var entities = new List<TEntity>(); |
|
|
query = ApplyPaging(query, input); |
|
|
var entityDtos = new List<TGetListOutputDto>(); |
|
|
|
|
|
|
|
|
|
|
|
if (totalCount > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
query = ApplySorting(query, input); |
|
|
|
|
|
query = ApplyPaging(query, input); |
|
|
|
|
|
|
|
|
var entities = await AsyncExecuter.ToListAsync(query); |
|
|
entities = await AsyncExecuter.ToListAsync(query); |
|
|
var entityDtos = await MapToGetListOutputDtosAsync(entities); |
|
|
entityDtos = await MapToGetListOutputDtosAsync(entities); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return new PagedResultDto<TGetListOutputDto>( |
|
|
return new PagedResultDto<TGetListOutputDto>( |
|
|
totalCount, |
|
|
totalCount, |
|
|
|