PostgreSQL View for active Edges
- removed testSearch
This commit is contained in:
parent
42f892152f
commit
f990cad134
@ -44,12 +44,10 @@ public interface EdgeRepository extends JpaRepository<EdgeEntity, UUID> {
|
||||
"WHERE d.id = :edgeId")
|
||||
EdgeInfoEntity findEdgeInfoById(@Param("edgeId") UUID edgeId);
|
||||
|
||||
@Query(value = "SELECT * " +
|
||||
"FROM edge_active_attribute_view edge_active " +
|
||||
"WHERE (:textSearch IS NULL OR edge_active.name ILIKE CONCAT('%', :textSearch, '%')) " +
|
||||
"ORDER BY edge_active.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)")
|
||||
@ -166,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);
|
||||
|
||||
}
|
||||
|
||||
@ -68,10 +68,7 @@ public class JpaEdgeDao extends JpaAbstractDao<EdgeEntity, Edge> implements Edge
|
||||
|
||||
@Override
|
||||
public PageData<Edge> findActiveEdges(PageLink pageLink) {
|
||||
return DaoUtil.toPageData(
|
||||
edgeRepository.findActiveEdges(
|
||||
pageLink.getTextSearch(),
|
||||
DaoUtil.toPageable(pageLink)));
|
||||
return DaoUtil.toPageData(edgeRepository.findActiveEdges(DaoUtil.toPageable(pageLink)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -89,7 +89,8 @@ SELECT ee.id
|
||||
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';
|
||||
WHERE attribute_kv.bool_v = true AND key_dictionary.key = 'active'
|
||||
ORDER BY ee.id;
|
||||
|
||||
CREATE OR REPLACE FUNCTION create_or_update_active_alarm(
|
||||
t_id uuid, c_id uuid, a_id uuid, a_created_ts bigint,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user