商品模块代码提交
This commit is contained in:
@@ -78,7 +78,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
queryWrapper.select(PRODUCT.DEFAULT_COLUMNS)
|
||||
.select(SHOP_PROD_UNIT.NAME.as(ProductDTO::getUnitName))
|
||||
.select(SHOP_PROD_CATEGORY.NAME.as(ProductDTO::getCategoryName))
|
||||
.select(SHOP_PROD_SPEC.NAME.as(ProductDTO::getSpecName),SHOP_PROD_SPEC.FULL_NAME.as(ProductDTO::getSpecFullName))
|
||||
.select(SHOP_PROD_SPEC.NAME.as(ProductDTO::getSpecName), SHOP_PROD_SPEC.FULL_NAME.as(ProductDTO::getSpecFullName))
|
||||
.from(PRODUCT)
|
||||
.leftJoin(SHOP_PROD_UNIT).on(SHOP_PROD_UNIT.ID.eq(PRODUCT.UNIT_ID))
|
||||
.leftJoin(SHOP_PROD_CATEGORY).on(SHOP_PROD_CATEGORY.ID.eq(PRODUCT.CATEGORY_ID))
|
||||
@@ -116,13 +116,11 @@ 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);
|
||||
List<ProdSkuDTO> skuList = dto.getSkuList();
|
||||
if(CollUtil.isNotEmpty(skuList)){
|
||||
if (CollUtil.isNotEmpty(skuList)) {
|
||||
List<ProdSku> prodSkuList = new ArrayList<>();
|
||||
for (ProdSkuDTO prodSkuDTO : skuList) {
|
||||
ProdSku prodSku = BeanUtil.copyProperties(prodSkuDTO, ProdSku.class);
|
||||
@@ -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