|
@@ -103,13 +103,18 @@ public class SecondGoodsServiceImpl extends ServiceImpl<SecondGoodsMapper, Secon
|
|
|
*/
|
|
|
@Override
|
|
|
public boolean saveAsDraft(SecondGoodsVo goods) {
|
|
|
- SecondGoods secondGoods = new SecondGoods();
|
|
|
- BeanUtils.copyProperties(goods, secondGoods);
|
|
|
// 设置商品状态为草稿
|
|
|
goods.setGoodsStatus(SecondGoodsStatusEnum.DRAFT.getCode());
|
|
|
- // 保存商品基本信息
|
|
|
- if (!save(goods)) {
|
|
|
- return false; // 保存失败直接返回
|
|
|
+ if (null != goods.getId()){
|
|
|
+ // 更新商品基本信息
|
|
|
+ if (!updateById(goods)) {
|
|
|
+ return false; // 保存失败直接返回
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ // 保存商品基本信息
|
|
|
+ if (!save(goods)) {
|
|
|
+ return false; // 保存失败直接返回
|
|
|
+ }
|
|
|
}
|
|
|
// 获取保存后的商品ID,用于后续业务处理
|
|
|
Integer savedGoodsId = goods.getId();
|