Browse Source

fix entity view selection in relation query alias

pull/4937/head
ShvaykaD 5 years ago
committed by Andrew Shvayka
parent
commit
a085f8de5a
  1. 14
      dao/src/main/java/org/thingsboard/server/dao/sql/query/DefaultEntityQueryRepository.java

14
dao/src/main/java/org/thingsboard/server/dao/sql/query/DefaultEntityQueryRepository.java

@ -114,7 +114,7 @@ public class DefaultEntityQueryRepository implements EntityQueryRepository {
" WHEN entity.entity_type = 'DEVICE'" +
" THEN (select customer_id from device where id = entity_id)" +
" WHEN entity.entity_type = 'ENTITY_VIEW'" +
" THEN (select customer_id from entity_view where id = entity_id)" +
" THEN (select customer_id from entity_view where id = entity.entity_id)" +
" WHEN entity.entity_type = 'EDGE'" +
" THEN (select customer_id from edge where id = entity_id)" +
" END as customer_id";
@ -131,7 +131,7 @@ public class DefaultEntityQueryRepository implements EntityQueryRepository {
" WHEN entity.entity_type = 'DEVICE'" +
" THEN (select tenant_id from device where id = entity_id)" +
" WHEN entity.entity_type = 'ENTITY_VIEW'" +
" THEN (select tenant_id from entity_view where id = entity_id)" +
" THEN (select tenant_id from entity_view where id = entity.entity_id)" +
" WHEN entity.entity_type = 'EDGE'" +
" THEN (select tenant_id from edge where id = entity_id)" +
" END as tenant_id";
@ -149,7 +149,7 @@ public class DefaultEntityQueryRepository implements EntityQueryRepository {
" WHEN entity.entity_type = 'DEVICE'" +
" THEN (select created_time from device where id = entity_id)" +
" WHEN entity.entity_type = 'ENTITY_VIEW'" +
" THEN (select created_time from entity_view where id = entity_id)" +
" THEN (select created_time from entity_view where id = entity.entity_id)" +
" WHEN entity.entity_type = 'EDGE'" +
" THEN (select created_time from edge where id = entity_id)" +
" END as created_time";
@ -167,7 +167,7 @@ public class DefaultEntityQueryRepository implements EntityQueryRepository {
" WHEN entity.entity_type = 'DEVICE'" +
" THEN (select name from device where id = entity_id)" +
" WHEN entity.entity_type = 'ENTITY_VIEW'" +
" THEN (select name from entity_view where id = entity_id)" +
" THEN (select name from entity_view where id = entity.entity_id)" +
" WHEN entity.entity_type = 'EDGE'" +
" THEN (select name from edge where id = entity_id)" +
" END as name";
@ -179,7 +179,7 @@ public class DefaultEntityQueryRepository implements EntityQueryRepository {
" WHEN entity.entity_type = 'DEVICE'" +
" THEN (select type from device where id = entity_id)" +
" WHEN entity.entity_type = 'ENTITY_VIEW'" +
" THEN (select type from entity_view where id = entity_id)" +
" THEN (select type from entity_view where id = entity.entity_id)" +
" WHEN entity.entity_type = 'EDGE'" +
" THEN (select type from edge where id = entity_id)" +
" ELSE entity.entity_type END as type";
@ -197,7 +197,7 @@ public class DefaultEntityQueryRepository implements EntityQueryRepository {
" WHEN entity.entity_type = 'DEVICE'" +
" THEN (select label from device where id = entity_id)" +
" WHEN entity.entity_type = 'ENTITY_VIEW'" +
" THEN (select name from entity_view where id = entity_id)" +
" THEN (select name from entity_view where id = entity.entity_id)" +
" WHEN entity.entity_type = 'EDGE'" +
" THEN (select label from edge where id = entity_id)" +
" END as label";
@ -215,7 +215,7 @@ public class DefaultEntityQueryRepository implements EntityQueryRepository {
" WHEN entity.entity_type = 'DEVICE'" +
" THEN (select additional_info from device where id = entity_id)" +
" 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.entity_id)" +
" WHEN entity.entity_type = 'EDGE'" +
" THEN (select additional_info from edge where id = entity_id)" +
" END as additional_info";

Loading…
Cancel
Save