Skip to content

Commit

Permalink
[STYLE] 코드 정렬
Browse files Browse the repository at this point in the history
  • Loading branch information
05AM committed Dec 2, 2023
1 parent e924843 commit e909800
Show file tree
Hide file tree
Showing 4 changed files with 145 additions and 147 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public class ReadOrderHistoryListRes {
private List<OrderHistoryInfo> orderHistoryInfoList;
private OrderHistoryPageInfo orderHistoryPageInfo;

public static ReadOrderHistoryListRes of(List<OrderHistoryInfo> orderHistoryInfoList,
public static ReadOrderHistoryListRes of(
List<OrderHistoryInfo> orderHistoryInfoList,
OrderHistoryPageInfo orderHistoryPageInfo) {
return new ReadOrderHistoryListRes(orderHistoryInfoList, orderHistoryPageInfo);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package org.tattour.server.domain.order.provider.vo;

import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.tattour.server.domain.order.domain.OrderStatus;

@Getter
@Setter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.hibernate.annotations.DynamicUpdate;
import org.tattour.server.domain.discount.domain.Discount;
import org.tattour.server.domain.order.domain.Order;
import org.tattour.server.domain.user.domain.ProductLiked;
import org.tattour.server.global.util.AuditingTimeEntity;

@Table(name = "sticker")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package org.tattour.server.domain.sticker.repository.impl;

import static org.tattour.server.domain.order.domain.QOrder.*;
import static org.tattour.server.domain.sticker.domain.QSticker.*;
import static org.tattour.server.domain.sticker.domain.QStickerStyle.*;
import static org.tattour.server.domain.sticker.domain.QStickerTheme.*;
import static org.tattour.server.domain.style.domain.QStyle.*;
import static org.tattour.server.domain.theme.domain.QTheme.*;
import static org.tattour.server.domain.order.domain.QOrder.order;
import static org.tattour.server.domain.sticker.domain.QSticker.sticker;
import static org.tattour.server.domain.sticker.domain.QStickerStyle.stickerStyle;
import static org.tattour.server.domain.sticker.domain.QStickerTheme.stickerTheme;
import static org.tattour.server.domain.style.domain.QStyle.style;
import static org.tattour.server.domain.theme.domain.QTheme.theme;

import com.querydsl.core.types.dsl.BooleanExpression;
import com.querydsl.jpa.impl.JPAQueryFactory;
Expand All @@ -17,148 +17,148 @@
@RequiredArgsConstructor
public class StickerRepositoryImpl implements StickerRepositoryCustom {

private final JPAQueryFactory queryFactory;
private final JPAQueryFactory queryFactory;

@Override
public List<Sticker> findAllByStateAndIsCustomInOrderOrder() {
return queryFactory
.select(sticker)
.from(sticker)
.leftJoin(sticker.orders)
.where(sticker.isCustom.eq(true), sticker.state.eq(true))
.groupBy(sticker.id)
.orderBy(sticker.orders.size().desc())
.fetch();
}
@Override
public List<Sticker> findAllByStateAndIsCustomInOrderOrder() {
return queryFactory
.select(sticker)
.from(sticker)
.leftJoin(sticker.orders)
.where(sticker.isCustom.eq(true), sticker.state.eq(true))
.groupBy(sticker.id)
.orderBy(sticker.orders.size().desc())
.fetch();
}

@Override
public List<Sticker> findAllSameThemeOrStyleById(Integer id) {
return queryFactory
.select(sticker).distinct()
.from(sticker)
.leftJoin(sticker.stickerThemes, stickerTheme)
.leftJoin(sticker.stickerStyles, stickerStyle)
.where(sticker.state.eq(true))
.where(stickerTheme.theme.in(
queryFactory
.select(stickerTheme.theme)
.from(stickerTheme)
.where(stickerTheme.sticker.id.eq(id))
).or(stickerStyle.style.in(
queryFactory
.select(stickerStyle.style)
.from(stickerStyle)
.where(stickerStyle.sticker.id.eq(id))
)))
.orderBy(sticker.id.asc())
.fetch();
}
@Override
public List<Sticker> findAllSameThemeOrStyleById(Integer id) {
return queryFactory
.select(sticker).distinct()
.from(sticker)
.leftJoin(sticker.stickerThemes, stickerTheme)
.leftJoin(sticker.stickerStyles, stickerStyle)
.where(sticker.state.eq(true))
.where(stickerTheme.theme.in(
queryFactory
.select(stickerTheme.theme)
.from(stickerTheme)
.where(stickerTheme.sticker.id.eq(id))
).or(stickerStyle.style.in(
queryFactory
.select(stickerStyle.style)
.from(stickerStyle)
.where(stickerStyle.sticker.id.eq(id))
)))
.orderBy(sticker.id.asc())
.fetch();
}

@Override
public List<Sticker> findAllByThemeNameAndStyleNameAndStateInOrderOrder(
String themeName,
String styleName) {
return queryFactory
.select(sticker).distinct()
.from(sticker)
.leftJoin(sticker.stickerThemes, stickerTheme)
.leftJoin(sticker.stickerStyles, stickerStyle)
.leftJoin(sticker.orders, order)
.fetchJoin()
.where(sticker.state.eq(true))
.where(stickerTheme.theme.in(
queryFactory
.select(theme)
.from(theme)
.where(eqThemeName(themeName))
).and(stickerStyle.style.in(
queryFactory
.select(style)
.from(style)
.where(eqStyleName(styleName))
)))
.fetch();
}
@Override
public List<Sticker> findAllByThemeNameAndStyleNameAndStateInOrderOrder(
String themeName,
String styleName) {
return queryFactory
.select(sticker).distinct()
.from(sticker)
.leftJoin(sticker.stickerThemes, stickerTheme)
.leftJoin(sticker.stickerStyles, stickerStyle)
.leftJoin(sticker.orders, order)
.fetchJoin()
.where(sticker.state.eq(true))
.where(stickerTheme.theme.in(
queryFactory
.select(theme)
.from(theme)
.where(eqThemeName(themeName))
).and(stickerStyle.style.in(
queryFactory
.select(style)
.from(style)
.where(eqStyleName(styleName))
)))
.fetch();
}

@Override
public List<Sticker> findAllByThemeNameAndStyleNameAndStateInOrderPrice(String themeName,
String styleName) {
return queryFactory
.select(sticker).distinct()
.from(sticker)
.leftJoin(sticker.stickerThemes, stickerTheme)
.leftJoin(sticker.stickerStyles, stickerStyle)
.leftJoin(sticker.orders, order)
.fetchJoin()
.where(sticker.state.eq(true))
.where(stickerTheme.theme.in(
queryFactory
.select(theme)
.from(theme)
.where(eqThemeName(themeName))
).and(stickerStyle.style.in(
queryFactory
.select(style)
.from(style)
.where(eqStyleName(styleName))
)))
.orderBy(sticker.price.asc())
.fetch();
}
@Override
public List<Sticker> findAllByThemeNameAndStyleNameAndStateInOrderPrice(String themeName,
String styleName) {
return queryFactory
.select(sticker).distinct()
.from(sticker)
.leftJoin(sticker.stickerThemes, stickerTheme)
.leftJoin(sticker.stickerStyles, stickerStyle)
.leftJoin(sticker.orders, order)
.fetchJoin()
.where(sticker.state.eq(true))
.where(stickerTheme.theme.in(
queryFactory
.select(theme)
.from(theme)
.where(eqThemeName(themeName))
).and(stickerStyle.style.in(
queryFactory
.select(style)
.from(style)
.where(eqStyleName(styleName))
)))
.orderBy(sticker.price.asc())
.fetch();
}

@Override
public List<Sticker> findAllByThemeNameAndStyleNameAndStateInOrderPriceDesc(String themeName,
String styleName) {
return queryFactory
.select(sticker).distinct()
.from(sticker)
.leftJoin(sticker.stickerThemes, stickerTheme)
.leftJoin(sticker.stickerStyles, stickerStyle)
.leftJoin(sticker.orders, order)
.fetchJoin()
.where(sticker.state.eq(true))
.where(stickerTheme.theme.in(
queryFactory
.select(theme)
.from(theme)
.where(eqThemeName(themeName))
).and(stickerStyle.style.in(
queryFactory
.select(style)
.from(style)
.where(eqStyleName(styleName))
)))
.orderBy(sticker.price.desc())
.fetch();
}
@Override
public List<Sticker> findAllByThemeNameAndStyleNameAndStateInOrderPriceDesc(String themeName,
String styleName) {
return queryFactory
.select(sticker).distinct()
.from(sticker)
.leftJoin(sticker.stickerThemes, stickerTheme)
.leftJoin(sticker.stickerStyles, stickerStyle)
.leftJoin(sticker.orders, order)
.fetchJoin()
.where(sticker.state.eq(true))
.where(stickerTheme.theme.in(
queryFactory
.select(theme)
.from(theme)
.where(eqThemeName(themeName))
).and(stickerStyle.style.in(
queryFactory
.select(style)
.from(style)
.where(eqStyleName(styleName))
)))
.orderBy(sticker.price.desc())
.fetch();
}

@Override
public List<Sticker> findAllByThemeNameOrStyleNameOrNameContaining(String word) {
return queryFactory
.select(sticker).distinct()
.from(sticker)
.leftJoin(sticker.stickerThemes, stickerTheme)
.leftJoin(sticker.stickerStyles, stickerStyle)
.where(sticker.state.eq(true))
.where(stickerTheme.theme.in(
queryFactory
.select(theme)
.from(theme)
.where(theme.name.contains(word))
).or(stickerStyle.style.in(
queryFactory
.select(style)
.from(style)
.where(style.name.contains(word))
)).or(sticker.name.contains(word)))
.fetch();
}
@Override
public List<Sticker> findAllByThemeNameOrStyleNameOrNameContaining(String word) {
return queryFactory
.select(sticker).distinct()
.from(sticker)
.leftJoin(sticker.stickerThemes, stickerTheme)
.leftJoin(sticker.stickerStyles, stickerStyle)
.where(sticker.state.eq(true))
.where(stickerTheme.theme.in(
queryFactory
.select(theme)
.from(theme)
.where(theme.name.contains(word))
).or(stickerStyle.style.in(
queryFactory
.select(style)
.from(style)
.where(style.name.contains(word))
)).or(sticker.name.contains(word)))
.fetch();
}

private BooleanExpression eqStyleName(String styleName) {
return styleName == null ? null : style.name.eq(styleName);
}
private BooleanExpression eqStyleName(String styleName) {
return styleName == null ? null : style.name.eq(styleName);
}

private BooleanExpression eqThemeName(String themeName) {
return themeName == null ? null : theme.name.eq(themeName);
}
}
private BooleanExpression eqThemeName(String themeName) {
return themeName == null ? null : theme.name.eq(themeName);
}
}

0 comments on commit e909800

Please sign in to comment.