mall + promotion:review 页面装修
This commit is contained in:
parent
050f0bb6a2
commit
4a3703e302
@ -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<Boolean> pageSave(@Valid @RequestBody DecorateComponentReqVO reqVO) {
|
||||
decorateComponentService.pageSave(reqVO);
|
||||
public CommonResult<Boolean> savePageComponents(@Valid @RequestBody DecorateComponentSaveReqVO reqVO) {
|
||||
decorateComponentService.savePageComponents(reqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -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<DecorateComponentDO> convertList(Integer pageId, List<DecorateComponentReqVO.ComponentReqVO> components) {
|
||||
default List<DecorateComponentDO> convertList(Integer pageId, List<DecorateComponentSaveReqVO.ComponentReqVO> 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);
|
||||
|
||||
|
@ -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。获取页面的组件信息
|
||||
|
@ -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<DecorateComponentDO> oldList = decorateComponentMapper.selectByPage(reqVO.getPageId());
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user