Mybatis-PageHelper
Mybatis通用分页插件
A Java plugin that automatically adds pagination to MyBatis database queries, supporting 20+ databases including MySQL, PostgreSQL, and Oracle without changing your SQL code.
Mybatis-PageHelper is a Java plugin that adds pagination to applications built with MyBatis, a popular tool for connecting Java apps to databases. Pagination means splitting a large set of database results into numbered pages: instead of loading all 50,000 records at once, the app loads the first 20, then the next 20, and so on. This is standard behavior for any app that displays lists of data.
MyBatis itself does not include built-in pagination that works across different database systems, because each database (MySQL, PostgreSQL, Oracle, SQL Server, and others) handles pagination using different SQL syntax. This plugin detects which database your app is connected to and automatically writes the correct SQL for that database. The README lists more than 20 supported databases, including major cloud and domestic Chinese databases.
Java developers add the plugin to their project by including a Maven dependency and configuring it once. After that, wrapping any database query with a simple call triggers automatic pagination without changing the query itself. The plugin works with Spring, Spring Boot, and standard MyBatis setups.
The README is written in Chinese and points to external wiki pages for full setup and usage instructions. An English README is also available in the repository. The project is maintained by its original author and has a companion book on MyBatis available for purchase in Chinese bookstores.
Where it fits
- Add pagination to a Spring Boot app that queries a MySQL database using MyBatis without rewriting any SQL.
- Build a web app that displays a paginated list of results and switch between database vendors without changing pagination code.
- Support domestic Chinese databases or cloud databases alongside standard MySQL and PostgreSQL in a Java application.