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 index a4f920698..9536df7f0 100644 --- 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 @@ -2,7 +2,7 @@ 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.DecorateComponentReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentSaveReqVO; import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentRespVO; import cn.iocoder.yudao.module.promotion.enums.decorate.DecoratePageEnum; import cn.iocoder.yudao.module.promotion.service.decorate.DecorateComponentService; @@ -27,10 +27,10 @@ public class DecorateComponentController { private DecorateComponentService decorateComponentService; @PostMapping("/page-save") - @Operation(summary = "页面装修保存") + @Operation(summary = "保存页面装修") // TODO 加权限 - public CommonResult pageSave(@Valid @RequestBody DecorateComponentReqVO reqVO) { - decorateComponentService.pageSave(reqVO); + public CommonResult savePageComponents(@Valid @RequestBody DecorateComponentSaveReqVO reqVO) { + decorateComponentService.savePageComponents(reqVO); return success(true); } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/decorate/vo/DecorateComponentReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/decorate/vo/DecorateComponentSaveReqVO.java similarity index 92% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/decorate/vo/DecorateComponentReqVO.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/decorate/vo/DecorateComponentSaveReqVO.java index de349a02d..f3838a763 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/decorate/vo/DecorateComponentReqVO.java +++ b/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; import javax.validation.constraints.NotNull; import java.util.List; -@Schema(description = "管理后台 - 页面装修 Request VO ") +@Schema(description = "管理后台 - 页面装修的保存 Request VO ") @Data -public class DecorateComponentReqVO { +public class DecorateComponentSaveReqVO { + @Schema(description = "页面 id ", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") @NotNull(message = "页面 id 不能为空") @InEnum(DecoratePageEnum.class) @@ -26,6 +27,7 @@ public class DecorateComponentReqVO { @Schema(description = "管理后台 - 页面装修组件 Request VO") @Data public static class ComponentReqVO { + @Schema(description = "组件编码", example = "1") private Long id; @@ -36,6 +38,7 @@ public class DecorateComponentReqVO { @Schema(description = "组件对应值, json 字符串, 含内容配置,具体数据", requiredMode = Schema.RequiredMode.REQUIRED, example = "TODO") @NotEmpty(message = "组件值为空") private String value; + } } 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 index 2a163fb17..c815220ee 100644 --- 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 @@ -1,7 +1,7 @@ package cn.iocoder.yudao.module.promotion.convert.decorate; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; -import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentSaveReqVO; import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentRespVO; import cn.iocoder.yudao.module.promotion.controller.app.decorate.vo.AppDecorateComponentRespVO; import cn.iocoder.yudao.module.promotion.dal.dataobject.decorate.DecorateComponentDO; @@ -18,7 +18,7 @@ public interface DecorateComponentConvert { DecorateComponentConvert INSTANCE = Mappers.getMapper(DecorateComponentConvert.class); - default List convertList(Integer pageId, List components) { + default List convertList(Integer pageId, List components) { return CollectionUtils.convertList(components, c -> convert(pageId, c)); } @@ -27,7 +27,7 @@ public interface DecorateComponentConvert { return new DecorateComponentRespVO().setPageId(pageId).setComponents(components); } - DecorateComponentDO convert(Integer pageId, DecorateComponentReqVO.ComponentReqVO reqVO); + DecorateComponentDO convert(Integer pageId, DecorateComponentSaveReqVO.ComponentReqVO reqVO); ComponentRespVO convert3(DecorateComponentDO componentDO); 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 index 2ecd84452..cf1431fe8 100644 --- 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 @@ -1,6 +1,6 @@ package cn.iocoder.yudao.module.promotion.service.decorate; -import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentReqVO; +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; @@ -18,7 +18,7 @@ public interface DecorateComponentService { * * @param reqVO 请求 VO */ - void pageSave(DecorateComponentReqVO reqVO); + void savePageComponents(DecorateComponentSaveReqVO reqVO); /** * 根据页面 id。获取页面的组件信息 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 index 731ead70f..73256922a 100644 --- 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 @@ -1,8 +1,8 @@ package cn.iocoder.yudao.module.promotion.service.decorate; import cn.hutool.core.collection.CollUtil; -import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentReqVO.ComponentReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentSaveReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentSaveReqVO.ComponentReqVO; 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; @@ -27,7 +27,7 @@ public class DecorateComponentServiceImpl implements DecorateComponentService { private DecorateComponentMapper decorateComponentMapper; @Override - public void pageSave(DecorateComponentReqVO reqVO) { + public void savePageComponents(DecorateComponentSaveReqVO reqVO) { // 1.新增或修改页面组件 List oldList = decorateComponentMapper.selectByPage(reqVO.getPageId()); 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 index c78e4ddc4..067397905 100644 --- 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 @@ -16,6 +16,7 @@ import static cn.iocoder.yudao.module.promotion.enums.decorate.DecorateComponent import static cn.iocoder.yudao.module.promotion.enums.decorate.DecoratePageEnum.INDEX; import static org.mockito.ArgumentMatchers.eq; +// TODO @芋艿:后续 review 下 /** * @author jason */ @@ -42,4 +43,4 @@ public class DecorateComponentServiceImplTest extends BaseMockitoUnitTest { //mock 方法 Mockito.when(decorateComponentMapper.selectByPage(eq(1))).thenReturn(list); } -} \ No newline at end of file +}