Commit 4a3703e3026f715d0119e7cdb05e371fd719684e
1 parent
050f0bb6
mall + promotion:review 页面装修
Showing
6 changed files
with
19 additions
and
15 deletions
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/decorate/DecorateComponentController.java
| ... | ... | @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.promotion.controller.admin.decorate; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.validation.InEnum; |
| 5 | -import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentReqVO; | |
| 5 | +import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentSaveReqVO; | |
| 6 | 6 | import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentRespVO; |
| 7 | 7 | import cn.iocoder.yudao.module.promotion.enums.decorate.DecoratePageEnum; |
| 8 | 8 | import cn.iocoder.yudao.module.promotion.service.decorate.DecorateComponentService; |
| ... | ... | @@ -27,10 +27,10 @@ public class DecorateComponentController { |
| 27 | 27 | private DecorateComponentService decorateComponentService; |
| 28 | 28 | |
| 29 | 29 | @PostMapping("/page-save") |
| 30 | - @Operation(summary = "页面装修保存") | |
| 30 | + @Operation(summary = "保存页面装修") | |
| 31 | 31 | // TODO 加权限 |
| 32 | - public CommonResult<Boolean> pageSave(@Valid @RequestBody DecorateComponentReqVO reqVO) { | |
| 33 | - decorateComponentService.pageSave(reqVO); | |
| 32 | + public CommonResult<Boolean> savePageComponents(@Valid @RequestBody DecorateComponentSaveReqVO reqVO) { | |
| 33 | + decorateComponentService.savePageComponents(reqVO); | |
| 34 | 34 | return success(true); |
| 35 | 35 | } |
| 36 | 36 | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/decorate/vo/DecorateComponentReqVO.java renamed to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/decorate/vo/DecorateComponentSaveReqVO.java
| ... | ... | @@ -10,9 +10,10 @@ import javax.validation.constraints.NotEmpty; |
| 10 | 10 | import javax.validation.constraints.NotNull; |
| 11 | 11 | import java.util.List; |
| 12 | 12 | |
| 13 | -@Schema(description = "管理后台 - 页面装修 Request VO ") | |
| 13 | +@Schema(description = "管理后台 - 页面装修的保存 Request VO ") | |
| 14 | 14 | @Data |
| 15 | -public class DecorateComponentReqVO { | |
| 15 | +public class DecorateComponentSaveReqVO { | |
| 16 | + | |
| 16 | 17 | @Schema(description = "页面 id ", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 17 | 18 | @NotNull(message = "页面 id 不能为空") |
| 18 | 19 | @InEnum(DecoratePageEnum.class) |
| ... | ... | @@ -26,6 +27,7 @@ public class DecorateComponentReqVO { |
| 26 | 27 | @Schema(description = "管理后台 - 页面装修组件 Request VO") |
| 27 | 28 | @Data |
| 28 | 29 | public static class ComponentReqVO { |
| 30 | + | |
| 29 | 31 | @Schema(description = "组件编码", example = "1") |
| 30 | 32 | private Long id; |
| 31 | 33 | |
| ... | ... | @@ -36,6 +38,7 @@ public class DecorateComponentReqVO { |
| 36 | 38 | @Schema(description = "组件对应值, json 字符串, 含内容配置,具体数据", requiredMode = Schema.RequiredMode.REQUIRED, example = "TODO") |
| 37 | 39 | @NotEmpty(message = "组件值为空") |
| 38 | 40 | private String value; |
| 41 | + | |
| 39 | 42 | } |
| 40 | 43 | |
| 41 | 44 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/decorate/DecorateComponentConvert.java
| 1 | 1 | package cn.iocoder.yudao.module.promotion.convert.decorate; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 4 | -import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentReqVO; | |
| 4 | +import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentSaveReqVO; | |
| 5 | 5 | import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentRespVO; |
| 6 | 6 | import cn.iocoder.yudao.module.promotion.controller.app.decorate.vo.AppDecorateComponentRespVO; |
| 7 | 7 | import cn.iocoder.yudao.module.promotion.dal.dataobject.decorate.DecorateComponentDO; |
| ... | ... | @@ -18,7 +18,7 @@ public interface DecorateComponentConvert { |
| 18 | 18 | |
| 19 | 19 | DecorateComponentConvert INSTANCE = Mappers.getMapper(DecorateComponentConvert.class); |
| 20 | 20 | |
| 21 | - default List<DecorateComponentDO> convertList(Integer pageId, List<DecorateComponentReqVO.ComponentReqVO> components) { | |
| 21 | + default List<DecorateComponentDO> convertList(Integer pageId, List<DecorateComponentSaveReqVO.ComponentReqVO> components) { | |
| 22 | 22 | return CollectionUtils.convertList(components, c -> convert(pageId, c)); |
| 23 | 23 | } |
| 24 | 24 | |
| ... | ... | @@ -27,7 +27,7 @@ public interface DecorateComponentConvert { |
| 27 | 27 | return new DecorateComponentRespVO().setPageId(pageId).setComponents(components); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - DecorateComponentDO convert(Integer pageId, DecorateComponentReqVO.ComponentReqVO reqVO); | |
| 30 | + DecorateComponentDO convert(Integer pageId, DecorateComponentSaveReqVO.ComponentReqVO reqVO); | |
| 31 | 31 | |
| 32 | 32 | ComponentRespVO convert3(DecorateComponentDO componentDO); |
| 33 | 33 | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/decorate/DecorateComponentService.java
| 1 | 1 | package cn.iocoder.yudao.module.promotion.service.decorate; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentReqVO; | |
| 3 | +import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentSaveReqVO; | |
| 4 | 4 | import cn.iocoder.yudao.module.promotion.dal.dataobject.decorate.DecorateComponentDO; |
| 5 | 5 | import cn.iocoder.yudao.module.promotion.enums.decorate.DecoratePageEnum; |
| 6 | 6 | |
| ... | ... | @@ -18,7 +18,7 @@ public interface DecorateComponentService { |
| 18 | 18 | * |
| 19 | 19 | * @param reqVO 请求 VO |
| 20 | 20 | */ |
| 21 | - void pageSave(DecorateComponentReqVO reqVO); | |
| 21 | + void savePageComponents(DecorateComponentSaveReqVO reqVO); | |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * 根据页面 id。获取页面的组件信息 | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/decorate/DecorateComponentServiceImpl.java
| 1 | 1 | package cn.iocoder.yudao.module.promotion.service.decorate; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | -import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentReqVO; | |
| 5 | -import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentReqVO.ComponentReqVO; | |
| 4 | +import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentSaveReqVO; | |
| 5 | +import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentSaveReqVO.ComponentReqVO; | |
| 6 | 6 | import cn.iocoder.yudao.module.promotion.dal.dataobject.decorate.DecorateComponentDO; |
| 7 | 7 | import cn.iocoder.yudao.module.promotion.dal.mysql.decorate.DecorateComponentMapper; |
| 8 | 8 | import org.springframework.stereotype.Service; |
| ... | ... | @@ -27,7 +27,7 @@ public class DecorateComponentServiceImpl implements DecorateComponentService { |
| 27 | 27 | private DecorateComponentMapper decorateComponentMapper; |
| 28 | 28 | |
| 29 | 29 | @Override |
| 30 | - public void pageSave(DecorateComponentReqVO reqVO) { | |
| 30 | + public void savePageComponents(DecorateComponentSaveReqVO reqVO) { | |
| 31 | 31 | // 1.新增或修改页面组件 |
| 32 | 32 | List<DecorateComponentDO> oldList = decorateComponentMapper.selectByPage(reqVO.getPageId()); |
| 33 | 33 | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/decorate/DecorateComponentServiceImplTest.java
| ... | ... | @@ -16,6 +16,7 @@ import static cn.iocoder.yudao.module.promotion.enums.decorate.DecorateComponent |
| 16 | 16 | import static cn.iocoder.yudao.module.promotion.enums.decorate.DecoratePageEnum.INDEX; |
| 17 | 17 | import static org.mockito.ArgumentMatchers.eq; |
| 18 | 18 | |
| 19 | +// TODO @芋艿:后续 review 下 | |
| 19 | 20 | /** |
| 20 | 21 | * @author jason |
| 21 | 22 | */ |
| ... | ... | @@ -42,4 +43,4 @@ public class DecorateComponentServiceImplTest extends BaseMockitoUnitTest { |
| 42 | 43 | //mock 方法 |
| 43 | 44 | Mockito.when(decorateComponentMapper.selectByPage(eq(1))).thenReturn(list); |
| 44 | 45 | } |
| 45 | -} | |
| 46 | 46 | \ No newline at end of file |
| 47 | +} | ... | ... |