#2593 - Tidy SqlTreeBuilder to not add duplicate BeanProperties

This commit is contained in:
Rob Bygrave committed 2022-03-14 16:16:14 +13:00
1 parent 267a81b792
commit fd4be0ca59
4 files changed
+19 -8

No files matched your search

@@ -224,8 +224,7 @@ public final class SqlTreeBuilder {
* Recursively build the query tree depending on what leaves in the tree
* should be included.
*/
private SqlTreeNode buildSelectChain(String prefix, STreePropertyAssoc prop,
STreeType desc, List<SqlTreeNode> joinList) {
private SqlTreeNode buildSelectChain(String prefix, STreePropertyAssoc prop, STreeType desc, List<SqlTreeNode> joinList) {
List<SqlTreeNode> myJoinList = new ArrayList<>();
List<STreePropertyAssocOne> extraProps = new ArrayList<>();
for (STreePropertyAssocOne one : desc.propsOne()) {
@@ -256,7 +255,7 @@ public final class SqlTreeBuilder {
}
addManyWhereJoins(myJoinList);
}
extraProps.forEach(props::add); //addExtra
extraProps.forEach(props::addExtra);
if (!rawSql && manyWhereJoins.isFormulaWithJoin(prefix)) {
for (String property : manyWhereJoins.getFormulaJoinProperties(prefix)) {
@@ -33,6 +33,12 @@ public final class SqlTreeProperties {
propsList.addAll(Arrays.asList(props));
}
public void addExtra(STreePropertyAssocOne prop) {
if (!propsList.contains(prop)) {
add(prop);
}
}
public void add(STreeProperty prop) {
propsList.add(prop);
propNames.add(prop.name());