diff --git a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parser/visitor/or/OrVisitor.java b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parser/visitor/or/OrVisitor.java index 669b898a8dd3d..567c4fab57914 100644 --- a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parser/visitor/or/OrVisitor.java +++ b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parser/visitor/or/OrVisitor.java @@ -41,8 +41,10 @@ public class OrVisitor extends AbstractMySQLVisitor { public OrVisitor(final SQLASTOutputVisitor dependencyVisitor) { setParameters(dependencyVisitor.getParameters()); SQLVisitor visitor = (SQLVisitor) dependencyVisitor; - String currentTableName = null == visitor.getParseContext().getCurrentTable() ? "" : visitor.getParseContext().getCurrentTable().getName(); - getParseContext().setCurrentTable(currentTableName, Optional.absent()); + if (null != visitor.getParseContext().getCurrentTable()) { + getParseContext().setCurrentTable(visitor.getParseContext().getCurrentTable().getName(), Optional.absent()); + } + getParseContext().getParsedResult().getRouteContext().getTables().addAll(visitor.getParseContext().getParsedResult().getRouteContext().getTables()); getParseContext().setShardingColumns(visitor.getParseContext().getShardingColumns()); } diff --git a/sharding-jdbc-core/src/test/resources/com/dangdang/ddframe/rdb/sharding/parser/mysql/or/select_or.xml b/sharding-jdbc-core/src/test/resources/com/dangdang/ddframe/rdb/sharding/parser/mysql/or/select_or.xml index ff830d2435d16..ca84767d143a9 100644 --- a/sharding-jdbc-core/src/test/resources/com/dangdang/ddframe/rdb/sharding/parser/mysql/or/select_or.xml +++ b/sharding-jdbc-core/src/test/resources/com/dangdang/ddframe/rdb/sharding/parser/mysql/or/select_or.xml @@ -120,4 +120,23 @@ + + + +
+
+ + + + + + + + + + + + + + diff --git a/sharding-jdbc-doc/content/post/release_notes.md b/sharding-jdbc-doc/content/post/release_notes.md index 9c7904baae2dd..5121ffbf07788 100644 --- a/sharding-jdbc-doc/content/post/release_notes.md +++ b/sharding-jdbc-doc/content/post/release_notes.md @@ -8,6 +8,10 @@ weight = 1 ## 1.2.2-SNAPSHOT +### 缺陷修正 + +1. [ISSUE #63](https://github.com/dangdangdotcom/sharding-jdbc/issues/81) 关联表查询使用or查询条件解析结果异常 + ## 1.2.1 ### 结构调整