mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 09:11:52 +08:00
营销活动:完善文章相关 app 端接口
This commit is contained in:
parent
b009f0b058
commit
0d45acaf20
@ -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.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
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.convert.article.ArticleConvert;
|
||||||
import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO;
|
import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO;
|
||||||
import cn.iocoder.yudao.module.promotion.service.article.ArticleService;
|
import cn.iocoder.yudao.module.promotion.service.article.ArticleService;
|
||||||
|
@ -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 io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
@ -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 io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
@ -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.annotations.DictFormat;
|
||||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
@ -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 io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
@ -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 cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
@ -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 io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
@ -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 io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
@ -1,16 +1,19 @@
|
|||||||
package cn.iocoder.yudao.module.promotion.controller.app.article;
|
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.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.app.article.vo.category.AppArticleCategoryRespVO;
|
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.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
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
|
@Validated
|
||||||
public class AppArticleCategoryController {
|
public class AppArticleCategoryController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ArticleCategoryService articleCategoryService;
|
||||||
|
|
||||||
@RequestMapping("/list")
|
@RequestMapping("/list")
|
||||||
@Operation(summary = "获得文章分类列表")
|
@Operation(summary = "获得文章分类列表")
|
||||||
// TODO @芋艿:swagger 注解
|
|
||||||
public CommonResult<List<AppArticleCategoryRespVO>> getArticleCategoryList() {
|
public CommonResult<List<AppArticleCategoryRespVO>> getArticleCategoryList() {
|
||||||
List<AppArticleCategoryRespVO> appArticleRespVOList = new ArrayList<>();
|
List<ArticleCategoryDO> categoryList = articleCategoryService.getArticleCategoryListByStatus(
|
||||||
Random random = new Random();
|
CommonStatusEnum.ENABLE.getStatus());
|
||||||
for (int i = 0; i < 10; i++) {
|
return success(ArticleCategoryConvert.INSTANCE.convertList04(categoryList));
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,16 +4,19 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
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.AppArticlePageReqVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticleRespVO;
|
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 io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
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
|
@Validated
|
||||||
public class AppArticleController {
|
public class AppArticleController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ArticleService articleService;
|
||||||
|
|
||||||
@RequestMapping("/list")
|
@RequestMapping("/list")
|
||||||
// TODO @芋艿:swagger 注解
|
@Operation(summary = "获得文章详情列表")
|
||||||
public CommonResult<List<AppArticleRespVO>> getArticleList(@RequestParam(value = "recommendHot", required = false) Boolean recommendHot,
|
@Parameters({
|
||||||
@RequestParam(value = "recommendBanner", required = false) Boolean recommendBanner) {
|
@Parameter(name = "recommendHot", description = "是否热门", example = "false"), // 场景一:查看指定的文章
|
||||||
List<AppArticleRespVO> appArticleRespVOList = new ArrayList<>();
|
@Parameter(name = "recommendBanner", description = "是否轮播图", example = "false") // 场景二:查看指定的文章
|
||||||
Random random = new Random();
|
})
|
||||||
for (int i = 0; i < 10; i++) {
|
public CommonResult<List<AppArticleRespVO>> getArticleList(
|
||||||
AppArticleRespVO appArticleRespVO = new AppArticleRespVO();
|
@RequestParam(value = "recommendHot", required = false) Boolean recommendHot,
|
||||||
appArticleRespVO.setId((long) (i + 1));
|
@RequestParam(value = "recommendBanner", required = false) Boolean recommendBanner) {
|
||||||
appArticleRespVO.setTitle("芋道源码 - " + i + "模块");
|
return success(ArticleConvert.INSTANCE.convertList03(
|
||||||
appArticleRespVO.setAuthor("芋道源码");
|
articleService.getArticleCategoryListByRecommendHotAndRecommendBanner(recommendHot, recommendBanner)));
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/page")
|
@RequestMapping("/page")
|
||||||
// TODO @芋艿:swagger 注解
|
@Operation(summary = "获得文章详情分页")
|
||||||
public CommonResult<PageResult<AppArticleRespVO>> getArticlePage(AppArticlePageReqVO pageReqVO) {
|
public CommonResult<PageResult<AppArticleRespVO>> getArticlePage(AppArticlePageReqVO pageReqVO) {
|
||||||
List<AppArticleRespVO> appArticleRespVOList = new ArrayList<>();
|
return success(ArticleConvert.INSTANCE.convertPage02(articleService.getArticlePage(pageReqVO)));
|
||||||
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));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/get")
|
@RequestMapping("/get")
|
||||||
// TODO @芋艿:swagger 注解
|
@Operation(summary = "获得文章详情")
|
||||||
|
@Parameter(name = "id", description = "文章编号", example = "1024")
|
||||||
public CommonResult<AppArticleRespVO> getArticlePage(@RequestParam("id") Long id) {
|
public CommonResult<AppArticleRespVO> getArticlePage(@RequestParam("id") Long id) {
|
||||||
Random random = new Random();
|
return success(ArticleConvert.INSTANCE.convert01(articleService.getArticle(id)));
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,11 +39,4 @@ public class AppArticleRespVO {
|
|||||||
@Schema(description = "关联的商品 SPU 编号", example = "1024")
|
@Schema(description = "关联的商品 SPU 编号", example = "1024")
|
||||||
private Long spuId;
|
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;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,11 +16,4 @@ public class AppArticleCategoryRespVO {
|
|||||||
@Schema(description = "分类图标", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/1.png")
|
@Schema(description = "分类图标", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/1.png")
|
||||||
private String picUrl;
|
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;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.promotion.convert.article;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
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.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 cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleCategoryDO;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
@ -32,4 +33,6 @@ public interface ArticleCategoryConvert {
|
|||||||
|
|
||||||
List<ArticleCategorySimpleRespVO> convertList03(List<ArticleCategoryDO> list);
|
List<ArticleCategorySimpleRespVO> convertList03(List<ArticleCategoryDO> list);
|
||||||
|
|
||||||
|
List<AppArticleCategoryRespVO> convertList04(List<ArticleCategoryDO> categoryList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
package cn.iocoder.yudao.module.promotion.convert.article;
|
package cn.iocoder.yudao.module.promotion.convert.article;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
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.article.ArticleCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleExcelVO;
|
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleExcelVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleRespVO;
|
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleRespVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleUpdateReqVO;
|
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 cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
@ -33,4 +34,10 @@ public interface ArticleConvert {
|
|||||||
|
|
||||||
List<ArticleExcelVO> convertList02(List<ArticleDO> list);
|
List<ArticleExcelVO> convertList02(List<ArticleDO> list);
|
||||||
|
|
||||||
|
List<AppArticleRespVO> convertList03(List<ArticleDO> list);
|
||||||
|
|
||||||
|
AppArticleRespVO convert01(ArticleDO article);
|
||||||
|
|
||||||
|
PageResult<AppArticleRespVO> convertPage02(PageResult<ArticleDO> articlePage);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
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.article.ArticleExportReqVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticlePageReqVO;
|
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 cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
@ -44,4 +45,15 @@ public interface ArticleMapper extends BaseMapperX<ArticleDO> {
|
|||||||
.orderByDesc(ArticleDO::getId));
|
.orderByDesc(ArticleDO::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default List<ArticleDO> selectList(Boolean recommendHot, Boolean recommendBanner) {
|
||||||
|
return selectList(new LambdaQueryWrapperX<ArticleDO>()
|
||||||
|
.eqIfPresent(ArticleDO::getRecommendHot, recommendHot)
|
||||||
|
.eqIfPresent(ArticleDO::getRecommendBanner, recommendBanner));
|
||||||
|
}
|
||||||
|
|
||||||
|
default PageResult<ArticleDO> selectPage(AppArticlePageReqVO pageReqVO) {
|
||||||
|
return selectPage(pageReqVO, new LambdaQueryWrapperX<ArticleDO>()
|
||||||
|
.eqIfPresent(ArticleDO::getCategoryId, pageReqVO.getCategoryId()));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
package cn.iocoder.yudao.module.promotion.service.article;
|
package cn.iocoder.yudao.module.promotion.service.article;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
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.article.ArticleCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleExportReqVO;
|
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleExportReqVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticlePageReqVO;
|
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticlePageReqVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleUpdateReqVO;
|
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 cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
@ -12,14 +13,14 @@ import java.util.Collection;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文章管理 Service 接口
|
* 文章详情 Service 接口
|
||||||
*
|
*
|
||||||
* @author HUIHUI
|
* @author HUIHUI
|
||||||
*/
|
*/
|
||||||
public interface ArticleService {
|
public interface ArticleService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建文章管理
|
* 创建文章详情
|
||||||
*
|
*
|
||||||
* @param createReqVO 创建信息
|
* @param createReqVO 创建信息
|
||||||
* @return 编号
|
* @return 编号
|
||||||
@ -27,49 +28,66 @@ public interface ArticleService {
|
|||||||
Long createArticle(@Valid ArticleCreateReqVO createReqVO);
|
Long createArticle(@Valid ArticleCreateReqVO createReqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新文章管理
|
* 更新文章详情
|
||||||
*
|
*
|
||||||
* @param updateReqVO 更新信息
|
* @param updateReqVO 更新信息
|
||||||
*/
|
*/
|
||||||
void updateArticle(@Valid ArticleUpdateReqVO updateReqVO);
|
void updateArticle(@Valid ArticleUpdateReqVO updateReqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除文章管理
|
* 删除文章详情
|
||||||
*
|
*
|
||||||
* @param id 编号
|
* @param id 编号
|
||||||
*/
|
*/
|
||||||
void deleteArticle(Long id);
|
void deleteArticle(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得文章管理
|
* 获得文章详情
|
||||||
*
|
*
|
||||||
* @param id 编号
|
* @param id 编号
|
||||||
* @return 文章管理
|
* @return 文章详情
|
||||||
*/
|
*/
|
||||||
ArticleDO getArticle(Long id);
|
ArticleDO getArticle(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得文章管理列表
|
* 获得文章详情列表
|
||||||
*
|
*
|
||||||
* @param ids 编号
|
* @param ids 编号
|
||||||
* @return 文章管理列表
|
* @return 文章详情列表
|
||||||
*/
|
*/
|
||||||
List<ArticleDO> getArticleList(Collection<Long> ids);
|
List<ArticleDO> getArticleList(Collection<Long> ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得文章管理分页
|
* 获得文章详情分页
|
||||||
*
|
*
|
||||||
* @param pageReqVO 分页查询
|
* @param pageReqVO 分页查询
|
||||||
* @return 文章管理分页
|
* @return 文章详情分页
|
||||||
*/
|
*/
|
||||||
PageResult<ArticleDO> getArticlePage(ArticlePageReqVO pageReqVO);
|
PageResult<ArticleDO> getArticlePage(ArticlePageReqVO pageReqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得文章管理列表, 用于 Excel 导出
|
* 获得文章详情列表, 用于 Excel 导出
|
||||||
*
|
*
|
||||||
* @param exportReqVO 查询条件
|
* @param exportReqVO 查询条件
|
||||||
* @return 文章管理列表
|
* @return 文章详情列表
|
||||||
*/
|
*/
|
||||||
List<ArticleDO> getArticleList(ArticleExportReqVO exportReqVO);
|
List<ArticleDO> getArticleList(ArticleExportReqVO exportReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得文章详情列表
|
||||||
|
*
|
||||||
|
* @param recommendHot 是否热门
|
||||||
|
* @param recommendBanner 是否轮播图
|
||||||
|
* @return 文章详情列表
|
||||||
|
*/
|
||||||
|
List<ArticleDO> getArticleCategoryListByRecommendHotAndRecommendBanner(Boolean recommendHot, Boolean recommendBanner);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得文章详情分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 文章详情分页
|
||||||
|
*/
|
||||||
|
PageResult<ArticleDO> getArticlePage(AppArticlePageReqVO pageReqVO);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,11 @@ package cn.iocoder.yudao.module.promotion.service.article;
|
|||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.ListUtil;
|
import cn.hutool.core.collection.ListUtil;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
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.article.ArticleCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleExportReqVO;
|
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleExportReqVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticlePageReqVO;
|
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticlePageReqVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleUpdateReqVO;
|
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.convert.article.ArticleConvert;
|
||||||
import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO;
|
import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO;
|
||||||
import cn.iocoder.yudao.module.promotion.dal.mysql.article.ArticleMapper;
|
import cn.iocoder.yudao.module.promotion.dal.mysql.article.ArticleMapper;
|
||||||
@ -87,4 +88,14 @@ public class ArticleServiceImpl implements ArticleService {
|
|||||||
return articleMapper.selectList(exportReqVO);
|
return articleMapper.selectList(exportReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ArticleDO> getArticleCategoryListByRecommendHotAndRecommendBanner(Boolean recommendHot, Boolean recommendBanner) {
|
||||||
|
return articleMapper.selectList(recommendHot, recommendBanner);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<ArticleDO> getArticlePage(AppArticlePageReqVO pageReqVO) {
|
||||||
|
return articleMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
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.article.ArticleCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleExportReqVO;
|
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleExportReqVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticlePageReqVO;
|
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticlePageReqVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleUpdateReqVO;
|
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.dataobject.article.ArticleDO;
|
||||||
import cn.iocoder.yudao.module.promotion.dal.mysql.article.ArticleMapper;
|
import cn.iocoder.yudao.module.promotion.dal.mysql.article.ArticleMapper;
|
||||||
import org.junit.jupiter.api.Disabled;
|
import org.junit.jupiter.api.Disabled;
|
||||||
|
Loading…
Reference in New Issue
Block a user