Merge pull request #12868 from thingsboard/fix/entity-view-edqs
EDQS: fix entity views sync
This commit is contained in:
		
						commit
						42ba543fb0
					
				@ -15,12 +15,15 @@
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
package org.thingsboard.server.common.data.edqs.fields;
 | 
					package org.thingsboard.server.common.data.edqs.fields;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.fasterxml.jackson.databind.JsonNode;
 | 
				
			||||||
import lombok.Data;
 | 
					import lombok.Data;
 | 
				
			||||||
import lombok.NoArgsConstructor;
 | 
					import lombok.NoArgsConstructor;
 | 
				
			||||||
import lombok.experimental.SuperBuilder;
 | 
					import lombok.experimental.SuperBuilder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.UUID;
 | 
					import java.util.UUID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import static org.thingsboard.server.common.data.edqs.fields.FieldsUtil.getText;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Data
 | 
					@Data
 | 
				
			||||||
@NoArgsConstructor
 | 
					@NoArgsConstructor
 | 
				
			||||||
@SuperBuilder
 | 
					@SuperBuilder
 | 
				
			||||||
@ -29,9 +32,9 @@ public class EntityViewFields extends AbstractEntityFields {
 | 
				
			|||||||
    private String type;
 | 
					    private String type;
 | 
				
			||||||
    private String additionalInfo;
 | 
					    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);
 | 
					        super(id, createdTime, tenantId, customerId, name, version);
 | 
				
			||||||
        this.type = type;
 | 
					        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")
 | 
					    @Query("SELECT externalId FROM EntityViewEntity WHERE id = :id")
 | 
				
			||||||
    UUID getExternalIdById(@Param("id") UUID id);
 | 
					    UUID getExternalIdById(@Param("id") UUID id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Query("SELECT new org.thingsboard.server.common.data.edqs.fields.GenericFields(e.id, e.createdTime, e.tenantId," +
 | 
					    @Query("SELECT new org.thingsboard.server.common.data.edqs.fields.EntityViewFields(e.id, e.createdTime, e.tenantId, " +
 | 
				
			||||||
            "e.name, e.version) FROM EntityViewEntity e WHERE e.id > :id ORDER BY e.id")
 | 
					            "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);
 | 
					    List<EntityViewFields> findNextBatch(@Param("id") UUID id, Limit limit);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user