MyBatis-Plus

一个强大的增强型 MyBatis 工具箱,用于简化开发。「An powerful enhanced toolkit of MyBatis for simplify development」

Github stars Tracking Chart

为简化开发而生

什么是 MyBatis-Plus?

MyBatis-Plus 是 MyBatis 的一个强大的增强型工具箱,用于简化开发。该工具包为 MyBatis 提供了一些高效、有用、开箱即用的功能,使用它可以有效地节省您的开发时间。

相关链接

特性

  • 与 MyBatis 完全兼容
  • 启动时自动配置
  • 操作数据库的现成接口
  • 强大而灵活的条件下包装物
  • 多种策略产生主键
  • 兰姆达式API
  • 全能且高度可定制的代码生成器。
  • 自动寻呼操作
  • SQL注入防御
  • 支持主动记录
  • 支持可插拔的自定义界面
  • 内置许多有用的扩展

开始

  • Add MyBatis-Plus dependency
    • Maven:
      <dependency>
          <groupId>com.baomidou</groupId>
          <artifactId>mybatis-plus-boot-starter</artifactId>
          <version>3.2.0</version>
      </dependency>            
    • Gradle
      compile group: 'com.baomidou', name: 'mybatis-plus-boot-starter', version: '3.1.2'            
  • 修改映射器文件扩展了BaseMapper 接口
    public interface UserMapper extends BaseMapper<User> {
    
    }       
  • 使用它
    List<User> userList = userMapper.selectList(
            new QueryWrapper<User>()
                    .lambda()
                    .ge(User::getAge, 18)
    );        
    MyBatis-Plus 将执行以下 SQL
    SELECT * FROM user WHERE age >= 18        

此展示只是 MyBatis-Plus 功能的一小部分。如果您想了解更多,请参考 文档

许可证

MyBatis-Plus 是在 Apache 2.0 许可证下。请参阅 Apache License 2.0 文件了解详情。

Main metrics

Overview
Name With Ownerbaomidou/mybatis-plus
Primary LanguageJava
Program languageJava (Language Count: 3)
PlatformBSD, Cross-platform, Linux, Mac, Unix-like, Windows
License:Apache License 2.0
所有者活动
Created At2016-08-18 10:06:53
Pushed At2025-04-17 10:19:12
Last Commit At2022-01-05 23:54:44
Release Count73
Last Release Namev3.5.11 (Posted on )
First Release Namev1.0 (Posted on )
用户参与
Stargazers Count16.8k
Watchers Count81
Fork Count4.4k
Commits Count6.1k
Has Issues Enabled
Issues Count5544
Issue Open Count73
Pull Requests Count524
Pull Requests Open Count8
Pull Requests Close Count497
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private

What is MyBatis-Plus?

MyBatis-Plus is an powerful enhanced toolkit of MyBatis for simplify development. This toolkit provides some efficient, useful, out-of-the-box features for MyBatis, use it can effectively save your development time.

Features

  • Fully compatible with MyBatis
  • Auto configuration on startup
  • Out-of-the-box interfaces for operate database
  • Powerful and flexible where condition wrapper
  • Multiple strategy to generate primary key
  • Lambda-style API
  • Almighty and highly customizable code generator
  • Automatic paging operation
  • SQL Inject defense
  • Support active record
  • Support pluggable custom interface
  • Build-in many useful extensions

Getting started

  • Add MyBatis-Plus dependency

    • Maven:
      <dependency>
          <groupId>com.baomidou</groupId>
          <artifactId>mybatis-plus-boot-starter</artifactId>
          <version>3.2.0</version>
      </dependency>
      
    • Gradle
      compile group: 'com.baomidou', name: 'mybatis-plus-boot-starter', version: '3.1.2'
      
  • Modify mapper file extends BaseMapper interface

    public interface UserMapper extends BaseMapper<User> {
    
    }
    
  • Use it

    List<User> userList = userMapper.selectList(
            new QueryWrapper<User>()
                    .lambda()
                    .ge(User::getAge, 18)
    );
    

    MyBatis-Plus will execute the following SQL

    SELECT * FROM user WHERE age >= 18
    

This showcase is just a small part of MyBatis-Plus features. If you want to learn more, please refer to the documentation.

License

MyBatis-Plus is under the Apache 2.0 license. See the Apache License 2.0 file for details.