File tree Expand file tree Collapse file tree
src/main/java/com/back/web7_9_codecrete_be/domain/concerts Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616import io .swagger .v3 .oas .annotations .media .Schema ;
1717import io .swagger .v3 .oas .annotations .tags .Tag ;
1818import lombok .RequiredArgsConstructor ;
19+ import lombok .extern .slf4j .Slf4j ;
1920import org .springdoc .core .converters .models .PageableAsQueryParam ;
2021import org .springframework .data .domain .Page ;
2122import org .springframework .data .domain .PageRequest ;
2728import javax .swing .*;
2829import java .util .List ;
2930
31+ @ Slf4j
3032@ RestController
3133@ RequestMapping ("api/v1/concerts/" )
3234@ RequiredArgsConstructor
@@ -122,17 +124,17 @@ public RsData<ConcertLikeResponse> isLikeConcert(
122124 return RsData .success (concertService .isLikeConcert (concertId , user ));
123125 }
124126
125- // todo : 내용 구현 필요
126- @ Operation (summary = "공연 검색(구현 전) " , description = "공연 정보를 검색합니다." )
127+ // todo : 제목으로 만 검색 기능 구현 -> 추후 아티스트 정보랑 연동 <- 중요 / 정렬 기준? 최신등록순 정렬
128+ @ Operation (summary = "공연 검색" , description = "공연 정보를 검색합니다." )
127129 @ GetMapping ("search" )
128130 public RsData <List <ConcertItem >> searchConcert (
129131 @ Schema (description = "공연 정보 검색 키워드입니다." )
130- @ RequestParam String keyword
132+ @ RequestParam String keyword ,
133+ @ Schema (description = "페이징 처리 또는 무한 스크롤 구현에 쓸 Pageable 객체입니다." )
134+ Pageable pageable
135+
131136 ){
132- return null ;
137+ return RsData . success ( concertService . getConcertListByKeyword ( keyword , pageable )) ;
133138 }
134139
135-
136-
137-
138140}
Original file line number Diff line number Diff line change @@ -124,6 +124,33 @@ List<ConcertItem> getNoTicketTimeConcertList(
124124 )
125125 List <ConcertItem > getLikedConcertsList (Pageable pageable ,
126126 @ Param ("userId" ) Long userId );
127+ @ Query ("""
128+ SELECT
129+ new com.back.web7_9_codecrete_be.domain.concerts.dto.concert.ConcertItem(
130+ c.concertId as id,
131+ c.name as name,
132+ c.concertPlace.placeName as placeName,
133+ c.ticketTime as ticketTime,
134+ c.startDate as startDate,
135+ c.endDate as endDate,
136+ c.posterUrl as posterUrl,
137+ c.maxPrice as maxPrice,
138+ c.minPrice as minPrice,
139+ c.viewCount as viewCount,
140+ c.likeCount as likeCount
141+ )
142+ FROM
143+ Concert c
144+ WHERE
145+ c.name LIKE %:keyword%
146+ ORDER BY
147+ c.concertId
148+ DESC
149+ """ )
150+ List <ConcertItem > getConcertItemsByKeyword (
151+ @ Param ("keyword" )
152+ String keyword ,
153+ Pageable pageable );
127154
128155 @ Query ("""
129156 SELECT
Original file line number Diff line number Diff line change @@ -49,6 +49,14 @@ public List<ConcertItem> getNoTicketTimeConcertsList(Pageable pageable) {
4949 return concertRepository .getNoTicketTimeConcertList (pageable );
5050 }
5151
52+ public List <ConcertItem > getConcertListByKeyword (String keyword , Pageable pageable ) {
53+ if (keyword == null || keyword .isEmpty ()){
54+
55+ }
56+
57+ return concertRepository .getConcertItemsByKeyword (keyword , pageable );
58+ }
59+
5260 public ConcertDetailResponse getConcertDetail (long concertId ) {
5361 ConcertDetailResponse concertDetailResponse = concertRepository .getConcertDetailById (concertId );
5462 List <ConcertImage > concertImages = concertImageRepository .getConcertImagesByConcert_ConcertId (concertId );
You can’t perform that action at this time.
0 commit comments