diff --git a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/decorate/DecorateComponentEnum.java b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/decorate/DecorateComponentEnum.java deleted file mode 100644 index 45bc1fe4d..000000000 --- a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/decorate/DecorateComponentEnum.java +++ /dev/null @@ -1,61 +0,0 @@ -package cn.iocoder.yudao.module.promotion.enums.decorate; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -/** - * 页面组件枚举 - * - * @author jason - */ -@Getter -@AllArgsConstructor -@SuppressWarnings("JavadocLinkAsPlainText") -public enum DecorateComponentEnum { - - /** - * 格式:[{ - * "name": "标题" - * "picUrl": "https://www.iocoder.cn/xxx.png", - * "url": "/pages/users/index" - * }] - * - * 最多 10 个 - */ - MENU("menu", "菜单"), - /** - * 格式:[{ - * "name": "标题" - * "url": "/pages/users/index" - * }] - */ - ROLLING_NEWS("scrolling-news", "滚动新闻"), - /** - * 格式:[{ - * "picUrl": "https://www.iocoder.cn/xxx.png", - * "url": "/pages/users/index" - * }] - */ - SLIDE_SHOW("slide-show", "轮播图"), - /** - * 格式:[{ - * "name": "标题" - * "type": "类型", // best、hot、new、benefit、good - * "tag": "标签" // 例如说:多买多省 - * }] - * - * 最多 4 个 - */ - PRODUCT_RECOMMEND("product-recommend", "商品推荐"); - - /** - * 页面组件代码 - */ - private final String code; - - /** - * 页面组件说明 - */ - private final String desc; - -} diff --git a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/decorate/DecoratePageEnum.java b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/diy/DiyPageEnum.java similarity index 77% rename from yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/decorate/DecoratePageEnum.java rename to yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/diy/DiyPageEnum.java index d773c2040..fa00adaad 100644 --- a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/decorate/DecoratePageEnum.java +++ b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/diy/DiyPageEnum.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.promotion.enums.decorate; +package cn.iocoder.yudao.module.promotion.enums.diy; import cn.iocoder.yudao.framework.common.core.IntArrayValuable; import lombok.AllArgsConstructor; @@ -13,13 +13,13 @@ import java.util.Arrays; */ @AllArgsConstructor @Getter -public enum DecoratePageEnum implements IntArrayValuable { +public enum DiyPageEnum implements IntArrayValuable { INDEX(1, "首页"), MY(2, "我的"), ; - private static final int[] ARRAYS = Arrays.stream(values()).mapToInt(DecoratePageEnum::getPage).toArray(); + private static final int[] ARRAYS = Arrays.stream(values()).mapToInt(DiyPageEnum::getPage).toArray(); /** * 页面编号 diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/CombinationRecordController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/CombinationRecordController.java index b72215572..ed93f2fb8 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/CombinationRecordController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/CombinationRecordController.java @@ -43,7 +43,8 @@ public class CombinationRecordController { @GetMapping("/page") @Operation(summary = "获得拼团记录分页") @PreAuthorize("@ss.hasPermission('promotion:combination-record:query')") - public CommonResult> getBargainRecordPage(@Valid CombinationRecordReqPageVO pageVO) { + public CommonResult> getCombinationRecordPage( + @Valid CombinationRecordReqPageVO pageVO) { PageResult recordPage = combinationRecordService.getCombinationRecordPage(pageVO); // 拼接数据 List activities = combinationActivityService.getCombinationActivityListByIds( diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/decorate/DecorateComponentController.http b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/decorate/DecorateComponentController.http deleted file mode 100644 index 79975c590..000000000 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/decorate/DecorateComponentController.http +++ /dev/null @@ -1,18 +0,0 @@ -### /promotion/decorate/save 保存页面装修组件 -POST {{baseUrl}}/promotion/decorate/save -Content-Type: application/json -Authorization: Bearer {{token}} -tenant-id: {{adminTenentId}} - -{ - "page": 1, - "code": "slide-show", - "status": 0, - "value": "null" -} - -### /promotion/decorate/list 获取指定页面的组件列表 -GET {{baseUrl}}/promotion/decorate/list?page=1 -Content-Type: application/json -Authorization: Bearer {{token}} -tenant-id: {{adminTenentId}} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/decorate/DecorateComponentController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/decorate/DecorateComponentController.java deleted file mode 100644 index 1a6ee6475..000000000 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/decorate/DecorateComponentController.java +++ /dev/null @@ -1,50 +0,0 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.decorate; - -import cn.iocoder.yudao.framework.common.pojo.CommonResult; -import cn.iocoder.yudao.framework.common.validation.InEnum; -import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentRespVO; -import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentSaveReqVO; -import cn.iocoder.yudao.module.promotion.convert.decorate.DecorateComponentConvert; -import cn.iocoder.yudao.module.promotion.enums.decorate.DecoratePageEnum; -import cn.iocoder.yudao.module.promotion.service.decorate.DecorateComponentService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import jakarta.annotation.Resource; -import jakarta.validation.Valid; -import java.util.List; - -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; - -@Tag(name = "管理后台 - 店铺页面装修") -@RestController -@RequestMapping("/promotion/decorate") -@Validated -public class DecorateComponentController { - - @Resource - private DecorateComponentService decorateComponentService; - - @PostMapping("/save") - @Operation(summary = "保存页面装修组件") - @PreAuthorize("@ss.hasPermission('promotion:decorate:save')") - public CommonResult saveDecorateComponent(@Valid @RequestBody DecorateComponentSaveReqVO reqVO) { - decorateComponentService.saveDecorateComponent(reqVO); - return success(true); - } - - @GetMapping("/list") - @Operation(summary = "获取指定页面的组件列表") - @Parameter(name = "page", description = "页面 id", required = true) - @PreAuthorize("@ss.hasPermission('promotion:decorate:query')") - public CommonResult> getDecorateComponentListByPage( - @RequestParam("page") @InEnum(DecoratePageEnum.class) Integer page) { - return success(DecorateComponentConvert.INSTANCE.convertList02( - decorateComponentService.getDecorateComponentListByPage(page, null))); - } - -} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/decorate/vo/DecorateComponentRespVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/decorate/vo/DecorateComponentRespVO.java deleted file mode 100644 index 6996d58e8..000000000 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/decorate/vo/DecorateComponentRespVO.java +++ /dev/null @@ -1,19 +0,0 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -@Schema(description = "管理后台 - 页面装修 Resp VO") -@Data -public class DecorateComponentRespVO { - - @Schema(description = "组件编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "nav-menu") - private String code; - - @Schema(description = "组件的内容配置项", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "TODO") - private String value; - - @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") - private Integer status; - -} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/decorate/vo/DecorateComponentSaveReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/decorate/vo/DecorateComponentSaveReqVO.java deleted file mode 100644 index c081ac80c..000000000 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/decorate/vo/DecorateComponentSaveReqVO.java +++ /dev/null @@ -1,31 +0,0 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo; - -import cn.iocoder.yudao.framework.common.validation.InEnum; -import cn.iocoder.yudao.module.promotion.enums.decorate.DecoratePageEnum; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import jakarta.validation.constraints.NotEmpty; -import jakarta.validation.constraints.NotNull; - -@Schema(description = "管理后台 - 页面装修的保存 Request VO ") -@Data -public class DecorateComponentSaveReqVO { - - @Schema(description = "页面 id ", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") - @NotNull(message = "页面 id 不能为空") - @InEnum(DecoratePageEnum.class) - private Integer page; - - @Schema(description = "组件编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "nav-menu") - @NotEmpty(message = "组件编码不能为空") - private String code; - - @Schema(description = "组件对应值, json 字符串, 含内容配置,具体数据", requiredMode = Schema.RequiredMode.REQUIRED) - @NotEmpty(message = "组件值为空") - private String value; - - @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") - private Integer status; - -} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/decorate/AppDecorateController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/decorate/AppDecorateController.java deleted file mode 100644 index 6f5b1ec68..000000000 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/decorate/AppDecorateController.java +++ /dev/null @@ -1,43 +0,0 @@ -package cn.iocoder.yudao.module.promotion.controller.app.decorate; - -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; -import cn.iocoder.yudao.framework.common.pojo.CommonResult; -import cn.iocoder.yudao.framework.common.validation.InEnum; -import cn.iocoder.yudao.module.promotion.controller.app.decorate.vo.AppDecorateComponentRespVO; -import cn.iocoder.yudao.module.promotion.convert.decorate.DecorateComponentConvert; -import cn.iocoder.yudao.module.promotion.enums.decorate.DecoratePageEnum; -import cn.iocoder.yudao.module.promotion.service.decorate.DecorateComponentService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import jakarta.annotation.Resource; -import java.util.List; - -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; - -@Tag(name = "用户 APP - 店铺装修") -@RestController -@RequestMapping("/promotion/decorate") -@Validated -@Deprecated // 废弃 -public class AppDecorateController { - - @Resource - private DecorateComponentService decorateComponentService; - - @GetMapping("/list") - @Operation(summary = "获取指定页面的组件列表") - @Parameter(name = "page", description = "页面编号", required = true) - public CommonResult> getDecorateComponentListByPage( - @RequestParam("page") @InEnum(DecoratePageEnum.class) Integer page) { - return success(DecorateComponentConvert.INSTANCE.convertList( - decorateComponentService.getDecorateComponentListByPage(page, CommonStatusEnum.ENABLE.getStatus()))); - } - -} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/decorate/vo/AppDecorateComponentRespVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/decorate/vo/AppDecorateComponentRespVO.java deleted file mode 100644 index 8926db26e..000000000 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/decorate/vo/AppDecorateComponentRespVO.java +++ /dev/null @@ -1,16 +0,0 @@ -package cn.iocoder.yudao.module.promotion.controller.app.decorate.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -@Schema(description = "用户 App - 页面组件 Resp VO") -@Data -public class AppDecorateComponentRespVO { - - @Schema(description = "组件编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "nav-menu") - private String code; - - @Schema(description = "组件的内容配置项", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "TODO") - private String value; - -} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/diy/AppDiyTemplateController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/diy/AppDiyTemplateController.java index 6e4ee2501..e8babd15d 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/diy/AppDiyTemplateController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/diy/AppDiyTemplateController.java @@ -5,19 +5,19 @@ import cn.iocoder.yudao.module.promotion.controller.app.diy.vo.AppDiyTemplatePro import cn.iocoder.yudao.module.promotion.convert.diy.DiyTemplateConvert; import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyPageDO; import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyTemplateDO; -import cn.iocoder.yudao.module.promotion.enums.decorate.DecoratePageEnum; +import cn.iocoder.yudao.module.promotion.enums.diy.DiyPageEnum; import cn.iocoder.yudao.module.promotion.service.diy.DiyPageService; import cn.iocoder.yudao.module.promotion.service.diy.DiyTemplateService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import jakarta.annotation.Resource; import java.util.List; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @@ -56,8 +56,8 @@ public class AppDiyTemplateController { } // 查询模板下的页面 List pages = diyPageService.getDiyPageByTemplateId(diyTemplate.getId()); - String home = findFirst(pages, page -> DecoratePageEnum.INDEX.getName().equals(page.getName()), DiyPageDO::getProperty); - String user = findFirst(pages, page -> DecoratePageEnum.MY.getName().equals(page.getName()), DiyPageDO::getProperty); + String home = findFirst(pages, page -> DiyPageEnum.INDEX.getName().equals(page.getName()), DiyPageDO::getProperty); + String user = findFirst(pages, page -> DiyPageEnum.MY.getName().equals(page.getName()), DiyPageDO::getProperty); // 拼接返回 return DiyTemplateConvert.INSTANCE.convertPropertyVo2(diyTemplate, home, user); } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/decorate/DecorateComponentConvert.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/decorate/DecorateComponentConvert.java deleted file mode 100644 index df6613b97..000000000 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/decorate/DecorateComponentConvert.java +++ /dev/null @@ -1,23 +0,0 @@ -package cn.iocoder.yudao.module.promotion.convert.decorate; - -import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentRespVO; -import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentSaveReqVO; -import cn.iocoder.yudao.module.promotion.controller.app.decorate.vo.AppDecorateComponentRespVO; -import cn.iocoder.yudao.module.promotion.dal.dataobject.decorate.DecorateComponentDO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper -public interface DecorateComponentConvert { - - DecorateComponentConvert INSTANCE = Mappers.getMapper(DecorateComponentConvert.class); - - List convertList02(List list); - - DecorateComponentDO convert(DecorateComponentSaveReqVO bean); - - List convertList(List list); - -} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/decorate/DecorateComponentDO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/decorate/DecorateComponentDO.java deleted file mode 100644 index 876431772..000000000 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/decorate/DecorateComponentDO.java +++ /dev/null @@ -1,52 +0,0 @@ -package cn.iocoder.yudao.module.promotion.dal.dataobject.decorate; - -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; -import cn.iocoder.yudao.module.promotion.enums.decorate.DecoratePageEnum; -import cn.iocoder.yudao.module.promotion.enums.decorate.DecorateComponentEnum; -import com.baomidou.mybatisplus.annotation.*; - -import lombok.Data; - -/** - * 页面装修组件 DO, 一个页面由多个组件构成 - * - * @author jason - */ -@TableName(value ="promotion_decorate_component") -@KeySequence("promotion_decorate_component_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 -@Data -public class DecorateComponentDO extends BaseDO { - - /** - * 编号 - */ - @TableId - private Long id; - - /** - * 所属页面 id - * - * 枚举 {@link DecoratePageEnum#getPage()} - */ - private Integer page; - - /** - * 组件编码 - * 枚举 {@link DecorateComponentEnum#getCode()} - */ - private String code; - - /** - * 组件值:json 格式。包含配置和数据 - */ - private String value; - - /** - * 状态 - * - * 枚举 {@link CommonStatusEnum} - */ - private Integer status; - -} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/decorate/DecorateComponentMapper.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/decorate/DecorateComponentMapper.java deleted file mode 100644 index 38b448e8a..000000000 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/decorate/DecorateComponentMapper.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.iocoder.yudao.module.promotion.dal.mysql.decorate; - -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; -import cn.iocoder.yudao.module.promotion.dal.dataobject.decorate.DecorateComponentDO; -import org.apache.ibatis.annotations.Mapper; - -import java.util.List; - -@Mapper -public interface DecorateComponentMapper extends BaseMapperX { - - default List selectListByPageAndStatus(Integer page, Integer status) { - return selectList(new LambdaQueryWrapperX() - .eq(DecorateComponentDO::getPage, page) - .eqIfPresent(DecorateComponentDO::getStatus, status)); - } - - default DecorateComponentDO selectByPageAndCode(Integer page, String code) { - return selectOne(DecorateComponentDO::getPage, page, - DecorateComponentDO::getCode, code); - } - -} - - - - diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/decorate/DecorateComponentService.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/decorate/DecorateComponentService.java deleted file mode 100644 index 82f0b0f5b..000000000 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/decorate/DecorateComponentService.java +++ /dev/null @@ -1,31 +0,0 @@ -package cn.iocoder.yudao.module.promotion.service.decorate; - -import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentSaveReqVO; -import cn.iocoder.yudao.module.promotion.dal.dataobject.decorate.DecorateComponentDO; -import cn.iocoder.yudao.module.promotion.enums.decorate.DecoratePageEnum; - -import java.util.List; - -/** - * 装修组件 Service 接口 - * - * @author jason - */ -public interface DecorateComponentService { - - /** - * 保存页面的组件信息 - * - * @param reqVO 请求 VO - */ - void saveDecorateComponent(DecorateComponentSaveReqVO reqVO); - - /** - * 根据页面 id,获取页面的组件信息 - * - * @param page 页面编号 {@link DecoratePageEnum#getPage()} - * @param status 状态 - */ - List getDecorateComponentListByPage(Integer page, Integer status); - -} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/decorate/DecorateComponentServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/decorate/DecorateComponentServiceImpl.java deleted file mode 100644 index 46353a1ee..000000000 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/decorate/DecorateComponentServiceImpl.java +++ /dev/null @@ -1,40 +0,0 @@ -package cn.iocoder.yudao.module.promotion.service.decorate; - -import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentSaveReqVO; -import cn.iocoder.yudao.module.promotion.convert.decorate.DecorateComponentConvert; -import cn.iocoder.yudao.module.promotion.dal.dataobject.decorate.DecorateComponentDO; -import cn.iocoder.yudao.module.promotion.dal.mysql.decorate.DecorateComponentMapper; -import org.springframework.stereotype.Service; - -import jakarta.annotation.Resource; -import java.util.List; - -/** - * 装修组件 Service 实现 - * - * @author jason - */ -@Service -public class DecorateComponentServiceImpl implements DecorateComponentService { - - @Resource - private DecorateComponentMapper decorateComponentMapper; - - @Override - public void saveDecorateComponent(DecorateComponentSaveReqVO reqVO) { - // 1. 如果存在,则进行更新 - DecorateComponentDO dbComponent = decorateComponentMapper.selectByPageAndCode(reqVO.getPage(), reqVO.getCode()); - if (dbComponent != null) { - decorateComponentMapper.updateById(DecorateComponentConvert.INSTANCE.convert(reqVO).setId(dbComponent.getId())); - return; - } - // 2. 不存在,则进行新增 - decorateComponentMapper.insert(DecorateComponentConvert.INSTANCE.convert(reqVO)); - } - - @Override - public List getDecorateComponentListByPage(Integer page, Integer status) { - return decorateComponentMapper.selectListByPageAndStatus(page, status); - } - -} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/decorate/DecorateComponentServiceImplTest.java b/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/decorate/DecorateComponentServiceImplTest.java deleted file mode 100644 index 95c542b67..000000000 --- a/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/decorate/DecorateComponentServiceImplTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package cn.iocoder.yudao.module.promotion.service.decorate; - -import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest; -import cn.iocoder.yudao.module.promotion.dal.mysql.decorate.DecorateComponentMapper; -import org.junit.jupiter.api.BeforeEach; -import org.mockito.InjectMocks; -import org.mockito.Mock; - -// TODO @芋艿:后续 review 下 -/** - * @author jason - */ -public class DecorateComponentServiceImplTest extends BaseMockitoUnitTest { - - @InjectMocks - private DecorateComponentServiceImpl decoratePageService; - - @Mock - private DecorateComponentMapper decorateComponentMapper; - - @BeforeEach - public void init(){ - - } - -// @Test -// void testResp(){ -// List list = new ArrayList<>(1); -// DecorateComponentDO decorateDO = new DecorateComponentDO() -// .setPage(INDEX.getPage()).setValue("") -// .setCode(ROLLING_NEWS.getCode()).setId(1L); -// list.add(decorateDO); -// //mock 方法 -// Mockito.when(decorateComponentMapper.selectListByPageAndStatus(eq(1))).thenReturn(list); -// } -}