|
|
@ -95,9 +95,15 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
|
save(goods);
|
|
|
|
save(goods);
|
|
|
|
goods.setGoodsSn(goods.getId().toString());
|
|
|
|
goods.setGoodsSn(goods.getId().toString());
|
|
|
|
updateById(goods);
|
|
|
|
updateById(goods);
|
|
|
|
|
|
|
|
List<Boolean> defaultSelectList = new ArrayList<>();
|
|
|
|
for (GoodsSpecification specification : specifications) {
|
|
|
|
for (GoodsSpecification specification : specifications) {
|
|
|
|
specification.setGoodsId(goods.getId());
|
|
|
|
specification.setGoodsId(goods.getId());
|
|
|
|
specification.setCreateTime(new Date());
|
|
|
|
specification.setCreateTime(new Date());
|
|
|
|
|
|
|
|
defaultSelectList.add(specification.getDefaultSelected());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 判断启用默认选中的规格是否超过一个
|
|
|
|
|
|
|
|
if (defaultSelectList.size() > 1) {
|
|
|
|
|
|
|
|
return R.error("商品规格只能选择一个启用默认选中");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (GoodsAttribute goodsAttribute : attributes) {
|
|
|
|
for (GoodsAttribute goodsAttribute : attributes) {
|
|
|
|
goodsAttribute.setGoodsId(goods.getId());
|
|
|
|
goodsAttribute.setGoodsId(goods.getId());
|
|
|
|