From e90980048142215e10d6cc6e9c031a56d336f502 Mon Sep 17 00:00:00 2001 From: Lee ChanMi Date: Sun, 3 Dec 2023 00:17:05 +0900 Subject: [PATCH] =?UTF-8?q?[STYLE]=20=EC=BD=94=EB=93=9C=20=EC=A0=95?= =?UTF-8?q?=EB=A0=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/ReadOrderHistoryListRes.java | 3 +- .../order/provider/vo/OrderHistoryInfo.java | 2 - .../server/domain/sticker/domain/Sticker.java | 1 - .../impl/StickerRepositoryImpl.java | 286 +++++++++--------- 4 files changed, 145 insertions(+), 147 deletions(-) diff --git a/server/src/main/java/org/tattour/server/domain/order/facade/dto/response/ReadOrderHistoryListRes.java b/server/src/main/java/org/tattour/server/domain/order/facade/dto/response/ReadOrderHistoryListRes.java index 4ed52e30..21e0713f 100644 --- a/server/src/main/java/org/tattour/server/domain/order/facade/dto/response/ReadOrderHistoryListRes.java +++ b/server/src/main/java/org/tattour/server/domain/order/facade/dto/response/ReadOrderHistoryListRes.java @@ -16,7 +16,8 @@ public class ReadOrderHistoryListRes { private List orderHistoryInfoList; private OrderHistoryPageInfo orderHistoryPageInfo; - public static ReadOrderHistoryListRes of(List orderHistoryInfoList, + public static ReadOrderHistoryListRes of( + List orderHistoryInfoList, OrderHistoryPageInfo orderHistoryPageInfo) { return new ReadOrderHistoryListRes(orderHistoryInfoList, orderHistoryPageInfo); } diff --git a/server/src/main/java/org/tattour/server/domain/order/provider/vo/OrderHistoryInfo.java b/server/src/main/java/org/tattour/server/domain/order/provider/vo/OrderHistoryInfo.java index 1a818de9..ec089aa7 100644 --- a/server/src/main/java/org/tattour/server/domain/order/provider/vo/OrderHistoryInfo.java +++ b/server/src/main/java/org/tattour/server/domain/order/provider/vo/OrderHistoryInfo.java @@ -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 diff --git a/server/src/main/java/org/tattour/server/domain/sticker/domain/Sticker.java b/server/src/main/java/org/tattour/server/domain/sticker/domain/Sticker.java index 639b0eee..1ea02304 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/domain/Sticker.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/domain/Sticker.java @@ -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") diff --git a/server/src/main/java/org/tattour/server/domain/sticker/repository/impl/StickerRepositoryImpl.java b/server/src/main/java/org/tattour/server/domain/sticker/repository/impl/StickerRepositoryImpl.java index 8dafb280..3dc2d465 100644 --- a/server/src/main/java/org/tattour/server/domain/sticker/repository/impl/StickerRepositoryImpl.java +++ b/server/src/main/java/org/tattour/server/domain/sticker/repository/impl/StickerRepositoryImpl.java @@ -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; @@ -17,148 +17,148 @@ @RequiredArgsConstructor public class StickerRepositoryImpl implements StickerRepositoryCustom { - private final JPAQueryFactory queryFactory; + private final JPAQueryFactory queryFactory; - @Override - public List 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 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 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 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 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 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 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 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 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 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 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 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); + } +} \ No newline at end of file