需要保存spu基本信息
SpuInfoServiceImpl接口新增如下方法:
/**
* 保存基础的商品信息
*
* @param infoEntity
*/
private void saveBaseSpuInfo(SpuInfoEntity infoEntity) {
this.baseMapper.insert(infoEntity);
}
需要保存Spu的描述图片
SpuInfoDescService接口新增如下方法:
/**
* 保存spu信息描述
*
* @param descEntity
*/
void saveSpuInfoDesc(SpuInfoDescEntity descEntity);
SpuInfoDescServiceImpl类新增该方法的实现,如下:
@Override
public void saveSpuInfoDesc(SpuInfoDescEntity descEntity) {
this.baseMapper.insert(descEntity);
}
需要保存spu的图片集
SpuImagesService接口新增如下方法:
/**
* 保存spu图片
*
* @param id
* @param images
*/
void saveImages(Long id, List<String> images);
SpuImagesServiceImpl类新增方法的实现,如下:
@Override
public void saveImages(Long id, List<String> images) {
if (CollectionUtils.isEmpty(images)) {
List<SpuImagesEntity> collect = images.stream().map(img -> {
SpuImagesEntity spuImagesEntity = new SpuImagesEntity();
spuImagesEntity.setSpuId(id);
spuImagesEntity.setImgUrl(img);
return spuImagesEntity;
}).collect(Collectors.toList());
this.saveBatch(collect);
}
需要保存spu的规格参数
ProductAttrValueService接口新增如下方法:
/**
* 保存商品属性值
*
* @param productAttrValueEntities
*/
void saveProductAttr(List<ProductAttrValueEntity> productAttrValueEntities);
ProductAttrValueServiceImpl类新增方法的实现,如下:
扫描二维码关注公众号,回复:
11457430 查看本文章
@Override
public void saveProductAttr(List<ProductAttrValueEntity> productAttrValueEntities) {
this.saveBatch(productAttrValueEntities);
}
需要保存当前spu对应的sku基本信息
SkuInfoService接口新增如下方法:
/**
* 保存sku的基本信息
*
* @param skuInfoEntity
*/
void saveSkuInfo(SkuInfoEntity skuInfoEntity);
SkuInfoServiceImpl类增加方法的实现,如下:
@Override
public void saveSkuInfo(SkuInfoEntity skuInfoEntity) {
this.baseMapper.insert(skuInfoEntity);
}