mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-08-16 03:01:53 +08:00
商城:完善购物车的逻辑
This commit is contained in:
@@ -15,7 +15,8 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* TODO LeeYan9: 类注释;
|
||||
* 商品 SKU API 实现类
|
||||
*
|
||||
* @author LeeYan9
|
||||
* @since 2022-09-06
|
||||
*/
|
||||
@@ -28,8 +29,8 @@ public class ProductSkuApiImpl implements ProductSkuApi {
|
||||
|
||||
@Override
|
||||
public ProductSkuRespDTO getSku(Long id) {
|
||||
// TODO TODO LeeYan9: 需要实现
|
||||
return null;
|
||||
ProductSkuDO sku = productSkuService.getSku(id);
|
||||
return ProductSkuConvert.INSTANCE.convert02(sku);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -26,6 +26,9 @@ public class AppProductSpuPageItemRespVO {
|
||||
|
||||
// ========== SKU 相关字段 =========
|
||||
|
||||
@Schema(description = "规格类型", required = true, example = "true")
|
||||
private Boolean specType;
|
||||
|
||||
@Schema(description = "商品价格,单位使用:分", required = true, example = "1024")
|
||||
private Integer price;
|
||||
|
||||
|
@@ -109,12 +109,29 @@ public class ProductSkuDO extends BaseDO {
|
||||
* 关联 {@link ProductPropertyDO#getId()}
|
||||
*/
|
||||
private Long propertyId;
|
||||
/**
|
||||
* 属性名字
|
||||
*
|
||||
* 冗余 {@link ProductPropertyDO#getName()}
|
||||
*
|
||||
* 注意:每次属性名字发生变化时,需要更新该冗余
|
||||
*/
|
||||
private String propertyName;
|
||||
|
||||
/**
|
||||
* 属性值编号
|
||||
*
|
||||
* 关联 {@link ProductPropertyValueDO#getId()}
|
||||
*/
|
||||
private Long valueId;
|
||||
/**
|
||||
* 属性值名字
|
||||
*
|
||||
* 冗余 {@link ProductPropertyValueDO#getName()}
|
||||
*
|
||||
* 注意:每次属性值名字发生变化时,需要更新该冗余
|
||||
*/
|
||||
private String valueName;
|
||||
|
||||
}
|
||||
|
||||
@@ -139,9 +156,5 @@ public class ProductSkuDO extends BaseDO {
|
||||
// TODO 芋艿:pinkStock from y
|
||||
// TODO 芋艿:seckillStock from y
|
||||
|
||||
// TODO 芋艿:quota from c
|
||||
// TODO 芋艿:quotaShow from c
|
||||
// TODO 芋艿:attrValue from c
|
||||
|
||||
}
|
||||
|
||||
|
@@ -67,6 +67,7 @@ public class ProductPropertyServiceImpl implements ProductPropertyService {
|
||||
// 更新
|
||||
ProductPropertyDO updateObj = ProductPropertyConvert.INSTANCE.convert(updateReqVO);
|
||||
productPropertyMapper.updateById(updateObj);
|
||||
// TODO 芋艿:更新时,需要看看 sku 表
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -68,6 +68,7 @@ public class ProductPropertyValueServiceImpl implements ProductPropertyValueServ
|
||||
// 更新
|
||||
ProductPropertyValueDO updateObj = ProductPropertyValueConvert.INSTANCE.convert(updateReqVO);
|
||||
productPropertyValueMapper.updateById(updateObj);
|
||||
// TODO 芋艿:更新时,需要看看 sku 表
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -54,12 +54,14 @@ public class ProductSkuServiceTest extends BaseDbUnitTest {
|
||||
// mock 数据
|
||||
ProductSkuDO sku01 = randomPojo(ProductSkuDO.class, o -> { // 测试更新
|
||||
o.setSpuId(1L);
|
||||
o.setProperties(singletonList(new ProductSkuDO.Property(10L, 20L)));
|
||||
o.setProperties(singletonList(new ProductSkuDO.Property(
|
||||
10L, "颜色", 20L, "红色")));
|
||||
});
|
||||
productSkuMapper.insert(sku01);
|
||||
ProductSkuDO sku02 = randomPojo(ProductSkuDO.class, o -> { // 测试删除
|
||||
o.setSpuId(1L);
|
||||
o.setProperties(singletonList(new ProductSkuDO.Property(10L, 30L)));
|
||||
o.setProperties(singletonList(new ProductSkuDO.Property(
|
||||
10L, "颜色", 30L, "蓝色")));
|
||||
});
|
||||
productSkuMapper.insert(sku02);
|
||||
// 准备参数
|
||||
|
Reference in New Issue
Block a user