Mybatis分页插件 - PageHelper 5.1.0 发布了。 如果你也在用Mybatis,建议尝试该分页插件,这一定是最方便使用的分页插件。 该插件目前支持以下数据库的物理分页 Oracle Mysql MariaDB SQLite Hsqldb PostgreSQL DB2 SqlServer(2005+) Informix H2 SqlServer2012 Derby Phoenix 如果你使用 Maven 可以在pom.xml 中添加下面的依赖: <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper</artifactId> <version>5.1.0</version> </dependency> 如果使用Spring Boot,可以直接添加下面的依赖: <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper-spring-boot-starter</artifactId> <version>1.2.0</version> </dependency> 5.1.0 增加 4.x 以前版本包含的排序功能,用法一致(PageHelper增加了几个排序相关的方法)。 分页 SQL 转换为预编译 SQL。 增加 ReplaceSql 接口用于处理 sqlServer 的 with(nolock) 问题,增加了针对性的 replaceSql 参数,可选值为 simple和 regex,或者是实现了ReplaceSql接口的全限定类名。默认值为 simple,仍然使用原来的方式处理,新的 regex 会将如 table with(nolock) 处理为 table_PAGEWITHNOLOCK。 PageRowBounds 增加 count 属性,可以控制是否进行 count 查询。 Mybatis 分页插件 PageHelper 5.1.0 发布下载地址