Commit b58220600361168c9696e8459e0d54220ba91293
1 parent
ad1f656d
mall + promotion:review 页面装修
Showing
17 changed files
with
57 additions
and
61 deletions
yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/mapper/BaseMapperX.java
| ... | ... | @@ -132,9 +132,10 @@ public interface BaseMapperX<T> extends MPJBaseMapper<T> { |
| 132 | 132 | |
| 133 | 133 | /** |
| 134 | 134 | * 批量修改插入, 会根据实体的主键是否为空,更新还是修改。默认为 1000 |
| 135 | + * | |
| 135 | 136 | * @param entities 实体们 |
| 136 | 137 | */ |
| 137 | - default void saveOrUpdateBatch(Collection<T> entities){ | |
| 138 | + default void saveOrUpdateBatch(Collection<T> entities){ | |
| 138 | 139 | Db.saveOrUpdateBatch(entities); |
| 139 | 140 | } |
| 140 | 141 | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/vo/AppProductSpuPageItemRespVO.java deleted
| 1 | -package cn.iocoder.yudao.module.product.controller.app.spu.vo; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.Data; | |
| 5 | - | |
| 6 | -import javax.validation.constraints.NotEmpty; | |
| 7 | -import javax.validation.constraints.NotNull; | |
| 8 | -import java.util.List; | |
| 9 | - | |
| 10 | -@Schema(description = "用户 App - 商品 SPU 分页项 Response VO") | |
| 11 | -@Data | |
| 12 | -public class AppProductSpuPageItemRespVO { | |
| 13 | - | |
| 14 | - @Schema(description = "商品 SPU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 15 | - private Long id; | |
| 16 | - | |
| 17 | - @Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") | |
| 18 | - @NotEmpty(message = "商品名称不能为空") | |
| 19 | - private String name; | |
| 20 | - | |
| 21 | - @Schema(description = "分类编号", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 22 | - @NotNull(message = "分类编号不能为空") | |
| 23 | - private Long categoryId; | |
| 24 | - | |
| 25 | - @Schema(description = "商品图片的数组", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 26 | - private List<String> picUrls; | |
| 27 | - | |
| 28 | - @Schema(description = " 最小价格,单位使用:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 29 | - private Integer minPrice; | |
| 30 | - | |
| 31 | - @Schema(description = "最大价格,单位使用:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 32 | - private Integer maxPrice; | |
| 33 | - | |
| 34 | - // ========== 统计相关字段 ========= | |
| 35 | - | |
| 36 | - @Schema(description = "商品销量", example = "1024") | |
| 37 | - private Integer salesCount; | |
| 38 | - | |
| 39 | -} |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/vo/AppProductSpuPageReqVO.java
| ... | ... | @@ -20,6 +20,9 @@ public class AppProductSpuPageReqVO extends PageParam { |
| 20 | 20 | public static final String SORT_FIELD_SALES_COUNT = "salesCount"; |
| 21 | 21 | |
| 22 | 22 | public static final String RECOMMEND_TYPE_HOT = "hot"; |
| 23 | + public static final String RECOMMEND_TYPE_BENEFIT = "benefit"; | |
| 24 | + public static final String RECOMMEND_TYPE_BEST = "best"; | |
| 25 | + public static final String RECOMMEND_TYPE_NEW = "new"; | |
| 23 | 26 | public static final String RECOMMEND_TYPE_GOOD = "good"; |
| 24 | 27 | |
| 25 | 28 | @Schema(description = "分类编号", example = "1") | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/vo/AppProductSpuPageRespVO.java
| ... | ... | @@ -32,6 +32,9 @@ public class AppProductSpuPageRespVO { |
| 32 | 32 | @Schema(description = "商品价格,单位使用:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| 33 | 33 | private Integer price; |
| 34 | 34 | |
| 35 | + @Schema(description = "市场价,单位使用:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 36 | + private Integer marketPrice; | |
| 37 | + | |
| 35 | 38 | @Schema(description = "库存", requiredMode = Schema.RequiredMode.REQUIRED, example = "666") |
| 36 | 39 | private Integer stock; |
| 37 | 40 | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/ProductSpuMapper.java
| ... | ... | @@ -67,6 +67,12 @@ public interface ProductSpuMapper extends BaseMapperX<ProductSpuDO> { |
| 67 | 67 | // 推荐类型的过滤条件 |
| 68 | 68 | if (ObjUtil.equal(pageReqVO.getRecommendType(), AppProductSpuPageReqVO.RECOMMEND_TYPE_HOT)) { |
| 69 | 69 | query.eq(ProductSpuDO::getRecommendHot, true); |
| 70 | + } else if (ObjUtil.equal(pageReqVO.getRecommendType(), AppProductSpuPageReqVO.RECOMMEND_TYPE_BENEFIT)) { | |
| 71 | + query.eq(ProductSpuDO::getRecommendBenefit, true); | |
| 72 | + } else if (ObjUtil.equal(pageReqVO.getRecommendType(), AppProductSpuPageReqVO.RECOMMEND_TYPE_BEST)) { | |
| 73 | + query.eq(ProductSpuDO::getRecommendBest, true); | |
| 74 | + } else if (ObjUtil.equal(pageReqVO.getRecommendType(), AppProductSpuPageReqVO.RECOMMEND_TYPE_NEW)) { | |
| 75 | + query.eq(ProductSpuDO::getRecommendNew, true); | |
| 70 | 76 | } else if (ObjUtil.equal(pageReqVO.getRecommendType(), AppProductSpuPageReqVO.RECOMMEND_TYPE_GOOD)) { |
| 71 | 77 | query.eq(ProductSpuDO::getRecommendGood, true); |
| 72 | 78 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/decorate/DecorateComponentEnum.java
| ... | ... | @@ -9,6 +9,7 @@ import lombok.Getter; |
| 9 | 9 | */ |
| 10 | 10 | @Getter |
| 11 | 11 | public enum DecorateComponentEnum { |
| 12 | + | |
| 12 | 13 | NAV_MENU("nav-menu", "导航菜单"), |
| 13 | 14 | ROLLING_BANNER("rolling-banner", "滚动横幅广告"), |
| 14 | 15 | PRODUCT_CATEGORY("product-category", "商品分类"); |
| ... | ... | @@ -27,4 +28,5 @@ public enum DecorateComponentEnum { |
| 27 | 28 | this.code = code; |
| 28 | 29 | this.desc = desc; |
| 29 | 30 | } |
| 31 | + | |
| 30 | 32 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/decorate/DecoratePageTypeEnum.java
| ... | ... | @@ -14,6 +14,7 @@ import java.util.Arrays; |
| 14 | 14 | @AllArgsConstructor |
| 15 | 15 | @Getter |
| 16 | 16 | public enum DecoratePageTypeEnum implements IntArrayValuable { |
| 17 | + | |
| 17 | 18 | INDEX(1, "首页"); |
| 18 | 19 | |
| 19 | 20 | private static final int[] ARRAYS = Arrays.stream(values()).mapToInt(DecoratePageTypeEnum::getType).toArray(); |
| ... | ... | @@ -31,4 +32,5 @@ public enum DecoratePageTypeEnum implements IntArrayValuable { |
| 31 | 32 | public int[] array() { |
| 32 | 33 | return ARRAYS; |
| 33 | 34 | } |
| 35 | + | |
| 34 | 36 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/decorate/DecorateComponentController.java
| ... | ... | @@ -38,8 +38,9 @@ public class DecorateComponentController { |
| 38 | 38 | @Operation(summary = "获取装修页面组件") |
| 39 | 39 | @Parameter(name = "type", description = "页面类型", required = true) |
| 40 | 40 | // TODO 加权限 |
| 41 | - public CommonResult<DecorateComponentRespVO> getPageComponents(@RequestParam("type") | |
| 42 | - @InEnum(DecoratePageTypeEnum.class) Integer type) { | |
| 41 | + public CommonResult<DecorateComponentRespVO> getPageComponents( | |
| 42 | + @RequestParam("type") @InEnum(DecoratePageTypeEnum.class) Integer type) { | |
| 43 | 43 | return success(INSTANCE.convert2(type, decorateComponentService.getPageComponents(type))); |
| 44 | 44 | } |
| 45 | + | |
| 45 | 46 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/decorate/vo/DecorateComponentReqVO.java
| ... | ... | @@ -10,9 +10,6 @@ import javax.validation.constraints.NotEmpty; |
| 10 | 10 | import javax.validation.constraints.NotNull; |
| 11 | 11 | import java.util.List; |
| 12 | 12 | |
| 13 | -/** | |
| 14 | - * @author jason | |
| 15 | - */ | |
| 16 | 13 | @Schema(description = "管理后台 - 页面装修 Request VO ") |
| 17 | 14 | @Data |
| 18 | 15 | public class DecorateComponentReqVO { |
| ... | ... | @@ -20,6 +17,7 @@ public class DecorateComponentReqVO { |
| 20 | 17 | @NotNull(message = "页面类型不能为空") |
| 21 | 18 | @InEnum(DecoratePageTypeEnum.class) |
| 22 | 19 | private Integer type; |
| 20 | + | |
| 23 | 21 | @Schema(description = "页面组件列表", requiredMode = Schema.RequiredMode.REQUIRED, example = "TODO") |
| 24 | 22 | @NotEmpty(message = "页面组件列表不能为空") |
| 25 | 23 | @Valid | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/decorate/vo/DecorateComponentRespVO.java
| ... | ... | @@ -5,26 +5,29 @@ import lombok.Data; |
| 5 | 5 | |
| 6 | 6 | import java.util.List; |
| 7 | 7 | |
| 8 | -/** | |
| 9 | - * @author jason | |
| 10 | - */ | |
| 11 | 8 | @Schema(description = "管理后台 - 页面装修 Resp VO") |
| 12 | 9 | @Data |
| 13 | 10 | public class DecorateComponentRespVO { |
| 11 | + | |
| 14 | 12 | @Schema(description = "页面类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 15 | 13 | private Integer type; |
| 14 | + | |
| 16 | 15 | @Schema(description = "页面组件", requiredMode = Schema.RequiredMode.REQUIRED, example = "TODO") |
| 17 | 16 | private List<ComponentRespVO> components; |
| 18 | 17 | |
| 19 | 18 | @Schema(description = "管理后台 - 页面组件 Resp VO") |
| 20 | 19 | @Data |
| 21 | 20 | public static class ComponentRespVO { |
| 21 | + | |
| 22 | 22 | @Schema(description = "组件编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 23 | 23 | private Long id; |
| 24 | + | |
| 24 | 25 | @Schema(description = "组件编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "nav-menu") |
| 25 | 26 | private String componentCode; |
| 27 | + | |
| 26 | 28 | @Schema(description = "组件的内容配置项", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "TODO") |
| 27 | 29 | private String componentValue; |
| 30 | + | |
| 28 | 31 | } |
| 29 | 32 | |
| 30 | 33 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/decorate/AppDecorateController.java
| ... | ... | @@ -31,8 +31,9 @@ public class AppDecorateController { |
| 31 | 31 | @GetMapping("/get-page-components") |
| 32 | 32 | @Operation(summary = "获取装修页面组件") |
| 33 | 33 | @Parameter(name = "type", description = "页面类型", required = true) |
| 34 | - public CommonResult<AppDecorateComponentRespVO> getPageComponents(@RequestParam("type") | |
| 35 | - @InEnum(DecoratePageTypeEnum.class) Integer type) { | |
| 34 | + public CommonResult<AppDecorateComponentRespVO> getPageComponents( | |
| 35 | + @RequestParam("type") @InEnum(DecoratePageTypeEnum.class) Integer type) { | |
| 36 | 36 | return success(INSTANCE.appConvert(type, decorateComponentService.getPageComponents(type))); |
| 37 | 37 | } |
| 38 | + | |
| 38 | 39 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/decorate/vo/AppDecorateComponentRespVO.java
| ... | ... | @@ -5,26 +5,29 @@ import lombok.Data; |
| 5 | 5 | |
| 6 | 6 | import java.util.List; |
| 7 | 7 | |
| 8 | -/** | |
| 9 | - * @author jason | |
| 10 | - */ | |
| 11 | 8 | @Schema(description = "用户 App - 页面装修 Resp VO") |
| 12 | 9 | @Data |
| 13 | 10 | public class AppDecorateComponentRespVO { |
| 11 | + | |
| 14 | 12 | @Schema(description = "页面类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 15 | 13 | private Integer type; |
| 14 | + | |
| 16 | 15 | @Schema(description = "页面组件", requiredMode = Schema.RequiredMode.REQUIRED, example = "TODO") |
| 17 | 16 | private List<AppComponentRespVO> components; |
| 18 | 17 | |
| 19 | 18 | @Schema(description = "用户 App - 页面组件 Resp VO") |
| 20 | 19 | @Data |
| 21 | 20 | public static class AppComponentRespVO { |
| 21 | + | |
| 22 | 22 | @Schema(description = "组件编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 23 | 23 | private Long id; |
| 24 | + | |
| 24 | 25 | @Schema(description = "组件编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "nav-menu") |
| 25 | 26 | private String componentCode; |
| 27 | + | |
| 26 | 28 | @Schema(description = "组件的内容配置项", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "TODO") |
| 27 | 29 | private String componentValue; |
| 30 | + | |
| 28 | 31 | } |
| 29 | 32 | |
| 30 | 33 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/decorate/DecorateComponentConvert.java
| ... | ... | @@ -22,8 +22,8 @@ public interface DecorateComponentConvert { |
| 22 | 22 | return CollectionUtils.convertList(components, c -> convert(type, c)); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - default DecorateComponentRespVO convert2(Integer type, List<DecorateComponentDO> doList) { | |
| 26 | - List<ComponentRespVO> components = CollectionUtils.convertList(doList, this::convert3); | |
| 25 | + default DecorateComponentRespVO convert2(Integer type, List<DecorateComponentDO> list) { | |
| 26 | + List<ComponentRespVO> components = CollectionUtils.convertList(list, this::convert3); | |
| 27 | 27 | return new DecorateComponentRespVO().setType(type).setComponents(components); |
| 28 | 28 | } |
| 29 | 29 | |
| ... | ... | @@ -32,10 +32,11 @@ public interface DecorateComponentConvert { |
| 32 | 32 | ComponentRespVO convert3(DecorateComponentDO componentDO); |
| 33 | 33 | |
| 34 | 34 | // ========== App convert ========== |
| 35 | - default AppDecorateComponentRespVO appConvert(Integer type, List<DecorateComponentDO> doList) { | |
| 36 | - List<AppComponentRespVO> components = CollectionUtils.convertList(doList, this::appConvert2); | |
| 35 | + default AppDecorateComponentRespVO appConvert(Integer type, List<DecorateComponentDO> list) { | |
| 36 | + List<AppComponentRespVO> components = CollectionUtils.convertList(list, this::appConvert2); | |
| 37 | 37 | return new AppDecorateComponentRespVO().setType(type).setComponents(components); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - AppComponentRespVO appConvert2(DecorateComponentDO componentDO); | |
| 40 | + AppComponentRespVO appConvert2(DecorateComponentDO bean); | |
| 41 | + | |
| 41 | 42 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/decorate/DecorateComponentDO.java
| ... | ... | @@ -17,24 +17,26 @@ import lombok.Data; |
| 17 | 17 | @KeySequence("promotion_decorate_component_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 |
| 18 | 18 | @Data |
| 19 | 19 | public class DecorateComponentDO extends BaseDO { |
| 20 | + | |
| 20 | 21 | /** |
| 21 | 22 | * 编号 |
| 22 | 23 | */ |
| 23 | 24 | @TableId |
| 24 | 25 | private Long id; |
| 25 | 26 | |
| 27 | + // TODO @jason:要不改成 page?貌似更合理; | |
| 26 | 28 | /** |
| 27 | 29 | * 页面类型 |
| 28 | 30 | * 枚举 {@link DecoratePageTypeEnum#getType()} |
| 29 | 31 | */ |
| 30 | 32 | private Integer type; |
| 31 | 33 | |
| 34 | + // TODO @jason:code、value,因为在 component | |
| 32 | 35 | /** |
| 33 | 36 | * 组件编码 |
| 34 | 37 | * 枚举 {@link DecorateComponentEnum#getCode()} |
| 35 | 38 | */ |
| 36 | 39 | private String componentCode; |
| 37 | - | |
| 38 | 40 | /** |
| 39 | 41 | * 组件值:json 格式。包含配置和数据 |
| 40 | 42 | */ |
| ... | ... | @@ -42,7 +44,8 @@ public class DecorateComponentDO extends BaseDO { |
| 42 | 44 | |
| 43 | 45 | /** |
| 44 | 46 | * 状态 |
| 47 | + * | |
| 45 | 48 | * 枚举 {@link CommonStatusEnum} |
| 46 | 49 | */ |
| 47 | 50 | private Integer status; |
| 48 | -} | |
| 49 | 51 | \ No newline at end of file |
| 52 | +} | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/decorate/DecorateComponentMapper.java
| ... | ... | @@ -8,9 +8,11 @@ import java.util.List; |
| 8 | 8 | |
| 9 | 9 | @Mapper |
| 10 | 10 | public interface DecorateComponentMapper extends BaseMapperX<DecorateComponentDO> { |
| 11 | + | |
| 11 | 12 | default List<DecorateComponentDO> selectByPageType(Integer type){ |
| 12 | 13 | return selectList(DecorateComponentDO::getType, type); |
| 13 | 14 | } |
| 15 | + | |
| 14 | 16 | } |
| 15 | 17 | |
| 16 | 18 | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/decorate/DecorateComponentService.java
| ... | ... | @@ -15,13 +15,16 @@ public interface DecorateComponentService { |
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * 店铺装修页面保存 |
| 18 | + * | |
| 18 | 19 | * @param reqVO 请求 VO |
| 19 | 20 | */ |
| 20 | 21 | void pageSave(DecorateComponentReqVO reqVO); |
| 21 | 22 | |
| 22 | 23 | /** |
| 23 | 24 | * 根据页面类型。获取页面的组件信息 |
| 25 | + * | |
| 24 | 26 | * @param type 页面类型 {@link DecoratePageTypeEnum#getType()} |
| 25 | 27 | */ |
| 26 | 28 | List<DecorateComponentDO> getPageComponents(Integer type); |
| 29 | + | |
| 27 | 30 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/decorate/DecorateComponentServiceImpl.java
| ... | ... | @@ -16,11 +16,13 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils. |
| 16 | 16 | import static cn.iocoder.yudao.module.promotion.convert.decorate.DecorateComponentConvert.INSTANCE; |
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | - * 装修组件 Service 接口实现 | |
| 19 | + * 装修组件 Service 实现 | |
| 20 | + * | |
| 20 | 21 | * @author jason |
| 21 | 22 | */ |
| 22 | 23 | @Service |
| 23 | 24 | public class DecorateComponentServiceImpl implements DecorateComponentService { |
| 25 | + | |
| 24 | 26 | @Resource |
| 25 | 27 | private DecorateComponentMapper decorateComponentMapper; |
| 26 | 28 | |
| ... | ... | @@ -42,4 +44,5 @@ public class DecorateComponentServiceImpl implements DecorateComponentService { |
| 42 | 44 | public List<DecorateComponentDO> getPageComponents(Integer type) { |
| 43 | 45 | return decorateComponentMapper.selectByPageType(type); |
| 44 | 46 | } |
| 47 | + | |
| 45 | 48 | } | ... | ... |