Update booklore-api/src/main/java/com/adityachandel/booklore/repository/BookRepository.java
Co-authored-by: Aditya Chandel <8075870+adityachandelgit@users.noreply.github.com>
This commit is contained in:
committed by
Aditya Chandel
co-authored by
Aditya Chandel
parent
c7d16454a0
commit
d348728f74
+9
-9
@@ -57,19 +57,19 @@ public interface BookRepository extends JpaRepository<BookEntity, Long>, JpaSpec
|
|||||||
""")
|
""")
|
||||||
List<BookEntity> findAllFullBooks();
|
List<BookEntity> findAllFullBooks();
|
||||||
|
|
||||||
@Query("""
|
@Query("""
|
||||||
SELECT DISTINCT b FROM BookEntity b
|
SELECT DISTINCT b FROM BookEntity b
|
||||||
LEFT JOIN FETCH b.metadata m
|
LEFT JOIN FETCH b.metadata m
|
||||||
LEFT JOIN FETCH m.authors a
|
LEFT JOIN FETCH m.authors a
|
||||||
LEFT JOIN FETCH m.categories
|
LEFT JOIN FETCH m.categories
|
||||||
LEFT JOIN FETCH b.shelves
|
WHERE LOWER(m.title) LIKE LOWER(CONCAT('%', :text, '%'))
|
||||||
WHERE (b.metadata.title like %:text%)
|
OR LOWER(m.subtitle) LIKE LOWER(CONCAT('%', :text, '%'))
|
||||||
OR (b.metadata.subtitle like %:text%)
|
OR LOWER(m.description) LIKE LOWER(CONCAT('%', :text, '%'))
|
||||||
OR (b.metadata.description like %:text%)
|
OR LOWER(m.seriesName) LIKE LOWER(CONCAT('%', :text, '%'))
|
||||||
OR (b.metadata.seriesName like %:text%)
|
OR LOWER(a.name) LIKE LOWER(CONCAT('%', :text, '%'))
|
||||||
OR (a.name like %:text%)
|
ORDER BY m.title ASC
|
||||||
""")
|
""")
|
||||||
List<BookEntity> findBooksContainingMetadata(@Param("text") String text);
|
List<BookEntity> findBooksContainingMetadata(@Param("text") String text);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user