-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from AlongTheBlue/develop
[Feat] cafe 검색 pagination 구현
- Loading branch information
Showing
3 changed files
with
37 additions
and
21 deletions.
There are no files selected for viewing
5 changes: 3 additions & 2 deletions
5
src/main/java/org/alongtheblue/alongtheblue_server/global/data/cafe/CafeRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,21 @@ | ||
package org.alongtheblue.alongtheblue_server.global.data.cafe; | ||
|
||
import org.alongtheblue.alongtheblue_server.global.data.global.SimpleInformation; | ||
import org.alongtheblue.alongtheblue_server.global.data.search.SearchInformation; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
public interface CafeRepository extends JpaRepository<Cafe, Long> { | ||
|
||
@Query("SELECT c FROM Cafe c JOIN c.images i GROUP BY c HAVING COUNT(i) > 0") | ||
Page<SimpleInformation> findAllSimple(Pageable pageable); | ||
|
||
List<Cafe> findByTitleContaining(String keyword); | ||
@Query("SELECT c FROM Cafe c JOIN c.images i WHERE c.title LIKE %:keyword% GROUP BY c HAVING COUNT(i) > 0") | ||
Page<SearchInformation> findByTitleContaining(String keyword, Pageable pageable); | ||
|
||
Optional<Cafe> findByContentId(String contentId); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters