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 30, 2022
1 parent a280912 commit ebdd25b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/main/java/com/mpnp/baechelin/common/QueryDslSearch.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public static BooleanExpression matchAddressWithSido(String sido) {
"function('match', {0}, {1}, {2})", store.address, store.address, sido).gt(0);
}
public static BooleanExpression matchAddressWithSidoAndSigungu(String sido, String sigungu) {
String[] diviedSigungu = sigungu.split(" ");

// sido가 null이면 sigungu는 무조건 null
if (StringUtils.isEmpty(sido)) {
Expand All @@ -28,12 +27,12 @@ public static BooleanExpression matchAddressWithSidoAndSigungu(String sido, Stri
return Expressions.numberTemplate(
Integer.class,
"function('match', {0}, {1}, {2})", store.address, store.address, sido).gt(0);
} else if (diviedSigungu.length > 1) {
} else if (sigungu.split(" ").length > 1) {
// sigungu가 도/시/구 로 나눠져있을 때 (ex. 경기도 성남시 분당구)
// 정확한 검색을 위해 + 연산자 추가
return Expressions.numberTemplate(
Integer.class,
"function('match', {0}, {1}, {2})", store.address, store.address, sido + " +" + diviedSigungu[0] + " +" + diviedSigungu[1]).gt(0);
"function('match', {0}, {1}, {2})", store.address, store.address, sido + " +" + sigungu.split(" ")[0] + " +" + sigungu.split(" ")[1]).gt(0);
} else {
return Expressions.numberTemplate(
Integer.class,
Expand Down

0 comments on commit ebdd25b

Please sign in to comment.