A MyBatis plugin that adds physical pagination to queries, generating database-specific LIMIT or equivalent SQL for many databases.
baomidou/mybatis-plus
A MyBatis enhancement toolkit that adds CRUD interfaces, condition wrappers, pagination and code generation on top of MyBatis for Java.
- Stars
- 17,486
- Forks
- 4,438
- Open issues
- 27
- Last commit
- 2 days ago
What is it?
MyBatis-Plus is a toolkit built on top of MyBatis, the Java persistence framework. It keeps full compatibility with MyBatis while removing much of the boilerplate needed for everyday database access. Mapper interfaces that extend its BaseMapper get ready-made methods for common operations without hand-written SQL.
The project includes a fluent condition wrapper and a lambda-style API for building queries in Java code, along with automatic pagination, several primary key generation strategies and an active record mode. A code generator produces entity, mapper and service code from database tables. It is available as Maven and Gradle starters for Spring Boot 2, 3 and 4.
It is aimed at Java teams that already use MyBatis and want to reduce repetitive DAO code and speed up CRUD-heavy development.
Key features
- 01Generic CRUD methods via BaseMapper without hand-written SQL
- 02Condition wrapper and lambda-style API for building queries
- 03Automatic pagination
- 04Multiple primary key generation strategies
- 05Code generator for entities, mappers and services
- 06Starters for Spring Boot 2, 3 and 4
Use cases
- Spring Boot backends that use MyBatis and want less DAO boilerplate
- Admin systems with many CRUD tables and list pages
- Generating entity and mapper code from an existing MySQL or PostgreSQL schema
Quick start
- 1
Add the mybatis-plus Spring Boot starter dependency to your pom.xml (pick the starter for your Spring Boot version)
- 2
Make your mapper interface extend BaseMapper
- 3
Call the built-in methods or condition wrapper from your code
Things to know
- Each Spring Boot version has its own starter artifact, and JDK 8 or some JDK 11+ setups may need an extra mybatis-plus-jsqlparser artifact.
In collections
Topics
FAQ
- What is mybatis-plus?
- A MyBatis enhancement toolkit that adds CRUD interfaces, condition wrappers, pagination and code generation on top of MyBatis for Java. MyBatis-Plus is a toolkit built on top of MyBatis, the Java persistence framework. It keeps full compatibility with MyBatis while removing much of the boilerplate needed for everyday database access. Mapper interfaces that extend its BaseMapper get ready-made methods for common operations without hand-written SQL.
- Is mybatis-plus free to use? What license does it have?
- mybatis-plus is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
- Is mybatis-plus still maintained?
- Actively maintained. The last commit to mybatis-plus was on Nov 6, 2026.
- What can I use mybatis-plus for?
- Spring Boot backends that use MyBatis and want less DAO boilerplate Admin systems with many CRUD tables and list pages Generating entity and mapper code from an existing MySQL or PostgreSQL schema
- How do I install mybatis-plus?
- Add the mybatis-plus Spring Boot starter dependency to your pom.xml (pick the starter for your Spring Boot version) Make your mapper interface extend BaseMapper Call the built-in methods or condition wrapper from your code
- Where can I get mybatis-plus?
- The source code and installation instructions are on GitHub: https://github.com/baomidou/mybatis-plus
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A TypeScript and JavaScript ORM for Node.js and other JS platforms, supporting both Active Record and Data Mapper patterns across many SQL and NoSQL databases.
A lightweight, headless TypeScript ORM for PostgreSQL, MySQL and SQLite that works across Node.js, Bun, Deno and edge runtimes.
A promise-based Node.js and TypeScript ORM for PostgreSQL, MySQL, MariaDB, SQLite, MS SQL Server, Snowflake, Oracle and Db2.
A safe, extensible ORM and query builder for Rust that checks queries at compile time across PostgreSQL, MySQL, SQLite and MariaDB.
A full-stack e-commerce system with a storefront and an admin backend, built on Spring Boot and MyBatis and deployable with Docker.