| | |
| | | return banLiShopGoodsSetsPayMapper.selectByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Override
|
| | | public void addSetPay(BanLiShopGoodsSetsPay pay) throws BanLiShopGoodsSetPayException {
|
| | | if (pay.getId() == null)// 新增
|
| | |
| | | updateSelectiveByPrimaryKey(pay);
|
| | | }
|
| | | }
|
| | | |
| | | @Override
|
| | | public void saveObject(BanLiShopGoodsSetsPay record) throws BanLiShopGoodsSetPayException {
|
| | | // 判断参数是否齐全
|
| | | if (record.getGoodsSet() == null || record.getGoodsSet().getId() == null)
|
| | | throw new BanLiShopGoodsSetPayException(1, "套餐不存在");
|
| | |
|
| | | if (record.getPayType() == null)
|
| | | throw new BanLiShopGoodsSetPayException(1, "请指定支付方式");
|
| | |
|
| | | if (record.getPayType() == BanLiShopGoodsSetsPay.PAY_TYPE_HONGBAO) {
|
| | | if (record.getHongBaoPrice() == null)
|
| | | throw new BanLiShopGoodsSetPayException(1, "请指定红包支付价格");
|
| | | } else if (record.getPayType() == BanLiShopGoodsSetsPay.PAY_TYPE_BALANCE) {
|
| | | if (record.getBalancePrice() == null)
|
| | | throw new BanLiShopGoodsSetPayException(1, "请指定余额支付价格");
|
| | | } else if (record.getPayType() == BanLiShopGoodsSetsPay.PAY_TYPE_HONGBAO_MONEY) {
|
| | | if (record.getHongBaoPrice() == null || record.getMoneyPrice() == null)
|
| | | throw new BanLiShopGoodsSetPayException(1, "请指定红包、现金支付价格");
|
| | | } else if (record.getPayType() == BanLiShopGoodsSetsPay.PAY_TYPE_MONEY) {
|
| | | if (record.getMoneyPrice() == null)
|
| | | throw new BanLiShopGoodsSetPayException(1, "请指定现金支付价格");
|
| | | }
|
| | |
|
| | | record.setUpdateTime(new Date());
|
| | | if (record.getId() == null) {
|
| | | record.setCreateTime(new Date());
|
| | | banLiShopGoodsSetsPayMapper.insertSelective(record);
|
| | |
|
| | | if (record.getWeight() == null) {// 权重更新
|
| | | BanLiShopGoodsSetsPay update = new BanLiShopGoodsSetsPay();
|
| | | update.setId(record.getId());
|
| | | update.setWeight((int) record.getId().longValue());
|
| | | banLiShopGoodsSetsPayMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | } else {
|
| | | BanLiShopGoodsSetsPay resultObj = banLiShopGoodsSetsPayMapper.selectByPrimaryKey(record.getId());
|
| | | if (resultObj == null)
|
| | | throw new BanLiShopGoodsSetPayException(1, "修改内容已不存在");
|
| | | |
| | | record.setCreateTime(resultObj.getCreateTime());
|
| | | banLiShopGoodsSetsPayMapper.updateByPrimaryKey(record);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void updateSelectiveByPrimaryKey(BanLiShopGoodsSetsPay pay) {
|