/mybatis-plus

An powerful enhanced toolkit of MyBatis for simplify development

Primary LanguageJavaApache License 2.0Apache-2.0

Mybatis-Plus-Logo

Born To Simplify Development

maven code style

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.

Links

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 Injection 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.0.6</version>
      </dependency>
    • Gradle
      compile group: 'com.baomidou', name: 'mybatis-plus-boot-starter', version: '3.0.6'
  • 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)
    );

    SQL executed

    SELECT * FROM user WHERE age >= 18

License

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