pageHelper-springboot

springboot Mybatis 数据库分页获取 ,使用pageHelper插件

maven#

1
2
3
4
5
6
<!--pagehelper-->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.1.1</version>
</dependency>

引用此依赖可能会与其它springboot依赖冲突,此时可手动去除其它依赖

1
2
3
4
compile ('com.github.pagehelper:pagehelper-spring-boot-starter:1.2.5') {
exclude group: 'org.springframework.boot', module: ''
exclude group: 'org.mybatis.spring.boot', module: ''
}

application.properties#

1
2
3
4
5
#pagehelper分页插件配置
pagehelper.helperDialect=mysql
pagehelper.reasonable=true
pagehelper.supportMethodsArguments=true
pagehelper.params=count=countSql

调用#

1
2
PageHelper.startPage(pageNum, pageSize);
mapper.loadAll();
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×