yujian
2020-01-18 f4a0f2acc63d7785eab108419a4e16f5f688cb95
fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopGoodsSetServiceImpl.java
@@ -41,7 +41,7 @@
      return banLiShopGoodsSetsMapper.selectByPrimaryKey(id);
   }
   @Transactional
   @Transactional(rollbackFor=Exception.class)
   @Override
   public void addSet(BanLiShopGoodsSets set) throws BanLiShopGoodsSetException, BanLiShopGoodsSetPayException {
      if (set.getId() == null)// 添加
@@ -98,6 +98,44 @@
      }
   }
   @Override
   public void saveObject(BanLiShopGoodsSets record) throws BanLiShopGoodsSetException {
      if (record.getGoods() == null || record.getGoods().getId() == null)
         throw new BanLiShopGoodsSetException(1, "请指定商品");
      if (StringUtil.isNullOrEmpty(record.getName()))
         throw new BanLiShopGoodsSetException(1, "缺少套餐名字");
      if (record.getOriginalPrice() == null || record.getZkPrice() == null)
         throw new BanLiShopGoodsSetException(1, "价格信息不完整");
      if (record.getStock() == null)
         throw new BanLiShopGoodsSetException(1, "缺少库存信息");
      record.setUpdateTime(new Date());
      if (record.getId() == null) {
         record.setCreateTime(new Date());
         banLiShopGoodsSetsMapper.insertSelective(record);
         if (record.getWeight() == null) {// 权重更新
            BanLiShopGoodsSets update = new BanLiShopGoodsSets();
            update.setId(record.getId());
            update.setWeight((int) record.getId().longValue());
            banLiShopGoodsSetsMapper.updateByPrimaryKeySelective(update);
         }
      } else {
         BanLiShopGoodsSets resultObj = banLiShopGoodsSetsMapper.selectDetailByPrimaryKey(record.getId());
         if (resultObj == null)
            throw new BanLiShopGoodsSetException(1, "修改内容已不存在");
         record.setCreateTime(resultObj.getCreateTime());
         banLiShopGoodsSetsMapper.updateByPrimaryKey(record);
      }
   }
   @Override
   public void updateSelectiveByPrimaryKey(BanLiShopGoodsSets set) {