diff --git a/src/main/java/myblog/blog/article/adapter/incomming/web/ArticleController.java b/src/main/java/myblog/blog/article/adapter/incomming/web/ArticleController.java index 4e5cfe6..2ce3fe9 100644 --- a/src/main/java/myblog/blog/article/adapter/incomming/web/ArticleController.java +++ b/src/main/java/myblog/blog/article/adapter/incomming/web/ArticleController.java @@ -12,6 +12,7 @@ import myblog.blog.article.application.port.response.ArticleResponseByCategory; import myblog.blog.article.application.port.response.ArticleResponseForCardBox; import myblog.blog.article.application.port.response.ArticleResponseForDetail; import myblog.blog.article.application.port.response.ArticleResponseForEdit; + import myblog.blog.category.service.CategoryService; import myblog.blog.category.dto.*; import myblog.blog.member.auth.PrincipalDetails; @@ -29,10 +30,8 @@ import org.springframework.ui.Model; import org.springframework.validation.Errors; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; - import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletResponse; - import java.util.List; import java.util.stream.Collectors; diff --git a/src/main/java/myblog/blog/article/application/ArticleQueries.java b/src/main/java/myblog/blog/article/application/ArticleQueries.java index fc06125..c416784 100644 --- a/src/main/java/myblog/blog/article/application/ArticleQueries.java +++ b/src/main/java/myblog/blog/article/application/ArticleQueries.java @@ -65,21 +65,26 @@ public class ArticleQueries implements ArticleQueriesUseCase { } /* - 카테고리별 게시물 페이징 처리해서 가져오기 + - tier 1은 super / tier 2는 sub */ @Override public Slice getArticlesByCategory(String category, Integer tier, Integer page) { - Slice
articles; + Slice
articles = null; if (tier.equals(0)) { articles = articleRepositoryPort .findByOrderByIdDesc( PageRequest.of(pageResolve(page), 5)); } - else { + if (tier.equals(1)) { articles = articleRepositoryPort .findBySupCategoryOrderByIdDesc( PageRequest.of(pageResolve(page), 5), category); - + } + if (tier.equals(2)) { + articles = articleRepositoryPort + .findBySubCategoryOrderByIdDesc( + PageRequest.of(pageResolve(page), 5), category); } if(articles == null) throw new IllegalArgumentException("NotFoundArticleException"); diff --git a/src/main/java/myblog/blog/base/config/AppConfig.java b/src/main/java/myblog/blog/base/config/AppConfig.java index 2847482..b3fb9a0 100644 --- a/src/main/java/myblog/blog/base/config/AppConfig.java +++ b/src/main/java/myblog/blog/base/config/AppConfig.java @@ -6,7 +6,6 @@ import com.amazonaws.auth.BasicAWSCredentials; import com.amazonaws.regions.Regions; import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.AmazonS3ClientBuilder; -import com.google.gson.Gson; import org.modelmapper.ModelMapper; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean;