Skip to content

Commit

Permalink
refactor: 불필요한 개행 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
hamcheeseburger committed Aug 3, 2022
1 parent 57b0c68 commit f3656e8
Showing 1 changed file with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -45,7 +44,7 @@ public Slice<Member> 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)
Expand All @@ -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;
Expand All @@ -92,7 +90,6 @@ private Slice<Member> toSlice(final Pageable pageable, final List<Member> member
members.remove(members.size() - 1);
return new SliceImpl<>(members, pageable, true);
}

return new SliceImpl<>(members, pageable, false);
}
}

0 comments on commit f3656e8

Please sign in to comment.