Commit dd0a2b73e8bced407c0ff829b3cf241ac4b182b0

Authored by YunaiV
1 parent 6dbc942c

✨ MALL:清理多余的 decorate 类

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