mirror of
https://gitee.com/best_handsome/mybatis-plus-join
synced 2025-07-11 00:02:22 +08:00
1.1.0
This commit is contained in:
parent
bed97d631e
commit
c255327791
21
README.md
21
README.md
@ -1,7 +1,7 @@
|
|||||||
# mybatis-plus-join
|
# mybatis-plus-join
|
||||||
|
|
||||||
* 支持连表查询的[mybatis-plus](https://gitee.com/baomidou/mybatis-plus)
|
* 支持连表查询的[mybatis-plus](https://gitee.com/baomidou/mybatis-plus)
|
||||||
只做增强,不做修改,可以使用原生mybatis-plus全部的功能
|
|
||||||
* [演示示例](https://gitee.com/best_handsome/mybatis-plus-join-demo)
|
* [演示示例](https://gitee.com/best_handsome/mybatis-plus-join-demo)
|
||||||
|
|
||||||
## 使用方法
|
## 使用方法
|
||||||
@ -14,22 +14,22 @@
|
|||||||
|
|
||||||
### 安装
|
### 安装
|
||||||
|
|
||||||
1. 在项目中添加依赖,依赖已经包含了mybatis-plus-boot-starter<3.4.2><br>
|
1. 在项目中添加依赖
|
||||||
依赖后无需再次引入mybatis-plus
|
|
||||||
|
|
||||||
```xml
|
```xml
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.yulichang</groupId>
|
<groupId>com.github.yulichang</groupId>
|
||||||
<artifactId>mybatis-plus-join</artifactId>
|
<artifactId>mybatis-plus-join</artifactId>
|
||||||
<version>1.0.9</version>
|
<version>1.1.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
或者clone代码到本地,执行mvn install,再引入以上依赖
|
或者clone代码到本地,执行mvn install,再引入以上依赖
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|
||||||
2. 配置插件,添加MPJInterceptor
|
2. 添加配置文件
|
||||||
|
|
||||||
```java
|
```java
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
public class MybatisPlusConfig {
|
public class MybatisPlusConfig {
|
||||||
/**
|
/**
|
||||||
@ -38,13 +38,18 @@
|
|||||||
@Bean
|
@Bean
|
||||||
public MybatisPlusInterceptor paginationInterceptor() {
|
public MybatisPlusInterceptor paginationInterceptor() {
|
||||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||||
//分页插件
|
|
||||||
interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
|
|
||||||
//连表插件
|
//连表插件
|
||||||
interceptor.addInnerInterceptor(new MPJInterceptor());
|
interceptor.addInnerInterceptor(new MPJInterceptor());
|
||||||
//多租户,垃圾sql拦截插件......
|
|
||||||
return interceptor;
|
return interceptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sql注入器
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public MPJSqlInjector mySqlInjector() {
|
||||||
|
return new MPJSqlInjector();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
4
pom.xml
4
pom.xml
@ -4,7 +4,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.github.yulichang</groupId>
|
<groupId>com.github.yulichang</groupId>
|
||||||
<artifactId>mybatis-plus-join</artifactId>
|
<artifactId>mybatis-plus-join</artifactId>
|
||||||
<version>1.0.9</version>
|
<version>1.1.0</version>
|
||||||
<name>mybatis-plus-join</name>
|
<name>mybatis-plus-join</name>
|
||||||
<description>An enhanced toolkit of Mybatis-Plus to simplify development.</description>
|
<description>An enhanced toolkit of Mybatis-Plus to simplify development.</description>
|
||||||
<url>https://github.com/yulichang/mybatis-plus-join</url>
|
<url>https://github.com/yulichang/mybatis-plus-join</url>
|
||||||
@ -39,7 +39,7 @@
|
|||||||
<groupId>com.baomidou</groupId>
|
<groupId>com.baomidou</groupId>
|
||||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||||
<version>3.4.2</version>
|
<version>3.4.2</version>
|
||||||
<scope>compile</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
package com.github.yulichang;
|
|
||||||
|
|
||||||
import com.github.yulichang.injector.MPJSqlInjector;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author yulichang
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
public class MybatisPlusConfiguration {
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
@ConditionalOnMissingBean(MPJSqlInjector.class)
|
|
||||||
public MPJSqlInjector mySqlInjector() {
|
|
||||||
return new MPJSqlInjector();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,2 +0,0 @@
|
|||||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
|
||||||
com.github.yulichang.MybatisPlusConfiguration
|
|
Loading…
x
Reference in New Issue
Block a user