Merge branch 'master' of github.com:thingsboard/thingsboard

This commit is contained in:
Igor Kulikov 2020-08-11 14:35:48 +03:00
commit 7ef75524d0

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());