Skip to content

Commit

Permalink
#39 [Update] 업장 검색 null 값 처리
Browse files Browse the repository at this point in the history
  • Loading branch information
Anna-Jin committed Jul 29, 2022
1 parent 03287a0 commit a0f862d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/main/java/com/mpnp/baechelin/common/QueryDslSearch.java
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,16 @@ public StoreDetailResponseDto getStore(

@ApiOperation(value = "시/도 정보를 이용해 DB에 존재하는 시/군/구 정보를 조회하는 메소드")
@GetMapping("/location/sigungu")
public Map<String, List<String>> getSigungu(@RequestParam(required = false) String sido) {
public Map<String, List<String>> getSigungu(@RequestParam String sido) {
return storeService.getSigungu(sido);
}

@ApiOperation(value = "시/도, 시/군/구, 검색어를 이용해 업장 리스트를 조회하는 메소드")
@GetMapping("/search")
public List<StoreCardResponseDto> 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) {

Expand Down

0 comments on commit a0f862d

Please sign in to comment.