use of com.xatu.gmall.entity.PmsProductSaleAttrValue in project GMall by 18391713434.
the class SpuServiceImpl method spuSaleAttrList.
public List<PmsProductSaleAttr> spuSaleAttrList(String spuId) {
List<PmsProductSaleAttr> pmsProductSaleAttrList = saleAttrMapper.selectList(new QueryWrapper<PmsProductSaleAttr>().eq("product_id", spuId));
for (PmsProductSaleAttr pmsProductSaleAttr : pmsProductSaleAttrList) {
List<PmsProductSaleAttrValue> pmsProductSaleAttrValueList = saleAttrValueMapper.selectList(new QueryWrapper<PmsProductSaleAttrValue>().eq("product_id", spuId).eq("sale_attr_id", pmsProductSaleAttr.getSaleAttrId()));
pmsProductSaleAttr.setSpuSaleAttrValueList(pmsProductSaleAttrValueList);
}
return pmsProductSaleAttrList;
}
use of com.xatu.gmall.entity.PmsProductSaleAttrValue 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