对多次查询数据库得到的数据集合进行分页处理

<dependency>
    <groupId>com.github.pagehelper</groupId>
    <artifactId>pagehelper</artifactId>
</dependency>

//使用分页插件对过滤后的数据进行分页
    Page page = new Page(pageNum, pageSize);
    int total = resultList.size();
    page.setTotal(total);
    int startIndex = (pageNum-1) * pageSize;
    int endIndex = Math.min(startIndex + pageSize,total);
    page.addAll(resultList.subList(startIndex, endIndex));
    PageInfo pageInfo = new PageInfo<>(page);

接下来可以将PageInfo做处理,放在自定义的分页实体类中