fix: 字典列表分页改用 RepositoryPageHelper 避免 Where 丢失

Fake GetPagedListAsync 带 sorting 时 total 正确但 items 返回全表;dictType 筛选已生效但被该 bug 掩盖。
This commit is contained in:
zzh 2026-07-22 11:06:21 +08:00
parent 793085607a
commit fc92e2903b

View File

@ -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<string, bool> { [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<DictOutput>
{