添加adapter设置

This commit is contained in:
yulichang 2024-05-04 01:13:02 +08:00
parent 57715b11a1
commit 0877317078
2 changed files with 12 additions and 5 deletions

View File

@ -1,7 +1,7 @@
<!--suppress HtmlDeprecatedAttribute -->
<p align="center">
<a href="https://github.com/yulichang/mybatis-plus-join" target="_blank">
<img alt="Mybatis-Plus-Join-Logo" src="https://mybatisplusjoin.com/lg.png">
<img alt="Mybatis-Plus-Join-Logo" src="https://foruda.gitee.com/images/1714756037858567246/8b0258f5_2020985.png">
</a>
</p>
<h1 align="center">MyBatis-Plus-Join</h1>
@ -33,7 +33,7 @@
QQ群:680016987 或者
<a href="https://gitee.com/best_handsome/mybatis-plus-join/issues/I65N2M" target="_blank">添加作者微信备注MPJ加入微信群</a>
<br/>
<img width="200px" height="200px" src="https://mybatisplusjoin.com/qr.png" alt="添加作者微信备注MPJ加入微信群"/>
<img width="200px" height="200px" src="https://foruda.gitee.com/images/1714756135330585984/bcc86eb0_2020985.png" alt="添加作者微信备注MPJ加入微信群"/>
</p>
### <a href="https://www.baidu.com/link?url=6NtKqbGKUIIdwoBUaqNkQnLiG3d5y03L6Pfg6ODId0VKfPifpB1xqdQzsBprm-0h&wd=&eqid=d26e7f1600004777000000056440ade6" target="_blank">使用文档WIKI</a>

View File

@ -9,6 +9,8 @@ import com.github.yulichang.adapter.v3431.Adapter3431;
import com.github.yulichang.adapter.v355.Adapter355;
import lombok.Getter;
import java.util.Optional;
/**
* @author yulichang
* @since 1.4.3
@ -16,13 +18,14 @@ import lombok.Getter;
public class AdapterHelper {
@Getter
private static final IAdapter adapter;
private static IAdapter adapter;
static {
String version = MybatisPlusVersion.getVersion();
String lastAdapter = "3.5.6";
String version = Optional.of(MybatisPlusVersion.getVersion()).orElse(lastAdapter);
if (VersionUtils.compare(version, "3.5.6") >= 0) {
if (VersionUtils.compare(version, lastAdapter) >= 0) {
adapter = new Adapter();
} else if (VersionUtils.compare(version, "3.5.4") >= 0) {
adapter = new Adapter355();
@ -34,4 +37,8 @@ public class AdapterHelper {
throw ExceptionUtils.mpe("MPJ需要MP版本3.3.0+当前MP版本%s", version);
}
}
public static void setAdapter(IAdapter adapter) {
AdapterHelper.adapter = adapter;
}
}