diff --git a/back-end/reacton/src/main/java/com/softeer/reacton/domain/course/ProfessorCourseService.java b/back-end/reacton/src/main/java/com/softeer/reacton/domain/course/ProfessorCourseService.java index bba0b33..a80315b 100644 --- a/back-end/reacton/src/main/java/com/softeer/reacton/domain/course/ProfessorCourseService.java +++ b/back-end/reacton/src/main/java/com/softeer/reacton/domain/course/ProfessorCourseService.java @@ -109,9 +109,14 @@ public List searchCourses(String oauthId, String keyword) log.debug("검색 결과를 조회합니다."); Professor professor = getProfessorByOauthId(oauthId); - String escapedKeyword = escapeWildcard(keyword); - String searchKeyword = "%" + escapedKeyword + "%"; - List searchCourses = courseRepository.findCoursesWithSchedulesByProfessorAndKeyword(professor, searchKeyword); + List searchCourses; + if (keyword == null || keyword.isEmpty()) { + searchCourses = courseRepository.findCoursesWithSchedulesByProfessor(professor); + } else { + String escapedKeyword = escapeWildcard(keyword); + String searchKeyword = "%" + escapedKeyword + "%"; + searchCourses = courseRepository.findCoursesWithSchedulesByProfessorAndKeyword(professor, searchKeyword); + } return getAllCoursesResponse(searchCourses); }