Browse Source

fixed search for resources

pull/4871/head
YevhenBondarenko 5 years ago
committed by Andrew Shvayka
parent
commit
3fc45654e8
  1. 4
      dao/src/main/java/org/thingsboard/server/dao/sql/resource/TbResourceInfoRepository.java

4
dao/src/main/java/org/thingsboard/server/dao/sql/resource/TbResourceInfoRepository.java

@ -27,7 +27,7 @@ import java.util.UUID;
public interface TbResourceInfoRepository extends CrudRepository<TbResourceInfoEntity, UUID> {
@Query("SELECT tr FROM TbResourceInfoEntity tr WHERE " +
"LOWER(tr.searchText) LIKE LOWER(CONCAT(:searchText, '%'))" +
"LOWER(tr.title) LIKE LOWER(CONCAT('%', :searchText, '%'))" +
"AND (tr.tenantId = :tenantId " +
"OR (tr.tenantId = :systemAdminId " +
"AND NOT EXISTS " +
@ -42,7 +42,7 @@ public interface TbResourceInfoRepository extends CrudRepository<TbResourceInfoE
@Query("SELECT ri FROM TbResourceInfoEntity ri WHERE " +
"ri.tenantId = :tenantId " +
"AND LOWER(ri.searchText) LIKE LOWER(CONCAT(:searchText, '%'))")
"AND LOWER(ri.title) LIKE LOWER(CONCAT('%', :searchText, '%'))")
Page<TbResourceInfoEntity> findTenantResourcesByTenantId(@Param("tenantId") UUID tenantId,
@Param("searchText") String searchText,
Pageable pageable);

Loading…
Cancel
Save