|
|
|
@@ -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 |
|
|
|
*/ |
|
|
|
|