|
|
|
@ -44,17 +44,10 @@ public interface EdgeRepository extends JpaRepository<EdgeEntity, UUID> { |
|
|
|
"WHERE d.id = :edgeId") |
|
|
|
EdgeInfoEntity findEdgeInfoById(@Param("edgeId") UUID edgeId); |
|
|
|
|
|
|
|
@Query(value = "SELECT ee.id, ee.created_time, ee.additional_info, ee.customer_id, " + |
|
|
|
"ee.root_rule_chain_id, ee.type, ee.name, ee.label, ee.routing_key, " + |
|
|
|
"ee.secret, ee.tenant_id, ee.version " + |
|
|
|
"FROM edge ee " + |
|
|
|
"JOIN attribute_kv ON ee.id = attribute_kv.entity_id " + |
|
|
|
"JOIN key_dictionary ON attribute_kv.attribute_key = key_dictionary.key_id " + |
|
|
|
"WHERE attribute_kv.bool_v = true AND key_dictionary.key = 'active' " + |
|
|
|
"AND (:textSearch IS NULL OR ee.name ILIKE CONCAT('%', :textSearch, '%')) " + |
|
|
|
"ORDER BY ee.id", nativeQuery = true) |
|
|
|
Page<EdgeEntity> findActiveEdges(@Param("textSearch") String textSearch, |
|
|
|
Pageable pageable); |
|
|
|
@Query(value = "SELECT * FROM edge_active_attribute_view edge_active", |
|
|
|
countQuery = "SELECT count(*) FROM edge_active_attribute_view", |
|
|
|
nativeQuery = true) |
|
|
|
Page<EdgeEntity> findActiveEdges(Pageable pageable); |
|
|
|
|
|
|
|
@Query("SELECT d.id FROM EdgeEntity d WHERE d.tenantId = :tenantId " + |
|
|
|
"AND (:textSearch IS NULL OR ilike(d.name, CONCAT('%', :textSearch, '%')) = true)") |
|
|
|
@ -171,4 +164,5 @@ public interface EdgeRepository extends JpaRepository<EdgeEntity, UUID> { |
|
|
|
@Query("SELECT new org.thingsboard.server.common.data.edqs.fields.EdgeFields(e.id, e.createdTime, e.tenantId, e.customerId," + |
|
|
|
"e.name, e.version, e.type, e.label, e.additionalInfo) FROM EdgeEntity e WHERE e.id > :id ORDER BY e.id") |
|
|
|
List<EdgeFields> findNextBatch(@Param("id") UUID id, Limit limit); |
|
|
|
|
|
|
|
} |
|
|
|
|