mirror of
				https://github.com/YunaiV/ruoyi-vue-pro.git
				synced 2025-10-31 10:37:41 +08:00 
			
		
		
		
	| @ -12,19 +12,7 @@ import java.util.List; | |||||||
| @Data | @Data | ||||||
| @EqualsAndHashCode(callSuper = true) | @EqualsAndHashCode(callSuper = true) | ||||||
| @ToString(callSuper = true) | @ToString(callSuper = true) | ||||||
| public class ProductSpuDetailRespVO extends ProductSpuBaseVO { | public class ProductSpuDetailRespVO extends ProductSpuRespVO { | ||||||
|  |  | ||||||
|     @Schema(description = "商品 SPU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1212") |  | ||||||
|     private Long id; |  | ||||||
|  |  | ||||||
|     @Schema(description = "商品销量", requiredMode = Schema.RequiredMode.REQUIRED, example = "10000") |  | ||||||
|     private Integer salesCount; |  | ||||||
|  |  | ||||||
|     @Schema(description = "浏览量", requiredMode = Schema.RequiredMode.REQUIRED, example = "20000") |  | ||||||
|     private Integer browseCount; |  | ||||||
|  |  | ||||||
|     @Schema(description = "商品状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |  | ||||||
|     private Integer status; |  | ||||||
|  |  | ||||||
|     // ========== SKU 相关字段 ========= |     // ========== SKU 相关字段 ========= | ||||||
|  |  | ||||||
|  | |||||||
| @ -13,7 +13,7 @@ import java.time.LocalDateTime; | |||||||
| @ToString(callSuper = true) | @ToString(callSuper = true) | ||||||
| public class ProductSpuRespVO extends ProductSpuBaseVO { | public class ProductSpuRespVO extends ProductSpuBaseVO { | ||||||
|  |  | ||||||
|     @Schema(description = "spuId", requiredMode = Schema.RequiredMode.REQUIRED, example = "111") |     @Schema(description = "商品 SPU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "111") | ||||||
|     private Long id; |     private Long id; | ||||||
|  |  | ||||||
|     @Schema(description = "商品价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "1999") |     @Schema(description = "商品价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "1999") | ||||||
|  | |||||||
| @ -30,6 +30,7 @@ import javax.annotation.Resource; | |||||||
| import javax.validation.Valid; | import javax.validation.Valid; | ||||||
| import java.util.Collections; | import java.util.Collections; | ||||||
| import java.util.List; | import java.util.List; | ||||||
|  | import java.util.Set; | ||||||
|  |  | ||||||
| import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | ||||||
| import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||||||
| @ -75,6 +76,25 @@ public class AppProductSpuController { | |||||||
|         return success(voList); |         return success(voList); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     @GetMapping("/list-by-ids") | ||||||
|  |     @Operation(summary = "获得商品 SPU 列表") | ||||||
|  |     @Parameters({ | ||||||
|  |             @Parameter(name = "ids", description = "编号列表", required = true) | ||||||
|  |     }) | ||||||
|  |     public CommonResult<List<AppProductSpuPageRespVO>> getSpuList(@RequestParam("ids") Set<Long> ids) { | ||||||
|  |         List<ProductSpuDO> list = productSpuService.getSpuList(ids); | ||||||
|  |         if (CollUtil.isEmpty(list)) { | ||||||
|  |             return success(Collections.emptyList()); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         // 拼接返回 | ||||||
|  |         List<AppProductSpuPageRespVO> voList = ProductSpuConvert.INSTANCE.convertListForGetSpuList(list); | ||||||
|  |         // 处理 vip 价格 | ||||||
|  |         MemberLevelRespDTO memberLevel = getMemberLevel(); | ||||||
|  |         voList.forEach(vo -> vo.setVipPrice(calculateVipPrice(vo.getPrice(), memberLevel))); | ||||||
|  |         return success(voList); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     @GetMapping("/page") |     @GetMapping("/page") | ||||||
|     @Operation(summary = "获得商品 SPU 分页") |     @Operation(summary = "获得商品 SPU 分页") | ||||||
|     public CommonResult<PageResult<AppProductSpuPageRespVO>> getSpuPage(@Valid AppProductSpuPageReqVO pageVO) { |     public CommonResult<PageResult<AppProductSpuPageRespVO>> getSpuPage(@Valid AppProductSpuPageReqVO pageVO) { | ||||||
|  | |||||||
| @ -15,6 +15,9 @@ public class AppProductSpuPageRespVO { | |||||||
|     @Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") |     @Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") | ||||||
|     private String name; |     private String name; | ||||||
|  |  | ||||||
|  |     @Schema(description = "商品简介", requiredMode = Schema.RequiredMode.REQUIRED, example = "清凉小短袖简介") | ||||||
|  |     private String introduction; | ||||||
|  |  | ||||||
|     @Schema(description = "分类编号", requiredMode = Schema.RequiredMode.REQUIRED) |     @Schema(description = "分类编号", requiredMode = Schema.RequiredMode.REQUIRED) | ||||||
|     private Long categoryId; |     private Long categoryId; | ||||||
|  |  | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 芋道源码
					芋道源码