diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/ArticleController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/ArticleController.java index 7d6e99c87..ab65cbec3 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/ArticleController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/ArticleController.java @@ -4,7 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.*; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.*; import cn.iocoder.yudao.module.promotion.convert.article.ArticleConvert; import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO; import cn.iocoder.yudao.module.promotion.service.article.ArticleService; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleBaseVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/article/ArticleBaseVO.java similarity index 99% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleBaseVO.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/article/ArticleBaseVO.java index 1a1f2bdd8..71c38df36 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleBaseVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/article/ArticleBaseVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.article.vo; +package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleCreateReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/article/ArticleCreateReqVO.java similarity index 96% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleCreateReqVO.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/article/ArticleCreateReqVO.java index 6de506fbe..d598dd768 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleCreateReqVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/article/ArticleCreateReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.article.vo; +package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleExcelVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/article/ArticleExcelVO.java similarity index 99% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleExcelVO.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/article/ArticleExcelVO.java index cc9523a4c..ea1f51462 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleExcelVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/article/ArticleExcelVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.article.vo; +package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleExportReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/article/ArticleExportReqVO.java similarity index 98% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleExportReqVO.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/article/ArticleExportReqVO.java index 7c8e50049..b58e7eacf 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleExportReqVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/article/ArticleExportReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.article.vo; +package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticlePageReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/article/ArticlePageReqVO.java similarity index 98% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticlePageReqVO.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/article/ArticlePageReqVO.java index 4dbd806c6..9c7539585 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticlePageReqVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/article/ArticlePageReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.article.vo; +package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article; import cn.iocoder.yudao.framework.common.pojo.PageParam; import io.swagger.v3.oas.annotations.media.Schema; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleRespVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/article/ArticleRespVO.java similarity index 97% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleRespVO.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/article/ArticleRespVO.java index 58653af2f..a1553e471 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleRespVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/article/ArticleRespVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.article.vo; +package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleUpdateReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/article/ArticleUpdateReqVO.java similarity index 97% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleUpdateReqVO.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/article/ArticleUpdateReqVO.java index c50d5e996..3efd59334 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleUpdateReqVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/article/ArticleUpdateReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.article.vo; +package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/article/AppArticleCategoryController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/article/AppArticleCategoryController.java index 9d16048da..dbd67289b 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/article/AppArticleCategoryController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/article/AppArticleCategoryController.java @@ -1,16 +1,19 @@ package cn.iocoder.yudao.module.promotion.controller.app.article; +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.module.promotion.controller.app.article.vo.category.AppArticleCategoryRespVO; +import cn.iocoder.yudao.module.promotion.convert.article.ArticleCategoryConvert; +import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleCategoryDO; +import cn.iocoder.yudao.module.promotion.service.article.ArticleCategoryService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import java.util.ArrayList; +import javax.annotation.Resource; import java.util.List; -import java.util.Random; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @@ -20,20 +23,15 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @Validated public class AppArticleCategoryController { + @Resource + private ArticleCategoryService articleCategoryService; + @RequestMapping("/list") @Operation(summary = "获得文章分类列表") - // TODO @芋艿:swagger 注解 public CommonResult> getArticleCategoryList() { - List appArticleRespVOList = new ArrayList<>(); - Random random = new Random(); - for (int i = 0; i < 10; i++) { - AppArticleCategoryRespVO appArticleRespVO = new AppArticleCategoryRespVO(); - appArticleRespVO.setId((long) (i + 1)); - appArticleRespVO.setName("分类 - " + i); - appArticleRespVO.setPicUrl("https://www.iocoder.cn/" + (i + 1) + ".png"); - appArticleRespVOList.add(appArticleRespVO); - } - return success(appArticleRespVOList); + List categoryList = articleCategoryService.getArticleCategoryListByStatus( + CommonStatusEnum.ENABLE.getStatus()); + return success(ArticleCategoryConvert.INSTANCE.convertList04(categoryList)); } } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/article/AppArticleController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/article/AppArticleController.java index c794ecdf4..2b53ac614 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/article/AppArticleController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/article/AppArticleController.java @@ -4,16 +4,19 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticlePageReqVO; import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticleRespVO; +import cn.iocoder.yudao.module.promotion.convert.article.ArticleConvert; +import cn.iocoder.yudao.module.promotion.service.article.ArticleService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import java.time.LocalDateTime; -import java.util.ArrayList; +import javax.annotation.Resource; import java.util.List; -import java.util.Random; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @@ -23,68 +26,33 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @Validated public class AppArticleController { + @Resource + private ArticleService articleService; + @RequestMapping("/list") - // TODO @芋艿:swagger 注解 - public CommonResult> getArticleList(@RequestParam(value = "recommendHot", required = false) Boolean recommendHot, - @RequestParam(value = "recommendBanner", required = false) Boolean recommendBanner) { - List appArticleRespVOList = new ArrayList<>(); - Random random = new Random(); - for (int i = 0; i < 10; i++) { - AppArticleRespVO appArticleRespVO = new AppArticleRespVO(); - appArticleRespVO.setId((long) (i + 1)); - appArticleRespVO.setTitle("芋道源码 - " + i + "模块"); - appArticleRespVO.setAuthor("芋道源码"); - appArticleRespVO.setCategoryId((long) random.nextInt(10000)); - appArticleRespVO.setPicUrl("https://www.iocoder.cn/" + (i + 1) + ".png"); - appArticleRespVO.setIntroduction("我是简介"); - appArticleRespVO.setDescription("我是详细"); - appArticleRespVO.setCreateTime(LocalDateTime.now()); - appArticleRespVO.setBrowseCount(random.nextInt(10000)); - appArticleRespVO.setSpuId((long) random.nextInt(10000)); - appArticleRespVOList.add(appArticleRespVO); - } - return success(appArticleRespVOList); + @Operation(summary = "获得文章详情列表") + @Parameters({ + @Parameter(name = "recommendHot", description = "是否热门", example = "false"), // 场景一:查看指定的文章 + @Parameter(name = "recommendBanner", description = "是否轮播图", example = "false") // 场景二:查看指定的文章 + }) + public CommonResult> getArticleList( + @RequestParam(value = "recommendHot", required = false) Boolean recommendHot, + @RequestParam(value = "recommendBanner", required = false) Boolean recommendBanner) { + return success(ArticleConvert.INSTANCE.convertList03( + articleService.getArticleCategoryListByRecommendHotAndRecommendBanner(recommendHot, recommendBanner))); } @RequestMapping("/page") - // TODO @芋艿:swagger 注解 + @Operation(summary = "获得文章详情分页") public CommonResult> getArticlePage(AppArticlePageReqVO pageReqVO) { - List appArticleRespVOList = new ArrayList<>(); - Random random = new Random(); - for (int i = 0; i < 10; i++) { - AppArticleRespVO appArticleRespVO = new AppArticleRespVO(); - appArticleRespVO.setId((long) (i + 1)); - appArticleRespVO.setTitle("芋道源码 - " + i + "模块"); - appArticleRespVO.setAuthor("芋道源码"); - appArticleRespVO.setCategoryId((long) random.nextInt(10000)); - appArticleRespVO.setPicUrl("https://www.iocoder.cn/" + (i + 1) + ".png"); - appArticleRespVO.setIntroduction("我是简介"); - appArticleRespVO.setDescription("我是详细"); - appArticleRespVO.setCreateTime(LocalDateTime.now()); - appArticleRespVO.setBrowseCount(random.nextInt(10000)); - appArticleRespVO.setSpuId((long) random.nextInt(10000)); - appArticleRespVOList.add(appArticleRespVO); - } - return success(new PageResult<>(appArticleRespVOList, 10L)); + return success(ArticleConvert.INSTANCE.convertPage02(articleService.getArticlePage(pageReqVO))); } @RequestMapping("/get") - // TODO @芋艿:swagger 注解 + @Operation(summary = "获得文章详情") + @Parameter(name = "id", description = "文章编号", example = "1024") public CommonResult getArticlePage(@RequestParam("id") Long id) { - Random random = new Random(); - AppArticleRespVO appArticleRespVO = new AppArticleRespVO(); - appArticleRespVO.setId((long) (1)); - appArticleRespVO.setTitle("芋道源码 - " + 0 + "模块"); - appArticleRespVO.setAuthor("芋道源码"); - appArticleRespVO.setCategoryId((long) random.nextInt(10000)); - appArticleRespVO.setPicUrl("https://www.iocoder.cn/" + (0 + 1) + ".png"); - appArticleRespVO.setIntroduction("我是简介"); - appArticleRespVO.setDescription("我是详细"); - appArticleRespVO.setCreateTime(LocalDateTime.now()); - appArticleRespVO.setBrowseCount(random.nextInt(10000)); - appArticleRespVO.setSpuId((long) random.nextInt(10000)); - appArticleRespVO.setSpuId(633L); - return success(appArticleRespVO); + return success(ArticleConvert.INSTANCE.convert01(articleService.getArticle(id))); } } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/article/vo/article/AppArticleRespVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/article/vo/article/AppArticleRespVO.java index 6c4ad614e..8f74776c4 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/article/vo/article/AppArticleRespVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/article/vo/article/AppArticleRespVO.java @@ -39,11 +39,4 @@ public class AppArticleRespVO { @Schema(description = "关联的商品 SPU 编号", example = "1024") private Long spuId; -// TODO 芋艿:下面 2 个字段,后端要存储,前端不用返回; -// @Schema(description = "是否热卖推荐", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") -// private Boolean recommendHot; -// -// @Schema(description = "是否 Banner 推荐", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") -// private Boolean recommendBanner; - } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/article/vo/category/AppArticleCategoryRespVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/article/vo/category/AppArticleCategoryRespVO.java index da880dadd..e0f34e95d 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/article/vo/category/AppArticleCategoryRespVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/article/vo/category/AppArticleCategoryRespVO.java @@ -16,11 +16,4 @@ public class AppArticleCategoryRespVO { @Schema(description = "分类图标", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/1.png") private String picUrl; - // TODO 芋艿:下面 2 个字段,后端要存储,前端不用返回; -// @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") -// private Integer status; -// -// @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") -// private Integer sort; - } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/article/ArticleCategoryConvert.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/article/ArticleCategoryConvert.java index 3762bf8a9..628a451e0 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/article/ArticleCategoryConvert.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/article/ArticleCategoryConvert.java @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.promotion.convert.article; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.*; +import cn.iocoder.yudao.module.promotion.controller.app.article.vo.category.AppArticleCategoryRespVO; import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleCategoryDO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; @@ -32,4 +33,6 @@ public interface ArticleCategoryConvert { List convertList03(List list); + List convertList04(List categoryList); + } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/article/ArticleConvert.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/article/ArticleConvert.java index 6fb1cf850..fc403b37f 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/article/ArticleConvert.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/article/ArticleConvert.java @@ -1,10 +1,11 @@ package cn.iocoder.yudao.module.promotion.convert.article; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleCreateReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleExcelVO; -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleRespVO; -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleUpdateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleExcelVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleRespVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleUpdateReqVO; +import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticleRespVO; import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; @@ -33,4 +34,10 @@ public interface ArticleConvert { List convertList02(List list); + List convertList03(List list); + + AppArticleRespVO convert01(ArticleDO article); + + PageResult convertPage02(PageResult articlePage); + } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/article/ArticleMapper.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/article/ArticleMapper.java index 778c85f7b..47656d5f3 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/article/ArticleMapper.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/article/ArticleMapper.java @@ -3,8 +3,9 @@ package cn.iocoder.yudao.module.promotion.dal.mysql.article; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleExportReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticlePageReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleExportReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticlePageReqVO; +import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticlePageReqVO; import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO; import org.apache.ibatis.annotations.Mapper; @@ -44,4 +45,15 @@ public interface ArticleMapper extends BaseMapperX { .orderByDesc(ArticleDO::getId)); } + default List selectList(Boolean recommendHot, Boolean recommendBanner) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(ArticleDO::getRecommendHot, recommendHot) + .eqIfPresent(ArticleDO::getRecommendBanner, recommendBanner)); + } + + default PageResult selectPage(AppArticlePageReqVO pageReqVO) { + return selectPage(pageReqVO, new LambdaQueryWrapperX() + .eqIfPresent(ArticleDO::getCategoryId, pageReqVO.getCategoryId())); + } + } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleService.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleService.java index 2828dad2c..013c01a5f 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleService.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleService.java @@ -1,10 +1,11 @@ package cn.iocoder.yudao.module.promotion.service.article; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleCreateReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleExportReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticlePageReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleUpdateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleExportReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticlePageReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleUpdateReqVO; +import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticlePageReqVO; import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO; import javax.validation.Valid; @@ -12,14 +13,14 @@ import java.util.Collection; import java.util.List; /** - * 文章管理 Service 接口 + * 文章详情 Service 接口 * * @author HUIHUI */ public interface ArticleService { /** - * 创建文章管理 + * 创建文章详情 * * @param createReqVO 创建信息 * @return 编号 @@ -27,49 +28,66 @@ public interface ArticleService { Long createArticle(@Valid ArticleCreateReqVO createReqVO); /** - * 更新文章管理 + * 更新文章详情 * * @param updateReqVO 更新信息 */ void updateArticle(@Valid ArticleUpdateReqVO updateReqVO); /** - * 删除文章管理 + * 删除文章详情 * * @param id 编号 */ void deleteArticle(Long id); /** - * 获得文章管理 + * 获得文章详情 * * @param id 编号 - * @return 文章管理 + * @return 文章详情 */ ArticleDO getArticle(Long id); /** - * 获得文章管理列表 + * 获得文章详情列表 * * @param ids 编号 - * @return 文章管理列表 + * @return 文章详情列表 */ List getArticleList(Collection ids); /** - * 获得文章管理分页 + * 获得文章详情分页 * * @param pageReqVO 分页查询 - * @return 文章管理分页 + * @return 文章详情分页 */ PageResult getArticlePage(ArticlePageReqVO pageReqVO); /** - * 获得文章管理列表, 用于 Excel 导出 + * 获得文章详情列表, 用于 Excel 导出 * * @param exportReqVO 查询条件 - * @return 文章管理列表 + * @return 文章详情列表 */ List getArticleList(ArticleExportReqVO exportReqVO); + /** + * 获得文章详情列表 + * + * @param recommendHot 是否热门 + * @param recommendBanner 是否轮播图 + * @return 文章详情列表 + */ + List getArticleCategoryListByRecommendHotAndRecommendBanner(Boolean recommendHot, Boolean recommendBanner); + + /** + * 获得文章详情分页 + * + * @param pageReqVO 分页查询 + * @return 文章详情分页 + */ + PageResult getArticlePage(AppArticlePageReqVO pageReqVO); + } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleServiceImpl.java index 82cf3f38b..b43bf355a 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleServiceImpl.java @@ -3,10 +3,11 @@ package cn.iocoder.yudao.module.promotion.service.article; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.ListUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleCreateReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleExportReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticlePageReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleUpdateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleExportReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticlePageReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleUpdateReqVO; +import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticlePageReqVO; import cn.iocoder.yudao.module.promotion.convert.article.ArticleConvert; import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO; import cn.iocoder.yudao.module.promotion.dal.mysql.article.ArticleMapper; @@ -87,4 +88,14 @@ public class ArticleServiceImpl implements ArticleService { return articleMapper.selectList(exportReqVO); } + @Override + public List getArticleCategoryListByRecommendHotAndRecommendBanner(Boolean recommendHot, Boolean recommendBanner) { + return articleMapper.selectList(recommendHot, recommendBanner); + } + + @Override + public PageResult getArticlePage(AppArticlePageReqVO pageReqVO) { + return articleMapper.selectPage(pageReqVO); + } + } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/article/ArticleServiceImplTest.java b/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/article/ArticleServiceImplTest.java index d47c54453..cac652cf4 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/article/ArticleServiceImplTest.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/article/ArticleServiceImplTest.java @@ -2,10 +2,10 @@ package cn.iocoder.yudao.module.promotion.service.article; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleCreateReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleExportReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticlePageReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleUpdateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleExportReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticlePageReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleUpdateReqVO; import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO; import cn.iocoder.yudao.module.promotion.dal.mysql.article.ArticleMapper; import org.junit.jupiter.api.Disabled;