Skip to content

Commit 950cd49

Browse files
authored
fix: SQL을 잘못 쓴 이슈,, (#400)
1 parent e0b2c16 commit 950cd49

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/main/java/com/gamzabat/algohub/feature/group/studygroup/controller/StudyGroupController.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
import java.util.List;
44

5+
import org.springdoc.core.annotations.ParameterObject;
56
import org.springframework.data.domain.Page;
67
import org.springframework.data.domain.Pageable;
8+
import org.springframework.data.domain.Sort;
79
import org.springframework.data.web.PageableDefault;
810
import org.springframework.http.MediaType;
911
import org.springframework.http.ResponseEntity;
@@ -202,7 +204,7 @@ public ResponseEntity<List<GetGroupSettingResponse>> getStudyGroupSettings(@Auth
202204
@GetMapping(value = "/groups/search")
203205
@Operation(summary = "그룹 검색 API", description = "홈 화면에서 그룹을 검색하는 API")
204206
public ResponseEntity<Page<GetGroupResponse>> getSearchedGroupList(@RequestParam String searchPattern,
205-
@PageableDefault(size = 20, page = 0) Pageable pageable) {
207+
@ParameterObject @PageableDefault(size = 20, sort = "id", direction = Sort.Direction.DESC, page = 0) Pageable pageable) {
206208
Page<GetGroupResponse> responses = studyGroupService.getSearchedStudyGroupList(searchPattern, pageable);
207209
return ResponseEntity.ok().body(responses);
208210
}

src/main/java/com/gamzabat/algohub/feature/group/studygroup/repository/StudyGroupRepository.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ public interface StudyGroupRepository extends JpaRepository<StudyGroup, Long>, C
1919
Optional<StudyGroup> findById(Long id);
2020

2121
@Query(value = """
22-
select sg from StudyGroup sg
22+
select * from study_group sg
2323
where match (sg.name,sg.introduction)
24-
against(:searchPattern in natural language mode)
24+
against(:searchPattern in boolean mode)
2525
""", nativeQuery = true)
2626
Page<StudyGroup> findBySearchPattern(@Param("searchPattern") String searchPattern, Pageable pageable);
2727
}

0 commit comments

Comments
 (0)