import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
PageHelper.startPage(pageNum, pageSize);
List<返回体> result = xxx;
PageInfo<返回体> pageInfo = new PageInfo<>(result);
问题描述:在使用如上方法进行分页时,返回的pageInfo 中total数据错误,与数据库实际不符。
原因是:在进行集合查询的时候,由于使用selectList,需要对集合的返回体切换导致total错误。
解决方法:使用@Select()方法查询,不用它自带的方法。