Commit a440b354baf4c7ca96505e1a919f5579a77be95c
Committed by
Gitee
!735 商城装修
Merge pull request !735 from 疯狂的世界/feature/mall_product
Showing
4 changed files
with
25 additions
and
14 deletions
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuDetailRespVO.java
| ... | ... | @@ -12,19 +12,7 @@ import java.util.List; |
| 12 | 12 | @Data |
| 13 | 13 | @EqualsAndHashCode(callSuper = true) |
| 14 | 14 | @ToString(callSuper = true) |
| 15 | -public class ProductSpuDetailRespVO extends ProductSpuBaseVO { | |
| 16 | - | |
| 17 | - @Schema(description = "商品 SPU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1212") | |
| 18 | - private Long id; | |
| 19 | - | |
| 20 | - @Schema(description = "商品销量", requiredMode = Schema.RequiredMode.REQUIRED, example = "10000") | |
| 21 | - private Integer salesCount; | |
| 22 | - | |
| 23 | - @Schema(description = "浏览量", requiredMode = Schema.RequiredMode.REQUIRED, example = "20000") | |
| 24 | - private Integer browseCount; | |
| 25 | - | |
| 26 | - @Schema(description = "商品状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 27 | - private Integer status; | |
| 15 | +public class ProductSpuDetailRespVO extends ProductSpuRespVO { | |
| 28 | 16 | |
| 29 | 17 | // ========== SKU 相关字段 ========= |
| 30 | 18 | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuRespVO.java
| ... | ... | @@ -13,7 +13,7 @@ import java.time.LocalDateTime; |
| 13 | 13 | @ToString(callSuper = true) |
| 14 | 14 | public class ProductSpuRespVO extends ProductSpuBaseVO { |
| 15 | 15 | |
| 16 | - @Schema(description = "spuId", requiredMode = Schema.RequiredMode.REQUIRED, example = "111") | |
| 16 | + @Schema(description = "商品 SPU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "111") | |
| 17 | 17 | private Long id; |
| 18 | 18 | |
| 19 | 19 | @Schema(description = "商品价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "1999") | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/AppProductSpuController.java
| ... | ... | @@ -30,6 +30,7 @@ import javax.annotation.Resource; |
| 30 | 30 | import javax.validation.Valid; |
| 31 | 31 | import java.util.Collections; |
| 32 | 32 | import java.util.List; |
| 33 | +import java.util.Set; | |
| 33 | 34 | |
| 34 | 35 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 35 | 36 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| ... | ... | @@ -75,6 +76,25 @@ public class AppProductSpuController { |
| 75 | 76 | return success(voList); |
| 76 | 77 | } |
| 77 | 78 | |
| 79 | + @GetMapping("/list-by-ids") | |
| 80 | + @Operation(summary = "获得商品 SPU 列表") | |
| 81 | + @Parameters({ | |
| 82 | + @Parameter(name = "ids", description = "编号列表", required = true) | |
| 83 | + }) | |
| 84 | + public CommonResult<List<AppProductSpuPageRespVO>> getSpuList(@RequestParam("ids") Set<Long> ids) { | |
| 85 | + List<ProductSpuDO> list = productSpuService.getSpuList(ids); | |
| 86 | + if (CollUtil.isEmpty(list)) { | |
| 87 | + return success(Collections.emptyList()); | |
| 88 | + } | |
| 89 | + | |
| 90 | + // 拼接返回 | |
| 91 | + List<AppProductSpuPageRespVO> voList = ProductSpuConvert.INSTANCE.convertListForGetSpuList(list); | |
| 92 | + // 处理 vip 价格 | |
| 93 | + MemberLevelRespDTO memberLevel = getMemberLevel(); | |
| 94 | + voList.forEach(vo -> vo.setVipPrice(calculateVipPrice(vo.getPrice(), memberLevel))); | |
| 95 | + return success(voList); | |
| 96 | + } | |
| 97 | + | |
| 78 | 98 | @GetMapping("/page") |
| 79 | 99 | @Operation(summary = "获得商品 SPU 分页") |
| 80 | 100 | public CommonResult<PageResult<AppProductSpuPageRespVO>> getSpuPage(@Valid AppProductSpuPageReqVO pageVO) { | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/vo/AppProductSpuPageRespVO.java
| ... | ... | @@ -15,6 +15,9 @@ public class AppProductSpuPageRespVO { |
| 15 | 15 | @Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") |
| 16 | 16 | private String name; |
| 17 | 17 | |
| 18 | + @Schema(description = "商品简介", requiredMode = Schema.RequiredMode.REQUIRED, example = "清凉小短袖简介") | |
| 19 | + private String introduction; | |
| 20 | + | |
| 18 | 21 | @Schema(description = "分类编号", requiredMode = Schema.RequiredMode.REQUIRED) |
| 19 | 22 | private Long categoryId; |
| 20 | 23 | ... | ... |