Showing
1 changed file
with
10 additions
and
6 deletions
@@ -162,13 +162,17 @@ public class EntityKeyMapping { | @@ -162,13 +162,17 @@ public class EntityKeyMapping { | ||
162 | 162 | ||
163 | public String toSelection(EntityFilterType filterType, EntityType entityType) { | 163 | public String toSelection(EntityFilterType filterType, EntityType entityType) { |
164 | if (entityKey.getType().equals(EntityKeyType.ENTITY_FIELD)) { | 164 | if (entityKey.getType().equals(EntityKeyType.ENTITY_FIELD)) { |
165 | - Set<String> existingEntityFields = getExistingEntityFields(filterType, entityType); | ||
166 | - String alias = getEntityFieldAlias(filterType, entityType); | ||
167 | - if (existingEntityFields.contains(alias)) { | ||
168 | - String column = entityFieldColumnMap.get(alias); | ||
169 | - return String.format("e.%s as %s", column, getValueAlias()); | 165 | + if (entityKey.getKey().equals("entityType") && !filterType.equals(EntityFilterType.RELATIONS_QUERY)) { |
166 | + return String.format("'%s' as %s", entityType.name(), getValueAlias()); | ||
170 | } else { | 167 | } else { |
171 | - return String.format("'' as %s", getValueAlias()); | 168 | + Set<String> existingEntityFields = getExistingEntityFields(filterType, entityType); |
169 | + String alias = getEntityFieldAlias(filterType, entityType); | ||
170 | + if (existingEntityFields.contains(alias)) { | ||
171 | + String column = entityFieldColumnMap.get(alias); | ||
172 | + return String.format("e.%s as %s", column, getValueAlias()); | ||
173 | + } else { | ||
174 | + return String.format("'' as %s", getValueAlias()); | ||
175 | + } | ||
172 | } | 176 | } |
173 | } else if (entityKey.getType().equals(EntityKeyType.TIME_SERIES)) { | 177 | } else if (entityKey.getType().equals(EntityKeyType.TIME_SERIES)) { |
174 | return buildTimeSeriesSelection(); | 178 | return buildTimeSeriesSelection(); |