fix entity view selection in relation query alias

This commit is contained in:
ShvaykaD 2021-07-20 14:20:12 +03:00 committed by Andrew Shvayka
parent b037a03b95
commit a085f8de5a

View File

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