Browse Source

fix fixEmptyInClause

tags/B0.9.0.2_20230710_base
yk 2 years ago
parent
commit
eb2898eda2
1 changed files with 8 additions and 1 deletions
  1. +8
    -1
      xueyi-common/xueyi-common-web/src/main/java/com/xueyi/common/web/interceptor/TenantLineInnerInterceptor.java

+ 8
- 1
xueyi-common/xueyi-common-web/src/main/java/com/xueyi/common/web/interceptor/TenantLineInnerInterceptor.java View File

@@ -58,9 +58,16 @@ public class TenantLineInnerInterceptor extends BaseMultiTableInnerInterceptor i
public void beforeQuery(Executor executor, MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) throws SQLException {
if (InterceptorIgnoreHelper.willIgnoreTenantLine(ms.getId())) return;
PluginUtils.MPBoundSql mpBs = PluginUtils.mpBoundSql(boundSql);
mpBs.sql(this.parserSingle(mpBs.sql(), null));
String modifiedSql = fixEmptyInClause(mpBs.sql());
mpBs.sql(this.parserSingle(modifiedSql, null));
}

private String fixEmptyInClause(String sql) {
String fixedSql = sql.replaceAll("IN \\(\\)", "IN (null)"); // 将空括号替换为 (null)
return fixedSql;
}


/**
* before -> prepare
*/


Loading…
Cancel
Save