商品模块代码提交
This commit is contained in:
@@ -116,8 +116,6 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
entity.setGroupSnap(JSON.toJSONString(dto.getProGroupVo()));
|
||||
}
|
||||
}
|
||||
|
||||
entity.setSpecInfo(JSON.toJSONString(dto.getSkuList()));
|
||||
entity.setIsDel(DeleteEnum.NORMAL.value());
|
||||
entity.setShopId(shopId);
|
||||
super.save(entity);
|
||||
@@ -148,7 +146,32 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
throw new CzgException("商品已存在");
|
||||
}
|
||||
Product entity = BeanUtil.copyProperties(dto, Product.class);
|
||||
return super.updateById(entity);
|
||||
//套餐
|
||||
if (ProductTypeEnum.PACKAGE.value().equals(dto.getType())) {
|
||||
//套餐内容
|
||||
if (CollUtil.isNotEmpty(dto.getProGroupVo())) {
|
||||
entity.setGroupSnap(JSON.toJSONString(dto.getProGroupVo()));
|
||||
}
|
||||
}
|
||||
entity.setIsDel(DeleteEnum.NORMAL.value());
|
||||
entity.setShopId(shopId);
|
||||
super.save(entity);
|
||||
List<ProdSkuDTO> skuList = dto.getSkuList();
|
||||
if (CollUtil.isNotEmpty(skuList)) {
|
||||
List<ProdSku> prodSkuList = new ArrayList<>();
|
||||
for (ProdSkuDTO prodSkuDTO : skuList) {
|
||||
ProdSku prodSku = BeanUtil.copyProperties(prodSkuDTO, ProdSku.class);
|
||||
prodSku.setShopId(entity.getShopId());
|
||||
prodSku.setProductId(entity.getId());
|
||||
prodSku.setRealSalesNumber(BigDecimal.ZERO);
|
||||
prodSku.setIsPauseSale(YesNoEnum.NO.value());
|
||||
prodSku.setIsGrounding(YesNoEnum.YES.value());
|
||||
prodSku.setIsDel(DeleteEnum.NORMAL.value());
|
||||
prodSkuList.add(prodSku);
|
||||
}
|
||||
prodSkuMapper.insertBatch(prodSkuList);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user