1. Introduction to Mybatis-Plus
MyBatis-Plus (MP for short) is an enhancement tool for MyBatis. Based on MyBatis, it only enhances without making any changes. It is created to simplify development and improve efficiency.
Official website: https://mybatis.plus/ or https://mp.baomidou.com/
Document address: https://mybatis.plus/guide/
Source code address: https://github.com/baomidou/mybatis-plus
2. Characteristics
Non-intrusive: only enhancements and no changes are made. Introducing it will not affect existing projects and is as smooth as silk
Low loss: basic CURD will be automatically injected upon startup, with basically no loss in performance and direct object-oriented operation.
Powerful CRUD operations: Built-in general Mapper and general Service, most CRUD operations on a single table can be realized with only a small amount of configuration. There are also powerful conditional constructors to meet various usage needs.
Supports Lambda form calling: through Lambda expressions, you can easily write various query conditions without worrying about mistyping fields.
Supports multiple databases: supports MySQL, MariaDB, Oracle, DB2, H2, HSQL, SQLite, Postgre, SQLServer2005, SQLServer and other databases
Supports automatic generation of primary keys: supports up to 4 primary key strategies (including distributed unique ID generator - Sequence), which can be freely configured to perfectly solve the primary key problem
Support XML hot loading: Mapper's corresponding XML supports hot loading. For simple CRUD operations, it can even be started without XML.
Support ActiveRecord mode: Support ActiveRecord form calling, entity classes only need to inherit the Model class to perform powerful CRUD operations
Support custom global universal operations: support global universal method injection (Write once, use anywhere)
Supports automatic escaping of keywords: supports automatic escaping of database keywords (order, key...), and can also customize keywords
Built-in code generator: Use code or Maven plug-ins to quickly generate Mapper, Model, Service, and Controller layer codes. It supports template engines and has many custom configurations waiting for you to use.
Built-in paging plug-in: Based on MyBatis physical paging, developers do not need to care about specific operations. After configuring the plug-in, writing paging is equivalent to ordinary List query
Built-in performance analysis plug-in: can output Sql statements and their execution time. It is recommended to enable this function during development and testing to quickly identify slow queries.
Built-in global interception plug-in: Provides intelligent analysis and blocking of delete and update operations in the entire table, and can also customize interception rules to prevent misoperations
Built-in Sql injection stripper: supports Sql injection stripping, effectively preventing Sql injection attacks
3. Architecture
4. Author
Mybatis-Plus is developed by the baomidou organization and is open source.
Code cloud address: https://gitee.com/organizations/baomidou