MyBatis-Plus

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

Github星跟踪图

为简化开发而生

什么是 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 文件了解详情。

主要指标

概览
名称与所有者baomidou/mybatis-plus
主编程语言Java
编程语言Java (语言数: 3)
平台BSD, Cross-platform, Linux, Mac, Unix-like, Windows
许可证Apache License 2.0
所有者活动
创建于2016-08-18 10:06:53
推送于2025-05-07 15:26:24
最后一次提交2022-01-05 23:54:44
发布数74
最新版本名称v3.5.12 (发布于 )
第一版名称v1.0 (发布于 )
用户参与
星数16.8k
关注者数81
派生数4.4k
提交数6.1k
已启用问题?
问题数5554
打开的问题数63
拉请求数524
打开的拉请求数9
关闭的拉请求数498
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?

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.