Interface AssetRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<Asset,Long>, org.springframework.data.jpa.repository.JpaRepository<Asset, Long>, org.springframework.data.repository.ListCrudRepository<Asset, Long>, org.springframework.data.repository.ListPagingAndSortingRepository<Asset, Long>, org.springframework.data.repository.PagingAndSortingRepository<Asset, Long>, org.springframework.data.repository.query.QueryByExampleExecutor<Asset>, org.springframework.data.repository.Repository<Asset, Long>
-
Method Summary
Modifier and TypeMethodDescriptionfindAllByCompanyId(Long companyId) Busca todos os ativos associados a um ID de empresa específico.findByTicker(String ticker) Busca exata por Ticker.searchUnified(String term) Busca Unificada (Case-Insensitive) por Ticker, Nome do Ativo ou Nome da Empresa.Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, saveMethods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlushMethods inherited from interface org.springframework.data.repository.ListCrudRepository
findAll, findAllById, saveAllMethods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Method Details
-
findByTicker
-
findAllByCompanyId
-
searchUnified
@Query("SELECT a FROM Asset a LEFT JOIN a.company c WHERE (LOWER(a.ticker) LIKE LOWER(CONCAT('%', :term, '%'))) OR (a.name IS NOT NULL AND LOWER(a.name) LIKE LOWER(CONCAT('%', :term, '%'))) OR (c.name IS NOT NULL AND LOWER(c.name) LIKE LOWER(CONCAT('%', :term, '%')))") List<Asset> searchUnified(@Param("term") String term) Busca Unificada (Case-Insensitive) por Ticker, Nome do Ativo ou Nome da Empresa.Nota de Auditoria: Utiliza LIKE %...% que pode ser lento em grandes volumes. Considerar Full Text Search.
- Parameters:
term- Termo de busca parcial.- Returns:
- Lista de ativos correspondentes.
-