mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 15:21:53 +08:00
commit
a440b354ba
@ -12,19 +12,7 @@ import java.util.List;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ProductSpuDetailRespVO extends ProductSpuBaseVO {
|
||||
|
||||
@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;
|
||||
public class ProductSpuDetailRespVO extends ProductSpuRespVO {
|
||||
|
||||
// ========== SKU 相关字段 =========
|
||||
|
||||
|
@ -13,7 +13,7 @@ import java.time.LocalDateTime;
|
||||
@ToString(callSuper = true)
|
||||
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;
|
||||
|
||||
@Schema(description = "商品价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "1999")
|
||||
|
@ -30,6 +30,7 @@ import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Collections;
|
||||
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.pojo.CommonResult.success;
|
||||
@ -75,6 +76,25 @@ public class AppProductSpuController {
|
||||
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")
|
||||
@Operation(summary = "获得商品 SPU 分页")
|
||||
public CommonResult<PageResult<AppProductSpuPageRespVO>> getSpuPage(@Valid AppProductSpuPageReqVO pageVO) {
|
||||
|
@ -15,6 +15,9 @@ public class AppProductSpuPageRespVO {
|
||||
@Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "商品简介", requiredMode = Schema.RequiredMode.REQUIRED, example = "清凉小短袖简介")
|
||||
private String introduction;
|
||||
|
||||
@Schema(description = "分类编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long categoryId;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user