Browse Source
Merge pull request #12868 from thingsboard/fix/entity-view-edqs
EDQS: fix entity views sync
pull/12870/head
Viacheslav Klimov
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
8 additions and
4 deletions
-
common/data/src/main/java/org/thingsboard/server/common/data/edqs/fields/EntityViewFields.java
-
dao/src/main/java/org/thingsboard/server/dao/sql/entityview/EntityViewRepository.java
|
|
|
@ -15,12 +15,15 @@ |
|
|
|
*/ |
|
|
|
package org.thingsboard.server.common.data.edqs.fields; |
|
|
|
|
|
|
|
import com.fasterxml.jackson.databind.JsonNode; |
|
|
|
import lombok.Data; |
|
|
|
import lombok.NoArgsConstructor; |
|
|
|
import lombok.experimental.SuperBuilder; |
|
|
|
|
|
|
|
import java.util.UUID; |
|
|
|
|
|
|
|
import static org.thingsboard.server.common.data.edqs.fields.FieldsUtil.getText; |
|
|
|
|
|
|
|
@Data |
|
|
|
@NoArgsConstructor |
|
|
|
@SuperBuilder |
|
|
|
@ -29,9 +32,9 @@ public class EntityViewFields extends AbstractEntityFields { |
|
|
|
private String type; |
|
|
|
private String additionalInfo; |
|
|
|
|
|
|
|
public EntityViewFields(UUID id, long createdTime, UUID tenantId, UUID customerId, String name, String type, String additionalInfo, Long version) { |
|
|
|
public EntityViewFields(UUID id, long createdTime, UUID tenantId, UUID customerId, String name, String type, JsonNode additionalInfo, Long version) { |
|
|
|
super(id, createdTime, tenantId, customerId, name, version); |
|
|
|
this.type = type; |
|
|
|
this.additionalInfo = additionalInfo; |
|
|
|
this.additionalInfo = getText(additionalInfo); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -147,7 +147,8 @@ public interface EntityViewRepository extends JpaRepository<EntityViewEntity, UU |
|
|
|
@Query("SELECT externalId FROM EntityViewEntity WHERE id = :id") |
|
|
|
UUID getExternalIdById(@Param("id") UUID id); |
|
|
|
|
|
|
|
@Query("SELECT new org.thingsboard.server.common.data.edqs.fields.GenericFields(e.id, e.createdTime, e.tenantId," + |
|
|
|
"e.name, e.version) FROM EntityViewEntity e WHERE e.id > :id ORDER BY e.id") |
|
|
|
@Query("SELECT new org.thingsboard.server.common.data.edqs.fields.EntityViewFields(e.id, e.createdTime, e.tenantId, " + |
|
|
|
"e.customerId, e.name, e.type, e.additionalInfo, e.version) " + |
|
|
|
"FROM EntityViewEntity e WHERE e.id > :id ORDER BY e.id") |
|
|
|
List<EntityViewFields> findNextBatch(@Param("id") UUID id, Limit limit); |
|
|
|
} |
|
|
|
|