Fix for entityType selection

This commit is contained in:
zbeacon 2020-07-21 10:51:14 +03:00
parent fc597f2c0b
commit 0e8f4daddb

View File

@ -162,13 +162,17 @@ public class EntityKeyMapping {
public String toSelection(EntityFilterType filterType, EntityType entityType) { public String toSelection(EntityFilterType filterType, EntityType entityType) {
if (entityKey.getType().equals(EntityKeyType.ENTITY_FIELD)) { if (entityKey.getType().equals(EntityKeyType.ENTITY_FIELD)) {
Set<String> existingEntityFields = getExistingEntityFields(filterType, entityType); if (entityKey.getKey().equals("entityType") && !filterType.equals(EntityFilterType.RELATIONS_QUERY)) {
String alias = getEntityFieldAlias(filterType, entityType); return String.format("'%s' as %s", entityType.name(), getValueAlias());
if (existingEntityFields.contains(alias)) {
String column = entityFieldColumnMap.get(alias);
return String.format("e.%s as %s", column, getValueAlias());
} else { } else {
return String.format("'' as %s", getValueAlias()); Set<String> existingEntityFields = getExistingEntityFields(filterType, entityType);
String alias = getEntityFieldAlias(filterType, entityType);
if (existingEntityFields.contains(alias)) {
String column = entityFieldColumnMap.get(alias);
return String.format("e.%s as %s", column, getValueAlias());
} else {
return String.format("'' as %s", getValueAlias());
}
} }
} else if (entityKey.getType().equals(EntityKeyType.TIME_SERIES)) { } else if (entityKey.getType().equals(EntityKeyType.TIME_SERIES)) {
return buildTimeSeriesSelection(); return buildTimeSeriesSelection();