Browse Source

[多租户插件复杂update语句支持][修改]:修复复杂update语句异常

release_toaliyun_real
Stormeye.Wu 7 years ago
parent
commit
bbf0ef3fc3
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      mybatis-multi-tenancy/src/main/java/com/iformall/plugin/MultiTenancy.java

+ 4
- 1
mybatis-multi-tenancy/src/main/java/com/iformall/plugin/MultiTenancy.java View File

@@ -152,7 +152,10 @@ public class MultiTenancy implements Interceptor {
if (getTenantInfo().doTableFilter(table)) if (getTenantInfo().doTableFilter(table))
continue; continue;
if (where != null) { if (where != null) {
updateStatement.setWhere(addAndExpression(stmt, table, updateStatement.getWhere()));
AndExpression andE = addAndExpression(stmt, table, updateStatement.getWhere());
if (andE != null) {
updateStatement.setWhere(andE);
}
} else { } else {
throw new Exception("update语句不能没有where条件:" + sql + Arrays.toString(Thread.currentThread().getStackTrace())); throw new Exception("update语句不能没有where条件:" + sql + Arrays.toString(Thread.currentThread().getStackTrace()));
} }


Loading…
Cancel
Save