fix: 字典列表分页改用 RepositoryPageHelper 避免 Where 丢失
Fake GetPagedListAsync 带 sorting 时 total 正确但 items 返回全表;dictType 筛选已生效但被该 bug 掩盖。
This commit is contained in:
parent
793085607a
commit
fc92e2903b
@ -30,12 +30,13 @@ public class DictService : ApplicationService
|
|||||||
var predicate = BuildListPredicate(input);
|
var predicate = BuildListPredicate(input);
|
||||||
var pageIndex = OmsDocHelper.NormalizePage(input.Page);
|
var pageIndex = OmsDocHelper.NormalizePage(input.Page);
|
||||||
var pageSize = OmsDocHelper.NormalizePageSize(input.PageSize);
|
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,
|
predicate,
|
||||||
pageIndex,
|
pageIndex,
|
||||||
pageSize,
|
pageSize,
|
||||||
new Dictionary<string, bool> { [nameof(Dict.DictSort)] = true, [nameof(Dict.Id)] = false });
|
q => q.OrderBy(x => x.DictSort).ThenByDescending(x => x.Id));
|
||||||
var total = await DictRepository.CountAsync(predicate);
|
|
||||||
|
|
||||||
return new OmsPageResult<DictOutput>
|
return new OmsPageResult<DictOutput>
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user