From f3656e868603029e696094d094ca6e725ada5697 Mon Sep 17 00:00:00 2001 From: corinne Date: Wed, 3 Aug 2022 19:54:17 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=EA=B0=9C=ED=96=89=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/MemberRepositoryCustomImpl.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/backend/src/main/java/com/woowacourse/f12/domain/member/MemberRepositoryCustomImpl.java b/backend/src/main/java/com/woowacourse/f12/domain/member/MemberRepositoryCustomImpl.java index 27b678db..b3b6efd8 100644 --- a/backend/src/main/java/com/woowacourse/f12/domain/member/MemberRepositoryCustomImpl.java +++ b/backend/src/main/java/com/woowacourse/f12/domain/member/MemberRepositoryCustomImpl.java @@ -1,24 +1,23 @@ package com.woowacourse.f12.domain.member; -import static com.woowacourse.f12.domain.member.QMember.member; - import com.querydsl.core.types.Order; import com.querydsl.core.types.OrderSpecifier; import com.querydsl.core.types.dsl.BooleanExpression; import com.querydsl.core.types.dsl.PathBuilder; import com.querydsl.jpa.impl.JPAQuery; import com.querydsl.jpa.impl.JPAQueryFactory; - -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Slice; import org.springframework.data.domain.SliceImpl; import org.springframework.data.domain.Sort; import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import static com.woowacourse.f12.domain.member.QMember.member; + public class MemberRepositoryCustomImpl extends QuerydslRepositorySupport implements MemberRepositoryCustom { private final JPAQueryFactory jpaQueryFactory; @@ -45,7 +44,7 @@ public Slice findBySearchConditions(final String keyword, final CareerLe return toSlice(pageable, jpaQuery.fetch()); } - private OrderSpecifier [] makeOrderSpecifiers(final Pageable pageable) { + private OrderSpecifier[] makeOrderSpecifiers(final Pageable pageable) { return pageable.getSort() .stream() .map(this::toOrderSpecifier) @@ -59,13 +58,12 @@ private OrderSpecifier toOrderSpecifier(final Sort.Order sortOrder) { } private Order toOrder(final Sort.Order sortOrder) { - if(sortOrder.isAscending()) { + if (sortOrder.isAscending()) { return Order.ASC; } return Order.DESC; } - private BooleanExpression containsKeyword(final String keyword) { if (Objects.isNull(keyword) || keyword.isBlank()) { return null; @@ -92,7 +90,6 @@ private Slice toSlice(final Pageable pageable, final List member members.remove(members.size() - 1); return new SliceImpl<>(members, pageable, true); } - return new SliceImpl<>(members, pageable, false); } }