diff --git a/dao/src/main/java/org/thingsboard/server/dao/sql/query/DefaultEntityQueryRepository.java b/dao/src/main/java/org/thingsboard/server/dao/sql/query/DefaultEntityQueryRepository.java index 9c7e8de01d..7b3ea36cfa 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sql/query/DefaultEntityQueryRepository.java +++ b/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";