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