Skip to content

Commit

Permalink
refactor: 질문 리스트 조회, 질문 키워드 검색 조회 query 조건 중 active 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
donggi-lee-bit committed Oct 8, 2023
1 parent c44d331 commit 7bd8f94
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,16 @@

public interface QuestionJpaRepository extends QuestionRepository, JpaRepository<Question, Long> {

// TODO : active = true인 질문만 조회하도록 변경 필요
@Query(value = "select q.id from Question q where q.category in :categories and q.active = true")
List<Long> findAllByIdInCategories(@Param("categories") List<Category> categories);

@Query(value = "select max(q.id) from Question q ")
Optional<Long> findMaxId();

@Query(value = "select q from Question q where q.id <= :searchAfterId and q.active = true order by q.id desc")
@Query(value = "select q from Question q where q.id <= :searchAfterId order by q.id desc")
Slice<Question> findAllBySearchAfterIdAndPageable(@Param("searchAfterId") Long searchAfterId, Pageable ofSize);

@Query(value = "select q from Question q where q.content.content like %:keyword% and q.id <= :searchAfterId and q.active = true order by q.id desc")
@Query(value = "select q from Question q where q.content.content like %:keyword% and q.id <= :searchAfterId order by q.id desc")
Slice<Question> findAllByContentContainingAndSearchAfterIdAndPageable(@Param("keyword") String keyword, @Param("searchAfterId") Long searchAfterId, Pageable ofSize);

@Override
Expand Down

0 comments on commit 7bd8f94

Please sign in to comment.