思路:按ID升序排列(每次记录上一次最大ID,下次分页作为起始值),取固定条数;
感觉没有性能问题,又能很好实现分页:
示例:
final ListregionRelList = regionRelMapper.selectList(Wrappers. lambdaQuery() .eq(PersLevelRegionRelEntity::getRegion, region) .eq(PersLevelRegionRelEntity::getCity, city) .in(PersLevelRegionRelEntity::getLevelRuleItemId, ruleItems) //每次记录上一次最大ID .gt(PersLevelRegionRelEntity::getId, maxId) //按ID升序 .orderByAsc(PersLevelRegionRelEntity::getId) //每次取指定1000数量 .last("LIMIT 0, 1000"));