7

PageHelper 分页后再排序问题

 3 years ago
source link: https://www.v2ex.com/t/786110
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

V2EX  ›  Java

PageHelper 分页后再排序问题

  daimubai · 1 天前 · 842 次点击

大家好,我目前遇到的问题是 PageHelper 分页后再排序会出现顺序错乱的问题:

PageHelper 也可以实现排序,不过它只能对表中的数据直接排序,我现在的需求是对非表中的数据进行排序,需要先分页后,然后对 list 进行 sort,但是这样的问题是:比如分页后对 price 排序,会存在第二页数据的 price 比第一页数据的 price 小的情况。

我想到的解决办法是全查出来,然后逻辑分页。。。不过数据量大肯定不行了,不知道有没有大佬遇到过这种问题,有的话帮忙解答一下,请喝奶茶!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK