Commit 0d45acaf20bdb1019c5a57914737ef7fd8aafa1e
1 parent
b009f0b0
营销活动:完善文章相关 app 端接口
Showing
18 changed files
with
124 additions
and
121 deletions
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; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 5 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 6 | 6 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 7 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.*; | |
| 7 | +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.*; | |
| 8 | 8 | import cn.iocoder.yudao.module.promotion.convert.article.ArticleConvert; |
| 9 | 9 | import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO; |
| 10 | 10 | import cn.iocoder.yudao.module.promotion.service.article.ArticleService; | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleBaseVO.java renamed to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/article/ArticleBaseVO.java
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleCreateReqVO.java renamed to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/article/ArticleCreateReqVO.java
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleExcelVO.java renamed to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/article/ArticleExcelVO.java
| 1 | -package cn.iocoder.yudao.module.promotion.controller.admin.article.vo; | |
| 1 | +package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleExportReqVO.java renamed to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/article/ArticleExportReqVO.java
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticlePageReqVO.java renamed to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/article/ArticlePageReqVO.java
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleRespVO.java renamed to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/article/ArticleRespVO.java
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleUpdateReqVO.java renamed to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/article/ArticleUpdateReqVO.java
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/article/AppArticleCategoryController.java
| 1 | 1 | package cn.iocoder.yudao.module.promotion.controller.app.article; |
| 2 | 2 | |
| 3 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 3 | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | 5 | import cn.iocoder.yudao.module.promotion.controller.app.article.vo.category.AppArticleCategoryRespVO; |
| 6 | +import cn.iocoder.yudao.module.promotion.convert.article.ArticleCategoryConvert; | |
| 7 | +import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleCategoryDO; | |
| 8 | +import cn.iocoder.yudao.module.promotion.service.article.ArticleCategoryService; | |
| 5 | 9 | import io.swagger.v3.oas.annotations.Operation; |
| 6 | 10 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 7 | 11 | import org.springframework.validation.annotation.Validated; |
| 8 | 12 | import org.springframework.web.bind.annotation.RequestMapping; |
| 9 | 13 | import org.springframework.web.bind.annotation.RestController; |
| 10 | 14 | |
| 11 | -import java.util.ArrayList; | |
| 15 | +import javax.annotation.Resource; | |
| 12 | 16 | import java.util.List; |
| 13 | -import java.util.Random; | |
| 14 | 17 | |
| 15 | 18 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 16 | 19 | |
| ... | ... | @@ -20,20 +23,15 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 20 | 23 | @Validated |
| 21 | 24 | public class AppArticleCategoryController { |
| 22 | 25 | |
| 26 | + @Resource | |
| 27 | + private ArticleCategoryService articleCategoryService; | |
| 28 | + | |
| 23 | 29 | @RequestMapping("/list") |
| 24 | 30 | @Operation(summary = "获得文章分类列表") |
| 25 | - // TODO @芋艿:swagger 注解 | |
| 26 | 31 | public CommonResult<List<AppArticleCategoryRespVO>> getArticleCategoryList() { |
| 27 | - List<AppArticleCategoryRespVO> appArticleRespVOList = new ArrayList<>(); | |
| 28 | - Random random = new Random(); | |
| 29 | - for (int i = 0; i < 10; i++) { | |
| 30 | - AppArticleCategoryRespVO appArticleRespVO = new AppArticleCategoryRespVO(); | |
| 31 | - appArticleRespVO.setId((long) (i + 1)); | |
| 32 | - appArticleRespVO.setName("分类 - " + i); | |
| 33 | - appArticleRespVO.setPicUrl("https://www.iocoder.cn/" + (i + 1) + ".png"); | |
| 34 | - appArticleRespVOList.add(appArticleRespVO); | |
| 35 | - } | |
| 36 | - return success(appArticleRespVOList); | |
| 32 | + List<ArticleCategoryDO> categoryList = articleCategoryService.getArticleCategoryListByStatus( | |
| 33 | + CommonStatusEnum.ENABLE.getStatus()); | |
| 34 | + return success(ArticleCategoryConvert.INSTANCE.convertList04(categoryList)); | |
| 37 | 35 | } |
| 38 | 36 | |
| 39 | 37 | } | ... | ... |
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; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 5 | import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticlePageReqVO; |
| 6 | 6 | import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticleRespVO; |
| 7 | +import cn.iocoder.yudao.module.promotion.convert.article.ArticleConvert; | |
| 8 | +import cn.iocoder.yudao.module.promotion.service.article.ArticleService; | |
| 9 | +import io.swagger.v3.oas.annotations.Operation; | |
| 10 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 11 | +import io.swagger.v3.oas.annotations.Parameters; | |
| 7 | 12 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 8 | 13 | import org.springframework.validation.annotation.Validated; |
| 9 | 14 | import org.springframework.web.bind.annotation.RequestMapping; |
| 10 | 15 | import org.springframework.web.bind.annotation.RequestParam; |
| 11 | 16 | import org.springframework.web.bind.annotation.RestController; |
| 12 | 17 | |
| 13 | -import java.time.LocalDateTime; | |
| 14 | -import java.util.ArrayList; | |
| 18 | +import javax.annotation.Resource; | |
| 15 | 19 | import java.util.List; |
| 16 | -import java.util.Random; | |
| 17 | 20 | |
| 18 | 21 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 19 | 22 | |
| ... | ... | @@ -23,68 +26,33 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 23 | 26 | @Validated |
| 24 | 27 | public class AppArticleController { |
| 25 | 28 | |
| 29 | + @Resource | |
| 30 | + private ArticleService articleService; | |
| 31 | + | |
| 26 | 32 | @RequestMapping("/list") |
| 27 | - // TODO @芋艿:swagger 注解 | |
| 28 | - public CommonResult<List<AppArticleRespVO>> getArticleList(@RequestParam(value = "recommendHot", required = false) Boolean recommendHot, | |
| 29 | - @RequestParam(value = "recommendBanner", required = false) Boolean recommendBanner) { | |
| 30 | - List<AppArticleRespVO> appArticleRespVOList = new ArrayList<>(); | |
| 31 | - Random random = new Random(); | |
| 32 | - for (int i = 0; i < 10; i++) { | |
| 33 | - AppArticleRespVO appArticleRespVO = new AppArticleRespVO(); | |
| 34 | - appArticleRespVO.setId((long) (i + 1)); | |
| 35 | - appArticleRespVO.setTitle("芋道源码 - " + i + "模块"); | |
| 36 | - appArticleRespVO.setAuthor("芋道源码"); | |
| 37 | - appArticleRespVO.setCategoryId((long) random.nextInt(10000)); | |
| 38 | - appArticleRespVO.setPicUrl("https://www.iocoder.cn/" + (i + 1) + ".png"); | |
| 39 | - appArticleRespVO.setIntroduction("我是简介"); | |
| 40 | - appArticleRespVO.setDescription("我是详细"); | |
| 41 | - appArticleRespVO.setCreateTime(LocalDateTime.now()); | |
| 42 | - appArticleRespVO.setBrowseCount(random.nextInt(10000)); | |
| 43 | - appArticleRespVO.setSpuId((long) random.nextInt(10000)); | |
| 44 | - appArticleRespVOList.add(appArticleRespVO); | |
| 45 | - } | |
| 46 | - return success(appArticleRespVOList); | |
| 33 | + @Operation(summary = "获得文章详情列表") | |
| 34 | + @Parameters({ | |
| 35 | + @Parameter(name = "recommendHot", description = "是否热门", example = "false"), // 场景一:查看指定的文章 | |
| 36 | + @Parameter(name = "recommendBanner", description = "是否轮播图", example = "false") // 场景二:查看指定的文章 | |
| 37 | + }) | |
| 38 | + public CommonResult<List<AppArticleRespVO>> getArticleList( | |
| 39 | + @RequestParam(value = "recommendHot", required = false) Boolean recommendHot, | |
| 40 | + @RequestParam(value = "recommendBanner", required = false) Boolean recommendBanner) { | |
| 41 | + return success(ArticleConvert.INSTANCE.convertList03( | |
| 42 | + articleService.getArticleCategoryListByRecommendHotAndRecommendBanner(recommendHot, recommendBanner))); | |
| 47 | 43 | } |
| 48 | 44 | |
| 49 | 45 | @RequestMapping("/page") |
| 50 | - // TODO @芋艿:swagger 注解 | |
| 46 | + @Operation(summary = "获得文章详情分页") | |
| 51 | 47 | public CommonResult<PageResult<AppArticleRespVO>> getArticlePage(AppArticlePageReqVO pageReqVO) { |
| 52 | - List<AppArticleRespVO> appArticleRespVOList = new ArrayList<>(); | |
| 53 | - Random random = new Random(); | |
| 54 | - for (int i = 0; i < 10; i++) { | |
| 55 | - AppArticleRespVO appArticleRespVO = new AppArticleRespVO(); | |
| 56 | - appArticleRespVO.setId((long) (i + 1)); | |
| 57 | - appArticleRespVO.setTitle("芋道源码 - " + i + "模块"); | |
| 58 | - appArticleRespVO.setAuthor("芋道源码"); | |
| 59 | - appArticleRespVO.setCategoryId((long) random.nextInt(10000)); | |
| 60 | - appArticleRespVO.setPicUrl("https://www.iocoder.cn/" + (i + 1) + ".png"); | |
| 61 | - appArticleRespVO.setIntroduction("我是简介"); | |
| 62 | - appArticleRespVO.setDescription("我是详细"); | |
| 63 | - appArticleRespVO.setCreateTime(LocalDateTime.now()); | |
| 64 | - appArticleRespVO.setBrowseCount(random.nextInt(10000)); | |
| 65 | - appArticleRespVO.setSpuId((long) random.nextInt(10000)); | |
| 66 | - appArticleRespVOList.add(appArticleRespVO); | |
| 67 | - } | |
| 68 | - return success(new PageResult<>(appArticleRespVOList, 10L)); | |
| 48 | + return success(ArticleConvert.INSTANCE.convertPage02(articleService.getArticlePage(pageReqVO))); | |
| 69 | 49 | } |
| 70 | 50 | |
| 71 | 51 | @RequestMapping("/get") |
| 72 | - // TODO @芋艿:swagger 注解 | |
| 52 | + @Operation(summary = "获得文章详情") | |
| 53 | + @Parameter(name = "id", description = "文章编号", example = "1024") | |
| 73 | 54 | public CommonResult<AppArticleRespVO> getArticlePage(@RequestParam("id") Long id) { |
| 74 | - Random random = new Random(); | |
| 75 | - AppArticleRespVO appArticleRespVO = new AppArticleRespVO(); | |
| 76 | - appArticleRespVO.setId((long) (1)); | |
| 77 | - appArticleRespVO.setTitle("芋道源码 - " + 0 + "模块"); | |
| 78 | - appArticleRespVO.setAuthor("芋道源码"); | |
| 79 | - appArticleRespVO.setCategoryId((long) random.nextInt(10000)); | |
| 80 | - appArticleRespVO.setPicUrl("https://www.iocoder.cn/" + (0 + 1) + ".png"); | |
| 81 | - appArticleRespVO.setIntroduction("我是简介"); | |
| 82 | - appArticleRespVO.setDescription("我是详细"); | |
| 83 | - appArticleRespVO.setCreateTime(LocalDateTime.now()); | |
| 84 | - appArticleRespVO.setBrowseCount(random.nextInt(10000)); | |
| 85 | - appArticleRespVO.setSpuId((long) random.nextInt(10000)); | |
| 86 | - appArticleRespVO.setSpuId(633L); | |
| 87 | - return success(appArticleRespVO); | |
| 55 | + return success(ArticleConvert.INSTANCE.convert01(articleService.getArticle(id))); | |
| 88 | 56 | } |
| 89 | 57 | |
| 90 | 58 | } | ... | ... |
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 { |
| 39 | 39 | @Schema(description = "关联的商品 SPU 编号", example = "1024") |
| 40 | 40 | private Long spuId; |
| 41 | 41 | |
| 42 | -// TODO 芋艿:下面 2 个字段,后端要存储,前端不用返回; | |
| 43 | -// @Schema(description = "是否热卖推荐", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") | |
| 44 | -// private Boolean recommendHot; | |
| 45 | -// | |
| 46 | -// @Schema(description = "是否 Banner 推荐", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") | |
| 47 | -// private Boolean recommendBanner; | |
| 48 | - | |
| 49 | 42 | } | ... | ... |
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 { |
| 16 | 16 | @Schema(description = "分类图标", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/1.png") |
| 17 | 17 | private String picUrl; |
| 18 | 18 | |
| 19 | - // TODO 芋艿:下面 2 个字段,后端要存储,前端不用返回; | |
| 20 | -// @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 21 | -// private Integer status; | |
| 22 | -// | |
| 23 | -// @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 24 | -// private Integer sort; | |
| 25 | - | |
| 26 | 19 | } | ... | ... |
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; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.*; |
| 5 | +import cn.iocoder.yudao.module.promotion.controller.app.article.vo.category.AppArticleCategoryRespVO; | |
| 5 | 6 | import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleCategoryDO; |
| 6 | 7 | import org.mapstruct.Mapper; |
| 7 | 8 | import org.mapstruct.factory.Mappers; |
| ... | ... | @@ -32,4 +33,6 @@ public interface ArticleCategoryConvert { |
| 32 | 33 | |
| 33 | 34 | List<ArticleCategorySimpleRespVO> convertList03(List<ArticleCategoryDO> list); |
| 34 | 35 | |
| 36 | + List<AppArticleCategoryRespVO> convertList04(List<ArticleCategoryDO> categoryList); | |
| 37 | + | |
| 35 | 38 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/article/ArticleConvert.java
| 1 | 1 | package cn.iocoder.yudao.module.promotion.convert.article; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleCreateReqVO; | |
| 5 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleExcelVO; | |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleRespVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleUpdateReqVO; | |
| 4 | +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleCreateReqVO; | |
| 5 | +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleExcelVO; | |
| 6 | +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleRespVO; | |
| 7 | +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleUpdateReqVO; | |
| 8 | +import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticleRespVO; | |
| 8 | 9 | import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO; |
| 9 | 10 | import org.mapstruct.Mapper; |
| 10 | 11 | import org.mapstruct.factory.Mappers; |
| ... | ... | @@ -33,4 +34,10 @@ public interface ArticleConvert { |
| 33 | 34 | |
| 34 | 35 | List<ArticleExcelVO> convertList02(List<ArticleDO> list); |
| 35 | 36 | |
| 37 | + List<AppArticleRespVO> convertList03(List<ArticleDO> list); | |
| 38 | + | |
| 39 | + AppArticleRespVO convert01(ArticleDO article); | |
| 40 | + | |
| 41 | + PageResult<AppArticleRespVO> convertPage02(PageResult<ArticleDO> articlePage); | |
| 42 | + | |
| 36 | 43 | } | ... | ... |
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; |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleExportReqVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticlePageReqVO; | |
| 6 | +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleExportReqVO; | |
| 7 | +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticlePageReqVO; | |
| 8 | +import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticlePageReqVO; | |
| 8 | 9 | import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO; |
| 9 | 10 | import org.apache.ibatis.annotations.Mapper; |
| 10 | 11 | |
| ... | ... | @@ -44,4 +45,15 @@ public interface ArticleMapper extends BaseMapperX<ArticleDO> { |
| 44 | 45 | .orderByDesc(ArticleDO::getId)); |
| 45 | 46 | } |
| 46 | 47 | |
| 48 | + default List<ArticleDO> selectList(Boolean recommendHot, Boolean recommendBanner) { | |
| 49 | + return selectList(new LambdaQueryWrapperX<ArticleDO>() | |
| 50 | + .eqIfPresent(ArticleDO::getRecommendHot, recommendHot) | |
| 51 | + .eqIfPresent(ArticleDO::getRecommendBanner, recommendBanner)); | |
| 52 | + } | |
| 53 | + | |
| 54 | + default PageResult<ArticleDO> selectPage(AppArticlePageReqVO pageReqVO) { | |
| 55 | + return selectPage(pageReqVO, new LambdaQueryWrapperX<ArticleDO>() | |
| 56 | + .eqIfPresent(ArticleDO::getCategoryId, pageReqVO.getCategoryId())); | |
| 57 | + } | |
| 58 | + | |
| 47 | 59 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleService.java
| 1 | 1 | package cn.iocoder.yudao.module.promotion.service.article; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleCreateReqVO; | |
| 5 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleExportReqVO; | |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticlePageReqVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleUpdateReqVO; | |
| 4 | +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleCreateReqVO; | |
| 5 | +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleExportReqVO; | |
| 6 | +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticlePageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleUpdateReqVO; | |
| 8 | +import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticlePageReqVO; | |
| 8 | 9 | import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO; |
| 9 | 10 | |
| 10 | 11 | import javax.validation.Valid; |
| ... | ... | @@ -12,14 +13,14 @@ import java.util.Collection; |
| 12 | 13 | import java.util.List; |
| 13 | 14 | |
| 14 | 15 | /** |
| 15 | - * 文章管理 Service 接口 | |
| 16 | + * 文章详情 Service 接口 | |
| 16 | 17 | * |
| 17 | 18 | * @author HUIHUI |
| 18 | 19 | */ |
| 19 | 20 | public interface ArticleService { |
| 20 | 21 | |
| 21 | 22 | /** |
| 22 | - * 创建文章管理 | |
| 23 | + * 创建文章详情 | |
| 23 | 24 | * |
| 24 | 25 | * @param createReqVO 创建信息 |
| 25 | 26 | * @return 编号 |
| ... | ... | @@ -27,49 +28,66 @@ public interface ArticleService { |
| 27 | 28 | Long createArticle(@Valid ArticleCreateReqVO createReqVO); |
| 28 | 29 | |
| 29 | 30 | /** |
| 30 | - * 更新文章管理 | |
| 31 | + * 更新文章详情 | |
| 31 | 32 | * |
| 32 | 33 | * @param updateReqVO 更新信息 |
| 33 | 34 | */ |
| 34 | 35 | void updateArticle(@Valid ArticleUpdateReqVO updateReqVO); |
| 35 | 36 | |
| 36 | 37 | /** |
| 37 | - * 删除文章管理 | |
| 38 | + * 删除文章详情 | |
| 38 | 39 | * |
| 39 | 40 | * @param id 编号 |
| 40 | 41 | */ |
| 41 | 42 | void deleteArticle(Long id); |
| 42 | 43 | |
| 43 | 44 | /** |
| 44 | - * 获得文章管理 | |
| 45 | + * 获得文章详情 | |
| 45 | 46 | * |
| 46 | 47 | * @param id 编号 |
| 47 | - * @return 文章管理 | |
| 48 | + * @return 文章详情 | |
| 48 | 49 | */ |
| 49 | 50 | ArticleDO getArticle(Long id); |
| 50 | 51 | |
| 51 | 52 | /** |
| 52 | - * 获得文章管理列表 | |
| 53 | + * 获得文章详情列表 | |
| 53 | 54 | * |
| 54 | 55 | * @param ids 编号 |
| 55 | - * @return 文章管理列表 | |
| 56 | + * @return 文章详情列表 | |
| 56 | 57 | */ |
| 57 | 58 | List<ArticleDO> getArticleList(Collection<Long> ids); |
| 58 | 59 | |
| 59 | 60 | /** |
| 60 | - * 获得文章管理分页 | |
| 61 | + * 获得文章详情分页 | |
| 61 | 62 | * |
| 62 | 63 | * @param pageReqVO 分页查询 |
| 63 | - * @return 文章管理分页 | |
| 64 | + * @return 文章详情分页 | |
| 64 | 65 | */ |
| 65 | 66 | PageResult<ArticleDO> getArticlePage(ArticlePageReqVO pageReqVO); |
| 66 | 67 | |
| 67 | 68 | /** |
| 68 | - * 获得文章管理列表, 用于 Excel 导出 | |
| 69 | + * 获得文章详情列表, 用于 Excel 导出 | |
| 69 | 70 | * |
| 70 | 71 | * @param exportReqVO 查询条件 |
| 71 | - * @return 文章管理列表 | |
| 72 | + * @return 文章详情列表 | |
| 72 | 73 | */ |
| 73 | 74 | List<ArticleDO> getArticleList(ArticleExportReqVO exportReqVO); |
| 74 | 75 | |
| 76 | + /** | |
| 77 | + * 获得文章详情列表 | |
| 78 | + * | |
| 79 | + * @param recommendHot 是否热门 | |
| 80 | + * @param recommendBanner 是否轮播图 | |
| 81 | + * @return 文章详情列表 | |
| 82 | + */ | |
| 83 | + List<ArticleDO> getArticleCategoryListByRecommendHotAndRecommendBanner(Boolean recommendHot, Boolean recommendBanner); | |
| 84 | + | |
| 85 | + /** | |
| 86 | + * 获得文章详情分页 | |
| 87 | + * | |
| 88 | + * @param pageReqVO 分页查询 | |
| 89 | + * @return 文章详情分页 | |
| 90 | + */ | |
| 91 | + PageResult<ArticleDO> getArticlePage(AppArticlePageReqVO pageReqVO); | |
| 92 | + | |
| 75 | 93 | } | ... | ... |
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; |
| 3 | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.hutool.core.collection.ListUtil; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleCreateReqVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleExportReqVO; | |
| 8 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticlePageReqVO; | |
| 9 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleUpdateReqVO; | |
| 6 | +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleCreateReqVO; | |
| 7 | +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleExportReqVO; | |
| 8 | +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticlePageReqVO; | |
| 9 | +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleUpdateReqVO; | |
| 10 | +import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticlePageReqVO; | |
| 10 | 11 | import cn.iocoder.yudao.module.promotion.convert.article.ArticleConvert; |
| 11 | 12 | import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO; |
| 12 | 13 | import cn.iocoder.yudao.module.promotion.dal.mysql.article.ArticleMapper; |
| ... | ... | @@ -87,4 +88,14 @@ public class ArticleServiceImpl implements ArticleService { |
| 87 | 88 | return articleMapper.selectList(exportReqVO); |
| 88 | 89 | } |
| 89 | 90 | |
| 91 | + @Override | |
| 92 | + public List<ArticleDO> getArticleCategoryListByRecommendHotAndRecommendBanner(Boolean recommendHot, Boolean recommendBanner) { | |
| 93 | + return articleMapper.selectList(recommendHot, recommendBanner); | |
| 94 | + } | |
| 95 | + | |
| 96 | + @Override | |
| 97 | + public PageResult<ArticleDO> getArticlePage(AppArticlePageReqVO pageReqVO) { | |
| 98 | + return articleMapper.selectPage(pageReqVO); | |
| 99 | + } | |
| 100 | + | |
| 90 | 101 | } | ... | ... |
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; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 5 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleCreateReqVO; | |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleExportReqVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticlePageReqVO; | |
| 8 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleUpdateReqVO; | |
| 5 | +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleCreateReqVO; | |
| 6 | +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleExportReqVO; | |
| 7 | +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticlePageReqVO; | |
| 8 | +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleUpdateReqVO; | |
| 9 | 9 | import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO; |
| 10 | 10 | import cn.iocoder.yudao.module.promotion.dal.mysql.article.ArticleMapper; |
| 11 | 11 | import org.junit.jupiter.api.Disabled; | ... | ... |