From a0f862d14e28991b4bd268b84dd9100a28019bd4 Mon Sep 17 00:00:00 2001 From: Anna-Jin Date: Sat, 30 Jul 2022 03:25:49 +0900 Subject: [PATCH] =?UTF-8?q?#39=20[Update]=20=EC=97=85=EC=9E=A5=20=EA=B2=80?= =?UTF-8?q?=EC=83=89=20null=20=EA=B0=92=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/mpnp/baechelin/common/QueryDslSearch.java | 4 +++- .../mpnp/baechelin/store/controller/StoreController.java | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/mpnp/baechelin/common/QueryDslSearch.java b/src/main/java/com/mpnp/baechelin/common/QueryDslSearch.java index 40f347e..78f4978 100644 --- a/src/main/java/com/mpnp/baechelin/common/QueryDslSearch.java +++ b/src/main/java/com/mpnp/baechelin/common/QueryDslSearch.java @@ -13,7 +13,9 @@ public static BooleanExpression matchAddress(String sido, String sigungu) { if (StringUtils.isEmpty(sido)) { return null; } else if (StringUtils.isEmpty(sigungu)) { - return null; + return Expressions.numberTemplate( + Integer.class, + "function('match', {0}, {1}, {2})", store.address, store.address, sido).gt(0); } return Expressions.numberTemplate( Integer.class, diff --git a/src/main/java/com/mpnp/baechelin/store/controller/StoreController.java b/src/main/java/com/mpnp/baechelin/store/controller/StoreController.java index 1bcf3fc..2eaff96 100644 --- a/src/main/java/com/mpnp/baechelin/store/controller/StoreController.java +++ b/src/main/java/com/mpnp/baechelin/store/controller/StoreController.java @@ -89,16 +89,16 @@ public StoreDetailResponseDto getStore( @ApiOperation(value = "시/도 정보를 이용해 DB에 존재하는 시/군/구 정보를 조회하는 메소드") @GetMapping("/location/sigungu") - public Map> getSigungu(@RequestParam(required = false) String sido) { + public Map> getSigungu(@RequestParam String sido) { return storeService.getSigungu(sido); } @ApiOperation(value = "시/도, 시/군/구, 검색어를 이용해 업장 리스트를 조회하는 메소드") @GetMapping("/search") public List searchStoresByKeyword( - @RequestParam String sido, - @RequestParam String sigungu, - @RequestParam String keyword, + @RequestParam(required = false) String sido, + @RequestParam(required = false) String sigungu, + @RequestParam(required = false) String keyword, @PageableDefault Pageable pageable, @AuthenticationPrincipal User user) {