fix where missing in single table split

This commit is contained in:
johnrobbet 2022-03-07 18:33:40 +08:00
parent 1a5f1f0288
commit d1a17c5c91

View File

@ -93,6 +93,7 @@ public class SingleTableSplitUtil {
allQuerySql.add(tempQuerySql); allQuerySql.add(tempQuerySql);
tempConfig.set(Key.QUERY_SQL, tempQuerySql); tempConfig.set(Key.QUERY_SQL, tempQuerySql);
tempConfig.set(Key.WHERE, (hasWhere ? ("(" + where + ") and") : "") + range);
pluginParams.add(tempConfig); pluginParams.add(tempConfig);
} }
} else { } else {
@ -103,6 +104,7 @@ public class SingleTableSplitUtil {
+ String.format(" %s IS NOT NULL", splitPkName); + String.format(" %s IS NOT NULL", splitPkName);
allQuerySql.add(tempQuerySql); allQuerySql.add(tempQuerySql);
tempConfig.set(Key.QUERY_SQL, tempQuerySql); tempConfig.set(Key.QUERY_SQL, tempQuerySql);
tempConfig.set(Key.WHERE, (hasWhere ? "(" + where + ") and" : "") + String.format(" %s IS NOT NULL", splitPkName));
pluginParams.add(tempConfig); pluginParams.add(tempConfig);
} }
@ -118,6 +120,7 @@ public class SingleTableSplitUtil {
StringUtils.join(allQuerySql, "\n")); StringUtils.join(allQuerySql, "\n"));
tempConfig.set(Key.QUERY_SQL, tempQuerySql); tempConfig.set(Key.QUERY_SQL, tempQuerySql);
tempConfig.set(Key.WHERE, (hasWhere ? "(" + where + ") and" : "") + String.format(" %s IS NULL", splitPkName));
pluginParams.add(tempConfig); pluginParams.add(tempConfig);
return pluginParams; return pluginParams;