store Search
This commit is contained in:
parent
0289976085
commit
e53b67c66c
@ -99,6 +99,27 @@ public class StoreService implements StoreUseCase {
|
|||||||
return storeJpaRepository.findById(storeId).get().getTagsJson();
|
return storeJpaRepository.findById(storeId).get().getTagsJson();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<StoreListResponse> getSearchStoreName(String storeName){
|
||||||
|
List<StoreEntity> stores = storeJpaRepository.finByStoreNameContaining(storeName);
|
||||||
|
|
||||||
|
return stores.stream()
|
||||||
|
.map(store -> StoreListResponse.builder()
|
||||||
|
.storeId(store.getId())
|
||||||
|
.storeName(store.getStoreName())
|
||||||
|
.address(store.getAddress())
|
||||||
|
.category(store.getCategory())
|
||||||
|
.rating(store.getRating())
|
||||||
|
.reviewCount(store.getReviewCount())
|
||||||
|
.status("운영중")
|
||||||
|
.tagJson(store.getTagsJson())
|
||||||
|
.imageUrl(store.getImageUrl())
|
||||||
|
.operatingHours(store.getOperatingHours())
|
||||||
|
.build())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<StoreListResponse> getCategoryStores(String category){
|
public List<StoreListResponse> getCategoryStores(String category){
|
||||||
List<StoreEntity> stores = storeJpaRepository.findByCategory(category);
|
List<StoreEntity> stores = storeJpaRepository.findByCategory(category);
|
||||||
|
|||||||
@ -35,6 +35,7 @@ public interface StoreUseCase {
|
|||||||
|
|
||||||
List<StoreListResponse> getCategoryStores(String category);
|
List<StoreListResponse> getCategoryStores(String category);
|
||||||
|
|
||||||
|
List<StoreListResponse> getSearchStoreName(String storeName);
|
||||||
|
|
||||||
String getAllTags(Long storeId);
|
String getAllTags(Long storeId);
|
||||||
|
|
||||||
|
|||||||
@ -59,6 +59,8 @@ public class StoreController {
|
|||||||
.body(ApiResponse.success(response, "매장이 성공적으로 등록되었습니다."));
|
.body(ApiResponse.success(response, "매장이 성공적으로 등록되었습니다."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Operation(summary = "내 매장 목록 조회", description = "점주가 등록한 매장 목록을 조회합니다.")
|
@Operation(summary = "내 매장 목록 조회", description = "점주가 등록한 매장 목록을 조회합니다.")
|
||||||
@GetMapping("/my")
|
@GetMapping("/my")
|
||||||
@PreAuthorize("hasRole('OWNER')")
|
@PreAuthorize("hasRole('OWNER')")
|
||||||
@ -71,6 +73,8 @@ public class StoreController {
|
|||||||
return ResponseEntity.ok(ApiResponse.success(responses, "내 매장 목록 조회 완료"));
|
return ResponseEntity.ok(ApiResponse.success(responses, "내 매장 목록 조회 완료"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/stores/all")
|
@GetMapping("/stores/all")
|
||||||
@Operation(summary = "매장 전체 리스트")
|
@Operation(summary = "매장 전체 리스트")
|
||||||
public ResponseEntity<ApiResponse<List<StoreListResponse>>> getAllStores() {
|
public ResponseEntity<ApiResponse<List<StoreListResponse>>> getAllStores() {
|
||||||
@ -79,6 +83,16 @@ public class StoreController {
|
|||||||
return ResponseEntity.ok(ApiResponse.success(responses));
|
return ResponseEntity.ok(ApiResponse.success(responses));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "매장 조회", description = "가게 검색한 매장 목록을 조회합니다.")
|
||||||
|
@GetMapping("/search/storeName/{storeName}")
|
||||||
|
public ResponseEntity<ApiResponse<List<StoreListResponse>>> getSearchStores(
|
||||||
|
HttpServletRequest httpRequest, @PathVariable String storeName) {
|
||||||
|
|
||||||
|
List<StoreListResponse> responses = storeUseCase.getSearchStoreName(storeName);
|
||||||
|
|
||||||
|
return ResponseEntity.ok(ApiResponse.success(responses));
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/stores/category/{category}")
|
@GetMapping("/stores/category/{category}")
|
||||||
@Operation(summary = "카테고리에 해당하는 매장")
|
@Operation(summary = "카테고리에 해당하는 매장")
|
||||||
public ResponseEntity<ApiResponse<List<StoreListResponse>>> getStoreCategories(@PathVariable String category) {
|
public ResponseEntity<ApiResponse<List<StoreListResponse>>> getStoreCategories(@PathVariable String category) {
|
||||||
|
|||||||
@ -46,6 +46,8 @@ public interface StoreJpaRepository extends JpaRepository<StoreEntity, Long> {
|
|||||||
*/
|
*/
|
||||||
List<StoreEntity> findByCategory(String category);
|
List<StoreEntity> findByCategory(String category);
|
||||||
|
|
||||||
|
@Query("SELECT s FROM StoreEntity s WHERE s.storeName like %:storeName%")
|
||||||
|
List<StoreEntity> finByStoreNameContaining(@Param("keyword") String storeName);
|
||||||
/**
|
/**
|
||||||
* 상태로 매장 조회
|
* 상태로 매장 조회
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user