Skip to content

Commit

Permalink
feat Compatible with mybatis-plus 3.5.7
Browse files Browse the repository at this point in the history
  • Loading branch information
SweetInk committed Jul 1, 2024
1 parent 0dcfb12 commit ed3be37
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>online.githuboy</groupId>
<artifactId>jr-mybatisplus</artifactId>
<name>JRebel MyBatisPlus Plugin</name>
<version>1.0.6</version>
<version>1.0.7</version>
<developers>
<developer>
<name>suchu</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,18 @@ public StrictMapCBP() {
@Override
public void process(ClassPool classPool, ClassLoader classLoader, CtClass ctClass) throws Exception {
if (!proceed) {
CtClass ambiguityClass = classPool.getOrNull("com.baomidou.mybatisplus.core.MybatisConfiguration$StrictMap$Ambiguity");
ctClass.getDeclaredMethod("put").instrument(new ExprEditor() {
public void edit(MethodCall m) throws CannotCompileException {
if ("containsKey".equals(m.getMethodName())) {
m.replace("{ if (" + Constants.SqlMapReloaderClass + ".isReloading()) $_ = false; else $_ = $proceed($$);}");
} else if ("get".equals(m.getMethodName())) {
m.replace("{ $_ = $proceed($$); if (" + Constants.SqlMapReloaderClass + ".isReloading() && !($_ instanceof com.baomidou.mybatisplus.core.MybatisConfiguration$StrictMap$Ambiguity)) $_ = null;}");
//Before mybatis-plus version 3.5.7
if (null != ambiguityClass) {
m.replace("{ $_ = $proceed($$); if (" + Constants.SqlMapReloaderClass + ".isReloading() && !($_ instanceof com.baomidou.mybatisplus.core.MybatisConfiguration$StrictMap$Ambiguity)) $_ = null;}");
} else {
m.replace("{ $_ = $proceed($$); if (" + Constants.SqlMapReloaderClass + ".isReloading() && !($_ ==AMBIGUITY_INSTANCE)) $_ = null;}");
}
}
}
});
Expand Down

0 comments on commit ed3be37

Please sign in to comment.