This commit is contained in:
2019-04-17 16:57:22 +08:00
parent 523bc304aa
commit e6e655c4b3
6 changed files with 58 additions and 208 deletions

View File

@@ -148,14 +148,16 @@ public class ParseMysql implements Parser {
if (!isEmpty.test(links)) {
links.forEach(x -> {
MetaTable rightTable = tables.get(metaTable.getAlias().equals(x.getTables()[0]) ? x.getTables()[1] : x.getTables()[0]);
bufFrom.append(" left join ").append(rightTable.getCatalog()).append(".").append(rightTable.getName()).append(" ").append(rightTable.getAlias()).append(" on ");
int tag = bufFrom.length();
x.getLink().forEach((k,v) -> {
if (bufFrom.length() > tag) {
bufFrom.append(" and ");
}
bufFrom.append(k).append("=").append(v);
});
if (rightTable != null) {
bufFrom.append(" left join ").append(rightTable.getCatalog()).append(".").append(rightTable.getName()).append(" ").append(rightTable.getAlias()).append(" on ");
int tag = bufFrom.length();
x.getLink().forEach((k, v) -> {
if (bufFrom.length() > tag) {
bufFrom.append(" and ");
}
bufFrom.append(k).append("=").append(v);
});
}
});
}