From fc92e2903b3297b7416541eb727e779be85a1ad9 Mon Sep 17 00:00:00 2001 From: zzh <1368735060@qq.com> Date: Wed, 22 Jul 2026 11:06:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AD=97=E5=85=B8=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=88=86=E9=A1=B5=E6=94=B9=E7=94=A8=20RepositoryPageHelper=20?= =?UTF-8?q?=E9=81=BF=E5=85=8D=20Where=20=E4=B8=A2=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fake GetPagedListAsync 带 sorting 时 total 正确但 items 返回全表;dictType 筛选已生效但被该 bug 掩盖。 --- src/Oms.Application/Services/System/DictService.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Oms.Application/Services/System/DictService.cs b/src/Oms.Application/Services/System/DictService.cs index 3fba8de..2bd2737 100644 --- a/src/Oms.Application/Services/System/DictService.cs +++ b/src/Oms.Application/Services/System/DictService.cs @@ -30,12 +30,13 @@ public class DictService : ApplicationService var predicate = BuildListPredicate(input); var pageIndex = OmsDocHelper.NormalizePage(input.Page); var pageSize = OmsDocHelper.NormalizePageSize(input.PageSize); - var items = await DictRepository.GetPagedListAsync( + // Fake GetPagedListAsync(sorting) 会丢失 Where:total 正确但 items 返回全量 + var (items, total) = await RepositoryPageHelper.GetPageAsync( + DictRepository, predicate, pageIndex, pageSize, - new Dictionary { [nameof(Dict.DictSort)] = true, [nameof(Dict.Id)] = false }); - var total = await DictRepository.CountAsync(predicate); + q => q.OrderBy(x => x.DictSort).ThenByDescending(x => x.Id)); return new OmsPageResult {