Skip to content

PageHelper

A MyBatis plugin that adds paging to SQL queries in Java projects.pagehelper-org/Mybatis-PageHelper

Stars
12.3k
Forks
3.1k
Licence
MIT
Language
Java
Last update
29 days ago
Type
Library

What it is

PageHelper is a pagination plugin for MyBatis, a Java database library. It adds page-by-page query support so developers do not have to write paging logic into each SQL statement by hand. The README says it supports complex single-table and multi-table paging and lists many databases it can produce paged SQL for.

  • Add paging to a MyBatis query by adding the pagehelper dependency and configuring the plugin
  • Run paged queries across single-table and multi-table SQL
  • Map a custom or renamed database to an existing paging dialect through the dialectAlias setting

Great for

  • Java developers already using MyBatis who need paged query results
  • Projects using MySQL, PostgreSQL, Oracle, or other databases listed in the README
  • Teams that want a configurable paging plugin rather than custom paging code

Not ideal for

  • Projects that do not use MyBatis, since the plugin hooks into MyBatis and will not help elsewhere
  • Non-Java projects, because the README describes a Java library only
  • Teams on a database not in the README's list, unless they configure a custom dialect alias, which adds setup work
Step-by-step guide: how to use PageHelperInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Java JDK 8+ (per README for PageHelper 6) · MyBatis 3.1.0+ (per README) · jsqlparser (required dependency per README)

    Add Maven dependency (copy into pom.xml; replace the version placeholder with the latest release)

    <dependency><groupId>com.github.pagehelper</groupId><artifactId>pagehelper</artifactId><version>最新版本</version></dependency>
  2. 2

    Run it

    • Add the pagehelper dependency to your Maven pom.xml, using the latest version
    • Make sure jsqlparser is on the classpath, as the README requires
    • Configure the PageHelper plugin in your MyBatis setup, following the HowToUse guide linked in the README
    • Call the paging API before a MyBatis query to get a paged result
  3. 3

    Get the most out of it

    • Read the Important guide linked from the README for special paging cases
    • Set the dialectAlias parameter if your database is not in the built-in list
    • Use the QueryInterceptor specification to customize query handling
    • For Spring Boot, check the separate pagehelper-spring-boot-starter project mentioned in the README

Downloads

Strengths

  • Widely used, with about 12,320 GitHub stars at the time of this metadata
  • MIT licensed, so it can be used in commercial projects under its license terms
  • README documents support for many database dialects and a path for custom ones

Trade-offs

  • The README is mostly in Chinese and the English version is a separate file, so setup details may take extra reading
  • Some special cases are linked to a separate 'Important' guide rather than explained in the main README
  • Requires Java and the MyBatis ecosystem; the README lists JDK 8+ for version 6

How it compares

ProjectStarsTypeLevelUpdatedBest for
Mybatis-PageHelper (this)12.3kLibraryintermediate29 days agoJava developers already using MyBatis who need paged query results
zheng16.6kFrameworkadvanced3.9 years agoJava teams building internal admin systems who want a pre-made permissions and login layer

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.