Additional Info fix

This commit is contained in:
Andrii Shvaika 2020-08-11 11:32:42 +03:00
parent 10dd5c352f
commit 2dac896f1b

View File

@ -200,7 +200,7 @@ public class DefaultEntityQueryRepository implements EntityQueryRepository {
" THEN (select additional_info from device where id = entity_id)" + " THEN (select additional_info from device where id = entity_id)" +
" WHEN entity.entity_type = 'ENTITY_VIEW'" + " WHEN entity.entity_type = 'ENTITY_VIEW'" +
" THEN (select additional_info from entity_view where id = entity_id)" + " THEN (select additional_info from entity_view where id = entity_id)" +
" END as label"; " END as additional_info";
static { static {
entityTableMap.put(EntityType.ASSET, "asset"); entityTableMap.put(EntityType.ASSET, "asset");
@ -460,7 +460,7 @@ public class DefaultEntityQueryRepository implements EntityQueryRepository {
//TODO: fetch last level only. //TODO: fetch last level only.
//TODO: fetch distinct records. //TODO: fetch distinct records.
String lvlFilter = getLvlFilter(entityFilter.getMaxLevel()); String lvlFilter = getLvlFilter(entityFilter.getMaxLevel());
String selectFields = "SELECT tenant_id, customer_id, id, created_time, type, name " String selectFields = "SELECT tenant_id, customer_id, id, created_time, type, name, additional_info "
+ (entityType.equals(EntityType.ENTITY_VIEW) ? "" : ", label ") + (entityType.equals(EntityType.ENTITY_VIEW) ? "" : ", label ")
+ "FROM " + entityType.name() + " WHERE id in ( SELECT entity_id"; + "FROM " + entityType.name() + " WHERE id in ( SELECT entity_id";
String from = getQueryTemplate(entityFilter.getDirection()); String from = getQueryTemplate(entityFilter.getDirection());