diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/ArticleCategoryController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/ArticleCategoryController.java index 68d891498..245e6950c 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/ArticleCategoryController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/ArticleCategoryController.java @@ -3,8 +3,6 @@ package cn.iocoder.yudao.module.promotion.controller.admin.article; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; 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.category.*; import cn.iocoder.yudao.module.promotion.convert.article.ArticleCategoryConvert; import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleCategoryDO; @@ -17,15 +15,11 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; -import java.io.IOException; -import java.util.Collection; import java.util.Comparator; import java.util.List; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; -import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; @Tag(name = "管理后台 - 文章分类") @RestController @@ -65,23 +59,14 @@ public class ArticleCategoryController { @Parameter(name = "id", description = "编号", required = true, example = "1024") @PreAuthorize("@ss.hasPermission('promotion:article-category:query')") public CommonResult getArticleCategory(@RequestParam("id") Long id) { - ArticleCategoryDO articleCategory = articleCategoryService.getArticleCategory(id); - return success(ArticleCategoryConvert.INSTANCE.convert(articleCategory)); - } - - @GetMapping("/list") - @Operation(summary = "获得文章分类列表") - @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") - @PreAuthorize("@ss.hasPermission('promotion:article-category:query')") - public CommonResult> getArticleCategoryList(@RequestParam("ids") Collection ids) { - List list = articleCategoryService.getArticleCategoryList(ids); - return success(ArticleCategoryConvert.INSTANCE.convertList(list)); + ArticleCategoryDO category = articleCategoryService.getArticleCategory(id); + return success(ArticleCategoryConvert.INSTANCE.convert(category)); } @GetMapping("/list-all-simple") @Operation(summary = "获取文章分类精简信息列表", description = "只包含被开启的文章分类,主要用于前端的下拉选项") public CommonResult> getSimpleDeptList() { - // 获得部门列表,只要开启状态的 + // 获得分类列表,只要开启状态的 List list = articleCategoryService.getArticleCategoryListByStatus(CommonStatusEnum.ENABLE.getStatus()); // 降序排序后,返回给前端 list.sort(Comparator.comparing(ArticleCategoryDO::getSort).reversed()); @@ -96,16 +81,4 @@ public class ArticleCategoryController { return success(ArticleCategoryConvert.INSTANCE.convertPage(pageResult)); } - @GetMapping("/export-excel") - @Operation(summary = "导出文章分类 Excel") - @PreAuthorize("@ss.hasPermission('promotion:article-category:export')") - @OperateLog(type = EXPORT) - public void exportArticleCategoryExcel(@Valid ArticleCategoryExportReqVO exportReqVO, - HttpServletResponse response) throws IOException { - List list = articleCategoryService.getArticleCategoryList(exportReqVO); - // 导出 Excel - List datas = ArticleCategoryConvert.INSTANCE.convertList02(list); - ExcelUtils.write(response, "文章分类.xls", "数据", ArticleCategoryExcelVO.class, datas); - } - } 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..f6dea04e3 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 @@ -2,9 +2,10 @@ package cn.iocoder.yudao.module.promotion.controller.admin.article; 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.ArticleCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticlePageReqVO; +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.convert.article.ArticleConvert; import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO; import cn.iocoder.yudao.module.promotion.service.article.ArticleService; @@ -16,14 +17,9 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; -import java.io.IOException; -import java.util.Collection; -import java.util.List; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; -import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; @Tag(name = "管理后台 - 文章管理") @RestController @@ -67,15 +63,6 @@ public class ArticleController { return success(ArticleConvert.INSTANCE.convert(article)); } - @GetMapping("/list") - @Operation(summary = "获得文章管理列表") - @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") - @PreAuthorize("@ss.hasPermission('promotion:article:query')") - public CommonResult> getArticleList(@RequestParam("ids") Collection ids) { - List list = articleService.getArticleList(ids); - return success(ArticleConvert.INSTANCE.convertList(list)); - } - @GetMapping("/page") @Operation(summary = "获得文章管理分页") @PreAuthorize("@ss.hasPermission('promotion:article:query')") @@ -84,16 +71,4 @@ public class ArticleController { return success(ArticleConvert.INSTANCE.convertPage(pageResult)); } - @GetMapping("/export-excel") - @Operation(summary = "导出文章管理 Excel") - @PreAuthorize("@ss.hasPermission('promotion:article:export')") - @OperateLog(type = EXPORT) - public void exportArticleExcel(@Valid ArticleExportReqVO exportReqVO, - HttpServletResponse response) throws IOException { - List list = articleService.getArticleList(exportReqVO); - // 导出 Excel - List datas = ArticleConvert.INSTANCE.convertList02(list); - ExcelUtils.write(response, "文章管理.xls", "数据", ArticleExcelVO.class, datas); - } - } 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/ArticleExcelVO.java deleted file mode 100644 index cc9523a4c..000000000 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleExcelVO.java +++ /dev/null @@ -1,63 +0,0 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.article.vo; - -import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; -import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; -import cn.iocoder.yudao.module.system.enums.DictTypeConstants; -import com.alibaba.excel.annotation.ExcelProperty; -import lombok.Data; - -import java.time.LocalDateTime; - - -/** - * 文章管理 Excel VO - * - * @author HUIHUI - */ -@Data -public class ArticleExcelVO { - - @ExcelProperty("文章编号") - private Long id; - - @ExcelProperty("文章分类编号") - private Long categoryId; - - @ExcelProperty("关联商品编号") - private Long spuId; - - @ExcelProperty("文章标题") - private String title; - - @ExcelProperty("文章作者") - private String author; - - @ExcelProperty("文章封面图片地址") - private String picUrl; - - @ExcelProperty("文章简介") - private String introduction; - - @ExcelProperty("浏览次数") - private String browseCount; - - @ExcelProperty("排序") - private Integer sort; - - @ExcelProperty(value = "状态", converter = DictConvert.class) - @DictFormat(DictTypeConstants.COMMON_STATUS) - private Integer status; - - @ExcelProperty("是否热门(小程序)") - private Boolean recommendHot; - - @ExcelProperty("是否轮播图(小程序)") - private Boolean recommendBanner; - - @ExcelProperty("文章内容") - private String content; - - @ExcelProperty("创建时间") - private LocalDateTime createTime; - -} 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/ArticleExportReqVO.java deleted file mode 100644 index 7c8e50049..000000000 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleExportReqVO.java +++ /dev/null @@ -1,40 +0,0 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.article.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import org.springframework.format.annotation.DateTimeFormat; - -import java.time.LocalDateTime; - -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; - -@Schema(description = "管理后台 - 文章管理 Excel 导出 Request VO,参数和 ArticlePageReqVO 是一致的") -@Data -public class ArticleExportReqVO { - - @Schema(description = "文章分类编号", example = "15458") - private Long categoryId; - - @Schema(description = "关联商品编号", example = "22378") - private Long spuId; - - @Schema(description = "文章标题") - private String title; - - @Schema(description = "文章作者") - private String author; - - @Schema(description = "状态", example = "2") - private Integer status; - - @Schema(description = "是否热门(小程序)") - private Boolean recommendHot; - - @Schema(description = "是否轮播图(小程序)") - private Boolean recommendBanner; - - @Schema(description = "创建时间") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private LocalDateTime[] createTime; - -} 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 96% 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..6a23efe6b 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; @@ -34,6 +34,7 @@ public class ArticleBaseVO { @Schema(description = "文章简介", requiredMode = Schema.RequiredMode.REQUIRED, example = "这是一个简介") private String introduction; + // TODO @puhui999:浏览量的字段,应该不是后端新增设置的哈; @Schema(description = "浏览次数", requiredMode = Schema.RequiredMode.REQUIRED, example = "111") private String browseCount; 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/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/admin/article/vo/category/ArticleCategoryExcelVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/category/ArticleCategoryExcelVO.java deleted file mode 100644 index dec4c7d88..000000000 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/category/ArticleCategoryExcelVO.java +++ /dev/null @@ -1,39 +0,0 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category; - -import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; -import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; -import cn.iocoder.yudao.module.system.enums.DictTypeConstants; -import com.alibaba.excel.annotation.ExcelProperty; -import lombok.Data; - -import java.time.LocalDateTime; - - -/** - * 文章分类 Excel VO - * - * @author HUIHUI - */ -@Data -public class ArticleCategoryExcelVO { - - @ExcelProperty("文章分类编号") - private Long id; - - @ExcelProperty("文章分类名称") - private String name; - - @ExcelProperty("图标地址") - private String picUrl; - - @ExcelProperty(value = "状态", converter = DictConvert.class) - @DictFormat(DictTypeConstants.COMMON_STATUS) - private Integer status; - - @ExcelProperty("排序") - private Integer sort; - - @ExcelProperty("创建时间") - private LocalDateTime createTime; - -} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/category/ArticleCategoryExportReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/category/ArticleCategoryExportReqVO.java deleted file mode 100644 index 1e20cbcd2..000000000 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/category/ArticleCategoryExportReqVO.java +++ /dev/null @@ -1,25 +0,0 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import org.springframework.format.annotation.DateTimeFormat; - -import java.time.LocalDateTime; - -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; - -@Schema(description = "管理后台 - 文章分类 Excel 导出 Request VO,参数和 ArticleCategoryPageReqVO 是一致的") -@Data -public class ArticleCategoryExportReqVO { - - @Schema(description = "文章分类名称", example = "秒杀") - private String name; - - @Schema(description = "状态", example = "1") - private Integer status; - - @Schema(description = "创建时间") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private LocalDateTime[] createTime; - -} 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..b85faef15 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 @@ -28,8 +28,6 @@ public interface ArticleCategoryConvert { PageResult convertPage(PageResult page); - List convertList02(List list); - List convertList03(List list); } 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..a8b624c35 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,9 @@ 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.ArticleRespVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleUpdateReqVO; import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; @@ -31,6 +30,4 @@ public interface ArticleConvert { PageResult convertPage(PageResult page); - List convertList02(List list); - } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/article/ArticleCategoryMapper.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/article/ArticleCategoryMapper.java index c55447c4c..90454d8ce 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/article/ArticleCategoryMapper.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/article/ArticleCategoryMapper.java @@ -3,13 +3,10 @@ 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.category.ArticleCategoryExportReqVO; import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryPageReqVO; import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleCategoryDO; import org.apache.ibatis.annotations.Mapper; -import java.util.List; - /** * 文章分类 Mapper * @@ -26,12 +23,4 @@ public interface ArticleCategoryMapper extends BaseMapperX { .orderByDesc(ArticleCategoryDO::getSort)); } - default List selectList(ArticleCategoryExportReqVO reqVO) { - return selectList(new LambdaQueryWrapperX() - .likeIfPresent(ArticleCategoryDO::getName, reqVO.getName()) - .eqIfPresent(ArticleCategoryDO::getStatus, reqVO.getStatus()) - .betweenIfPresent(ArticleCategoryDO::getCreateTime, reqVO.getCreateTime()) - .orderByDesc(ArticleCategoryDO::getSort)); - } - } 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..57b13dfa5 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,13 +3,10 @@ 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.ArticlePageReqVO; import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO; import org.apache.ibatis.annotations.Mapper; -import java.util.List; - /** * 文章管理 Mapper * @@ -31,17 +28,4 @@ public interface ArticleMapper extends BaseMapperX { .orderByDesc(ArticleDO::getId)); } - default List selectList(ArticleExportReqVO reqVO) { - return selectList(new LambdaQueryWrapperX() - .eqIfPresent(ArticleDO::getCategoryId, reqVO.getCategoryId()) - .eqIfPresent(ArticleDO::getTitle, reqVO.getTitle()) - .eqIfPresent(ArticleDO::getAuthor, reqVO.getAuthor()) - .eqIfPresent(ArticleDO::getStatus, reqVO.getStatus()) - .eqIfPresent(ArticleDO::getSpuId, reqVO.getSpuId()) - .eqIfPresent(ArticleDO::getRecommendHot, reqVO.getRecommendHot()) - .eqIfPresent(ArticleDO::getRecommendBanner, reqVO.getRecommendBanner()) - .betweenIfPresent(ArticleDO::getCreateTime, reqVO.getCreateTime()) - .orderByDesc(ArticleDO::getId)); - } - } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleCategoryService.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleCategoryService.java index 23424369b..7ce7c0aa0 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleCategoryService.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleCategoryService.java @@ -2,13 +2,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.category.ArticleCategoryCreateReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryExportReqVO; import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryPageReqVO; import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryUpdateReqVO; import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleCategoryDO; import javax.validation.Valid; -import java.util.Collection; import java.util.List; /** @@ -48,14 +46,6 @@ public interface ArticleCategoryService { */ ArticleCategoryDO getArticleCategory(Long id); - /** - * 获得文章分类列表 - * - * @param ids 编号 - * @return 文章分类列表 - */ - List getArticleCategoryList(Collection ids); - /** * 获得文章分类分页 * @@ -64,14 +54,6 @@ public interface ArticleCategoryService { */ PageResult getArticleCategoryPage(ArticleCategoryPageReqVO pageReqVO); - /** - * 获得文章分类列表, 用于 Excel 导出 - * - * @param exportReqVO 查询条件 - * @return 文章分类列表 - */ - List getArticleCategoryList(ArticleCategoryExportReqVO exportReqVO); - /** * 获得指定状态的文章分类列表 * diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleCategoryServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleCategoryServiceImpl.java index 32bf60ee4..1b3fe384d 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleCategoryServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleCategoryServiceImpl.java @@ -1,10 +1,7 @@ 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.category.ArticleCategoryCreateReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryExportReqVO; import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryPageReqVO; import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryUpdateReqVO; import cn.iocoder.yudao.module.promotion.convert.article.ArticleCategoryConvert; @@ -14,7 +11,6 @@ import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; -import java.util.Collection; import java.util.List; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; @@ -35,10 +31,10 @@ public class ArticleCategoryServiceImpl implements ArticleCategoryService { @Override public Long createArticleCategory(ArticleCategoryCreateReqVO createReqVO) { // 插入 - ArticleCategoryDO articleCategory = ArticleCategoryConvert.INSTANCE.convert(createReqVO); - articleCategoryMapper.insert(articleCategory); + ArticleCategoryDO category = ArticleCategoryConvert.INSTANCE.convert(createReqVO); + articleCategoryMapper.insert(category); // 返回 - return articleCategory.getId(); + return category.getId(); } @Override @@ -54,6 +50,8 @@ public class ArticleCategoryServiceImpl implements ArticleCategoryService { public void deleteArticleCategory(Long id) { // 校验存在 validateArticleCategoryExists(id); + // TODO @puhui999:需要校验下,是不是存在文章 + // 删除 articleCategoryMapper.deleteById(id); } @@ -69,24 +67,11 @@ public class ArticleCategoryServiceImpl implements ArticleCategoryService { return articleCategoryMapper.selectById(id); } - @Override - public List getArticleCategoryList(Collection ids) { - if (CollUtil.isEmpty(ids)) { - return ListUtil.empty(); - } - return articleCategoryMapper.selectBatchIds(ids); - } - @Override public PageResult getArticleCategoryPage(ArticleCategoryPageReqVO pageReqVO) { return articleCategoryMapper.selectPage(pageReqVO); } - @Override - public List getArticleCategoryList(ArticleCategoryExportReqVO exportReqVO) { - return articleCategoryMapper.selectList(exportReqVO); - } - @Override public List getArticleCategoryListByStatus(Integer status) { return articleCategoryMapper.selectList(ArticleCategoryDO::getStatus, status); 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..26662be77 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,15 +1,12 @@ 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.ArticlePageReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleUpdateReqVO; import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO; import javax.validation.Valid; -import java.util.Collection; -import java.util.List; /** * 文章管理 Service 接口 @@ -48,14 +45,6 @@ public interface ArticleService { */ ArticleDO getArticle(Long id); - /** - * 获得文章管理列表 - * - * @param ids 编号 - * @return 文章管理列表 - */ - List getArticleList(Collection ids); - /** * 获得文章管理分页 * @@ -64,12 +53,4 @@ public interface ArticleService { */ PageResult getArticlePage(ArticlePageReqVO pageReqVO); - /** - * 获得文章管理列表, 用于 Excel 导出 - * - * @param exportReqVO 查询条件 - * @return 文章管理列表 - */ - List getArticleList(ArticleExportReqVO exportReqVO); - } 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..b1c2b9150 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 @@ -1,12 +1,9 @@ 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.ArticlePageReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleUpdateReqVO; 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; @@ -14,8 +11,6 @@ import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; -import java.util.Collection; -import java.util.List; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.ARTICLE_NOT_EXISTS; @@ -34,6 +29,7 @@ public class ArticleServiceImpl implements ArticleService { @Override public Long createArticle(ArticleCreateReqVO createReqVO) { + // TODO @puhui999:需要校验分类存在 // 插入 ArticleDO article = ArticleConvert.INSTANCE.convert(createReqVO); articleMapper.insert(article); @@ -45,6 +41,8 @@ public class ArticleServiceImpl implements ArticleService { public void updateArticle(ArticleUpdateReqVO updateReqVO) { // 校验存在 validateArticleExists(updateReqVO.getId()); + // TODO @puhui999:需要校验分类存在 + // 更新 ArticleDO updateObj = ArticleConvert.INSTANCE.convert(updateReqVO); articleMapper.updateById(updateObj); @@ -69,22 +67,9 @@ public class ArticleServiceImpl implements ArticleService { return articleMapper.selectById(id); } - @Override - public List getArticleList(Collection ids) { - if (CollUtil.isEmpty(ids)) { - return ListUtil.empty(); - } - return articleMapper.selectBatchIds(ids); - } - @Override public PageResult getArticlePage(ArticlePageReqVO pageReqVO) { return articleMapper.selectPage(pageReqVO); } - @Override - public List getArticleList(ArticleExportReqVO exportReqVO) { - return articleMapper.selectList(exportReqVO); - } - } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/article/ArticleCategoryServiceImplTest.java b/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/article/ArticleCategoryServiceImplTest.java index c9a5e1e15..2f710d30e 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/article/ArticleCategoryServiceImplTest.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/article/ArticleCategoryServiceImplTest.java @@ -3,7 +3,6 @@ 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.category.ArticleCategoryCreateReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryExportReqVO; import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryPageReqVO; import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryUpdateReqVO; import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleCategoryDO; @@ -13,7 +12,6 @@ import org.junit.jupiter.api.Test; import org.springframework.context.annotation.Import; import javax.annotation.Resource; -import java.util.List; import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; @@ -24,6 +22,7 @@ import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.ARTICLE_CATEGORY_NOT_EXISTS; import static org.junit.jupiter.api.Assertions.*; +// TODO 芋艿:review 单测 /** * {@link ArticleCategoryServiceImpl} 的单元测试类 * @@ -137,39 +136,4 @@ public class ArticleCategoryServiceImplTest extends BaseDbUnitTest { assertPojoEquals(dbArticleCategory, pageResult.getList().get(0)); } - @Test - @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 - public void testGetArticleCategoryList() { - // mock 数据 - ArticleCategoryDO dbArticleCategory = randomPojo(ArticleCategoryDO.class, o -> { // 等会查询到 - o.setName(null); - o.setPicUrl(null); - o.setStatus(null); - o.setSort(null); - o.setCreateTime(null); - }); - articleCategoryMapper.insert(dbArticleCategory); - // 测试 name 不匹配 - articleCategoryMapper.insert(cloneIgnoreId(dbArticleCategory, o -> o.setName(null))); - // 测试 picUrl 不匹配 - articleCategoryMapper.insert(cloneIgnoreId(dbArticleCategory, o -> o.setPicUrl(null))); - // 测试 status 不匹配 - articleCategoryMapper.insert(cloneIgnoreId(dbArticleCategory, o -> o.setStatus(null))); - // 测试 sort 不匹配 - articleCategoryMapper.insert(cloneIgnoreId(dbArticleCategory, o -> o.setSort(null))); - // 测试 createTime 不匹配 - articleCategoryMapper.insert(cloneIgnoreId(dbArticleCategory, o -> o.setCreateTime(null))); - // 准备参数 - ArticleCategoryExportReqVO reqVO = new ArticleCategoryExportReqVO(); - reqVO.setName(null); - reqVO.setStatus(null); - reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); - - // 调用 - List list = articleCategoryService.getArticleCategoryList(reqVO); - // 断言 - assertEquals(1, list.size()); - assertPojoEquals(dbArticleCategory, list.get(0)); - } - } 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..0c50fe6b8 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.article.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.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;