| | |
| | | return new FebsResponse().success().message("添加成功"); |
| | | } |
| | | |
| | | // 单规格 |
| | | if (addMallGoodsDto.getIsSku() == 2) { |
| | | MallGoodsStyle style = new MallGoodsStyle(); |
| | | style.setGoodsId(mallGoods.getId()); |
| | | style.setName(mallGoods.getGoodsName()); |
| | | mallGoodsStyleMapper.insert(style); |
| | | |
| | | MallGoodsSku sku = new MallGoodsSku(); |
| | | sku.setGoodsId(mallGoods.getId()); |
| | | sku.setSkuImage(mallGoods.getThumb()); |
| | | sku.setSkuName(mallGoods.getGoodsName()); |
| | | sku.setCostPrice(mallGoods.getCostPrice()); |
| | | sku.setPresentPrice(new BigDecimal(mallGoods.getPresentPrice())); |
| | | sku.setOriginalPrice(new BigDecimal(mallGoods.getOriginalPrice())); |
| | | sku.setSkuVolume(mallGoods.getVolume()); |
| | | sku.setStock(mallGoods.getStock()); |
| | | sku.setStyleId(style.getId()); |
| | | mallGoodsSkuMapper.insert(sku); |
| | | return new FebsResponse().success().message("添加成功"); |
| | | } |
| | | |
| | | |
| | | List<AddMallGoodsSkuDto> addMallGoodsSkuDtos = addMallGoodsDto.getAddMallGoodsSkuDtos(); |
| | | Set<String> styles = new HashSet<>(); |
| | |
| | | |
| | | //新增商品 |
| | | MallGoods mallGoods = mallGoodsMapper.selectById(mallGoodsUpdateDto.getId()); |
| | | |
| | | // 若原来不为多规格或编辑后也不为多规格,则清空样式和规格 |
| | | if (mallGoods.getIsSku() == 2 || mallGoodsUpdateDto.getIsSku() == 2) { |
| | | mallGoodsSkuMapper.deleteByGoodsId(mallGoods.getId()); |
| | | mallGoodsStyleMapper.deleteByGoodsId(mallGoods.getId()); |
| | | } |
| | | |
| | | BeanUtil.copyProperties(mallGoodsUpdateDto, mallGoods); |
| | | mallGoodsMapper.updateById(mallGoods); |
| | | |
| | |
| | | return new FebsResponse().success().message("编辑成功"); |
| | | } |
| | | |
| | | // 单规格 |
| | | if (mallGoodsUpdateDto.getIsSku() == 2) { |
| | | MallGoodsStyle style = new MallGoodsStyle(); |
| | | style.setGoodsId(mallGoods.getId()); |
| | | style.setName(mallGoods.getGoodsName()); |
| | | mallGoodsStyleMapper.insert(style); |
| | | |
| | | MallGoodsSku sku = new MallGoodsSku(); |
| | | sku.setGoodsId(mallGoods.getId()); |
| | | sku.setSkuImage(mallGoods.getThumb()); |
| | | sku.setSkuName(mallGoods.getGoodsName()); |
| | | sku.setCostPrice(mallGoods.getCostPrice()); |
| | | sku.setPresentPrice(new BigDecimal(mallGoods.getPresentPrice())); |
| | | sku.setOriginalPrice(new BigDecimal(mallGoods.getOriginalPrice())); |
| | | sku.setSkuVolume(mallGoods.getVolume()); |
| | | sku.setStock(mallGoods.getStock()); |
| | | sku.setStyleId(style.getId()); |
| | | mallGoodsSkuMapper.insert(sku); |
| | | return new FebsResponse().success().message("添加成功"); |
| | | } |
| | | |
| | | |
| | | |
| | | // 删除已存在sku |
| | | List<Long> delSkuIds = mallGoodsUpdateDto.getDelSkuId(); |
| | | if (CollUtil.isNotEmpty(delSkuIds)) { |