fix(PmsSpuServiceImpl.java): 删除商品属性问题修复

This commit is contained in:
郝先瑞 2022-05-09 20:18:09 +08:00
parent 04e1ad2a84
commit 479d4121cf

View File

@ -266,22 +266,22 @@ public class PmsSpuServiceImpl extends ServiceImpl<PmsSpuMapper, PmsSpu> impleme
/** /**
* 批量删除商品SPU * 批量删除商品SPU
* *
* @param goodsIds * @param spuIds 商品ID集合列表
* @return * @return
*/ */
@Override @Override
@Transactional @Transactional
public boolean removeByGoodsIds(List<Long> goodsIds) { public boolean removeByGoodsIds(List<Long> spuIds) {
boolean result = true; boolean result = true;
for (Long goodsId : goodsIds) { for (Long spuId : spuIds) {
// sku // SKU
skuService.remove(new LambdaQueryWrapper<PmsSku>().eq(PmsSku::getSpuId, goodsId)); skuService.remove(new LambdaQueryWrapper<PmsSku>().eq(PmsSku::getSpuId, spuId));
// 规格 // 规格
spuAttributeValueService.remove(new LambdaQueryWrapper<PmsSpuAttributeValue>().eq(PmsSpuAttributeValue::getId, goodsId)); spuAttributeValueService.remove(new LambdaQueryWrapper<PmsSpuAttributeValue>().eq(PmsSpuAttributeValue::getSpuId, spuId));
// 属性 // 属性
spuAttributeValueService.remove(new LambdaQueryWrapper<PmsSpuAttributeValue>().eq(PmsSpuAttributeValue::getSpuId, goodsId)); spuAttributeValueService.remove(new LambdaQueryWrapper<PmsSpuAttributeValue>().eq(PmsSpuAttributeValue::getSpuId, spuId));
// spu // SPU
result = this.removeById(goodsId); result = this.removeById(spuId);
} }
return result; return result;
} }