mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-08-17 03:31:54 +08:00
mall + promotion:review 页面装修
This commit is contained in:
@@ -38,8 +38,9 @@ public class DecorateComponentController {
|
||||
@Operation(summary = "获取装修页面组件")
|
||||
@Parameter(name = "type", description = "页面类型", required = true)
|
||||
// TODO 加权限
|
||||
public CommonResult<DecorateComponentRespVO> getPageComponents(@RequestParam("type")
|
||||
@InEnum(DecoratePageTypeEnum.class) Integer type) {
|
||||
public CommonResult<DecorateComponentRespVO> getPageComponents(
|
||||
@RequestParam("type") @InEnum(DecoratePageTypeEnum.class) Integer type) {
|
||||
return success(INSTANCE.convert2(type, decorateComponentService.getPageComponents(type)));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -10,9 +10,6 @@ import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jason
|
||||
*/
|
||||
@Schema(description = "管理后台 - 页面装修 Request VO ")
|
||||
@Data
|
||||
public class DecorateComponentReqVO {
|
||||
@@ -20,6 +17,7 @@ public class DecorateComponentReqVO {
|
||||
@NotNull(message = "页面类型不能为空")
|
||||
@InEnum(DecoratePageTypeEnum.class)
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "页面组件列表", requiredMode = Schema.RequiredMode.REQUIRED, example = "TODO")
|
||||
@NotEmpty(message = "页面组件列表不能为空")
|
||||
@Valid
|
||||
|
@@ -5,26 +5,29 @@ import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jason
|
||||
*/
|
||||
@Schema(description = "管理后台 - 页面装修 Resp VO")
|
||||
@Data
|
||||
public class DecorateComponentRespVO {
|
||||
|
||||
@Schema(description = "页面类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "页面组件", requiredMode = Schema.RequiredMode.REQUIRED, example = "TODO")
|
||||
private List<ComponentRespVO> components;
|
||||
|
||||
@Schema(description = "管理后台 - 页面组件 Resp VO")
|
||||
@Data
|
||||
public static class ComponentRespVO {
|
||||
|
||||
@Schema(description = "组件编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "组件编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "nav-menu")
|
||||
private String componentCode;
|
||||
|
||||
@Schema(description = "组件的内容配置项", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "TODO")
|
||||
private String componentValue;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -31,8 +31,9 @@ public class AppDecorateController {
|
||||
@GetMapping("/get-page-components")
|
||||
@Operation(summary = "获取装修页面组件")
|
||||
@Parameter(name = "type", description = "页面类型", required = true)
|
||||
public CommonResult<AppDecorateComponentRespVO> getPageComponents(@RequestParam("type")
|
||||
@InEnum(DecoratePageTypeEnum.class) Integer type) {
|
||||
public CommonResult<AppDecorateComponentRespVO> getPageComponents(
|
||||
@RequestParam("type") @InEnum(DecoratePageTypeEnum.class) Integer type) {
|
||||
return success(INSTANCE.appConvert(type, decorateComponentService.getPageComponents(type)));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,26 +5,29 @@ import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jason
|
||||
*/
|
||||
@Schema(description = "用户 App - 页面装修 Resp VO")
|
||||
@Data
|
||||
public class AppDecorateComponentRespVO {
|
||||
|
||||
@Schema(description = "页面类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "页面组件", requiredMode = Schema.RequiredMode.REQUIRED, example = "TODO")
|
||||
private List<AppComponentRespVO> components;
|
||||
|
||||
@Schema(description = "用户 App - 页面组件 Resp VO")
|
||||
@Data
|
||||
public static class AppComponentRespVO {
|
||||
|
||||
@Schema(description = "组件编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "组件编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "nav-menu")
|
||||
private String componentCode;
|
||||
|
||||
@Schema(description = "组件的内容配置项", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "TODO")
|
||||
private String componentValue;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -22,8 +22,8 @@ public interface DecorateComponentConvert {
|
||||
return CollectionUtils.convertList(components, c -> convert(type, c));
|
||||
}
|
||||
|
||||
default DecorateComponentRespVO convert2(Integer type, List<DecorateComponentDO> doList) {
|
||||
List<ComponentRespVO> components = CollectionUtils.convertList(doList, this::convert3);
|
||||
default DecorateComponentRespVO convert2(Integer type, List<DecorateComponentDO> list) {
|
||||
List<ComponentRespVO> components = CollectionUtils.convertList(list, this::convert3);
|
||||
return new DecorateComponentRespVO().setType(type).setComponents(components);
|
||||
}
|
||||
|
||||
@@ -32,10 +32,11 @@ public interface DecorateComponentConvert {
|
||||
ComponentRespVO convert3(DecorateComponentDO componentDO);
|
||||
|
||||
// ========== App convert ==========
|
||||
default AppDecorateComponentRespVO appConvert(Integer type, List<DecorateComponentDO> doList) {
|
||||
List<AppComponentRespVO> components = CollectionUtils.convertList(doList, this::appConvert2);
|
||||
default AppDecorateComponentRespVO appConvert(Integer type, List<DecorateComponentDO> list) {
|
||||
List<AppComponentRespVO> components = CollectionUtils.convertList(list, this::appConvert2);
|
||||
return new AppDecorateComponentRespVO().setType(type).setComponents(components);
|
||||
}
|
||||
|
||||
AppComponentRespVO appConvert2(DecorateComponentDO componentDO);
|
||||
AppComponentRespVO appConvert2(DecorateComponentDO bean);
|
||||
|
||||
}
|
||||
|
@@ -17,24 +17,26 @@ import lombok.Data;
|
||||
@KeySequence("promotion_decorate_component_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
public class DecorateComponentDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
// TODO @jason:要不改成 page?貌似更合理;
|
||||
/**
|
||||
* 页面类型
|
||||
* 枚举 {@link DecoratePageTypeEnum#getType()}
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
// TODO @jason:code、value,因为在 component
|
||||
/**
|
||||
* 组件编码
|
||||
* 枚举 {@link DecorateComponentEnum#getCode()}
|
||||
*/
|
||||
private String componentCode;
|
||||
|
||||
/**
|
||||
* 组件值:json 格式。包含配置和数据
|
||||
*/
|
||||
@@ -42,7 +44,8 @@ public class DecorateComponentDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*
|
||||
* 枚举 {@link CommonStatusEnum}
|
||||
*/
|
||||
private Integer status;
|
||||
}
|
||||
}
|
||||
|
@@ -8,9 +8,11 @@ import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface DecorateComponentMapper extends BaseMapperX<DecorateComponentDO> {
|
||||
|
||||
default List<DecorateComponentDO> selectByPageType(Integer type){
|
||||
return selectList(DecorateComponentDO::getType, type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@@ -15,13 +15,16 @@ public interface DecorateComponentService {
|
||||
|
||||
/**
|
||||
* 店铺装修页面保存
|
||||
*
|
||||
* @param reqVO 请求 VO
|
||||
*/
|
||||
void pageSave(DecorateComponentReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 根据页面类型。获取页面的组件信息
|
||||
*
|
||||
* @param type 页面类型 {@link DecoratePageTypeEnum#getType()}
|
||||
*/
|
||||
List<DecorateComponentDO> getPageComponents(Integer type);
|
||||
|
||||
}
|
||||
|
@@ -16,11 +16,13 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.
|
||||
import static cn.iocoder.yudao.module.promotion.convert.decorate.DecorateComponentConvert.INSTANCE;
|
||||
|
||||
/**
|
||||
* 装修组件 Service 接口实现
|
||||
* 装修组件 Service 实现
|
||||
*
|
||||
* @author jason
|
||||
*/
|
||||
@Service
|
||||
public class DecorateComponentServiceImpl implements DecorateComponentService {
|
||||
|
||||
@Resource
|
||||
private DecorateComponentMapper decorateComponentMapper;
|
||||
|
||||
@@ -42,4 +44,5 @@ public class DecorateComponentServiceImpl implements DecorateComponentService {
|
||||
public List<DecorateComponentDO> getPageComponents(Integer type) {
|
||||
return decorateComponentMapper.selectByPageType(type);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user