use of com.xatu.gmall.entity.PmsProductImage in project GMall by 18391713434.
the class SpuServiceImpl method saveSpuInfo.
public void saveSpuInfo(PmsProductInfo pmsProductInfo) {
spuMapper.insert(pmsProductInfo);
Long id = pmsProductInfo.getId();
List<PmsProductSaleAttr> spuSaleAttrList = pmsProductInfo.getSpuSaleAttrList();
for (PmsProductSaleAttr pmsProductSaleAttr : spuSaleAttrList) {
// 添加SPU单元的销售属性
pmsProductSaleAttr.setProductId(id);
saleAttrMapper.insert(pmsProductSaleAttr);
// 添加SPU单元的销售属性值
List<PmsProductSaleAttrValue> spuSaleAttrValueList = pmsProductSaleAttr.getSpuSaleAttrValueList();
for (PmsProductSaleAttrValue pmsProductSaleAttrValue : spuSaleAttrValueList) {
pmsProductSaleAttrValue.setProductId(id);
saleAttrValueMapper.insert(pmsProductSaleAttrValue);
}
}
// 添加SPU单元的图片集合
List<PmsProductImage> spuImageList = pmsProductInfo.getSpuImageList();
for (PmsProductImage pmsProductImage : spuImageList) {
pmsProductImage.setProductId(pmsProductInfo.getId());
imageMapper.insert(pmsProductImage);
}
}
Aggregations