mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-02-08 14:44:57 +08:00
mall + promotion:review 页面装修
This commit is contained in:
parent
ad1f656dfa
commit
b582206003
@ -132,6 +132,7 @@ public interface BaseMapperX<T> extends MPJBaseMapper<T> {
|
||||
|
||||
/**
|
||||
* 批量修改插入, 会根据实体的主键是否为空,更新还是修改。默认为 1000
|
||||
*
|
||||
* @param entities 实体们
|
||||
*/
|
||||
default void saveOrUpdateBatch(Collection<T> entities){
|
||||
|
@ -1,39 +0,0 @@
|
||||
package cn.iocoder.yudao.module.product.controller.app.spu.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "用户 App - 商品 SPU 分页项 Response VO")
|
||||
@Data
|
||||
public class AppProductSpuPageItemRespVO {
|
||||
|
||||
@Schema(description = "商品 SPU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
|
||||
@NotEmpty(message = "商品名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "分类编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "分类编号不能为空")
|
||||
private Long categoryId;
|
||||
|
||||
@Schema(description = "商品图片的数组", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<String> picUrls;
|
||||
|
||||
@Schema(description = " 最小价格,单位使用:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Integer minPrice;
|
||||
|
||||
@Schema(description = "最大价格,单位使用:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Integer maxPrice;
|
||||
|
||||
// ========== 统计相关字段 =========
|
||||
|
||||
@Schema(description = "商品销量", example = "1024")
|
||||
private Integer salesCount;
|
||||
|
||||
}
|
@ -20,6 +20,9 @@ public class AppProductSpuPageReqVO extends PageParam {
|
||||
public static final String SORT_FIELD_SALES_COUNT = "salesCount";
|
||||
|
||||
public static final String RECOMMEND_TYPE_HOT = "hot";
|
||||
public static final String RECOMMEND_TYPE_BENEFIT = "benefit";
|
||||
public static final String RECOMMEND_TYPE_BEST = "best";
|
||||
public static final String RECOMMEND_TYPE_NEW = "new";
|
||||
public static final String RECOMMEND_TYPE_GOOD = "good";
|
||||
|
||||
@Schema(description = "分类编号", example = "1")
|
||||
|
@ -32,6 +32,9 @@ public class AppProductSpuPageRespVO {
|
||||
@Schema(description = "商品价格,单位使用:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Integer price;
|
||||
|
||||
@Schema(description = "市场价,单位使用:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Integer marketPrice;
|
||||
|
||||
@Schema(description = "库存", requiredMode = Schema.RequiredMode.REQUIRED, example = "666")
|
||||
private Integer stock;
|
||||
|
||||
|
@ -67,6 +67,12 @@ public interface ProductSpuMapper extends BaseMapperX<ProductSpuDO> {
|
||||
// 推荐类型的过滤条件
|
||||
if (ObjUtil.equal(pageReqVO.getRecommendType(), AppProductSpuPageReqVO.RECOMMEND_TYPE_HOT)) {
|
||||
query.eq(ProductSpuDO::getRecommendHot, true);
|
||||
} else if (ObjUtil.equal(pageReqVO.getRecommendType(), AppProductSpuPageReqVO.RECOMMEND_TYPE_BENEFIT)) {
|
||||
query.eq(ProductSpuDO::getRecommendBenefit, true);
|
||||
} else if (ObjUtil.equal(pageReqVO.getRecommendType(), AppProductSpuPageReqVO.RECOMMEND_TYPE_BEST)) {
|
||||
query.eq(ProductSpuDO::getRecommendBest, true);
|
||||
} else if (ObjUtil.equal(pageReqVO.getRecommendType(), AppProductSpuPageReqVO.RECOMMEND_TYPE_NEW)) {
|
||||
query.eq(ProductSpuDO::getRecommendNew, true);
|
||||
} else if (ObjUtil.equal(pageReqVO.getRecommendType(), AppProductSpuPageReqVO.RECOMMEND_TYPE_GOOD)) {
|
||||
query.eq(ProductSpuDO::getRecommendGood, true);
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import lombok.Getter;
|
||||
*/
|
||||
@Getter
|
||||
public enum DecorateComponentEnum {
|
||||
|
||||
NAV_MENU("nav-menu", "导航菜单"),
|
||||
ROLLING_BANNER("rolling-banner", "滚动横幅广告"),
|
||||
PRODUCT_CATEGORY("product-category", "商品分类");
|
||||
@ -27,4 +28,5 @@ public enum DecorateComponentEnum {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import java.util.Arrays;
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum DecoratePageTypeEnum implements IntArrayValuable {
|
||||
|
||||
INDEX(1, "首页");
|
||||
|
||||
private static final int[] ARRAYS = Arrays.stream(values()).mapToInt(DecoratePageTypeEnum::getType).toArray();
|
||||
@ -31,4 +32,5 @@ public enum DecoratePageTypeEnum implements IntArrayValuable {
|
||||
public int[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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,6 +44,7 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user