Mybatis插件PageHelper分页查询使用方法

  • A+
所属分类:mybatis

Mybatis的一个插件,PageHelper,非常方便mybatis分页查询。国内牛人的一个开源项目,官方文档中文文档,这个非常好。具体可以参照:

https://github.com/pagehelper/Mybatis-PageHelper/blob/master/wikis/zh/HowToUse.md

这个使用起来那是相当简单。直接下面这样就行了。

PageHelper.startPage(1, 10);
List<Country> list = countryMapper.selectIf(1);

有一点,这个文档里第二步是配置拦截器,但我现在做的项目里貌似没有配置拦截器,但一样可以用分页。感觉这个不是必须的?

ZPY

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: