From f4a0f2acc63d7785eab108419a4e16f5f688cb95 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期六, 18 一月 2020 12:06:27 +0800
Subject: [PATCH] 用户注册信息

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopGoodsSetPayServiceImpl.java |   58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 57 insertions(+), 1 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopGoodsSetPayServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopGoodsSetPayServiceImpl.java
index 61319bf..c0d56d7 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopGoodsSetPayServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopGoodsSetPayServiceImpl.java
@@ -34,7 +34,7 @@
 		return banLiShopGoodsSetsPayMapper.selectByPrimaryKey(id);
 	}
 
-	@Transactional
+	@Transactional(rollbackFor=Exception.class)
 	@Override
 	public void addSetPay(BanLiShopGoodsSetsPay pay) throws BanLiShopGoodsSetPayException {
 		if (pay.getId() == null)// 鏂板
@@ -73,6 +73,50 @@
 			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) {
@@ -97,4 +141,16 @@
 		banLiShopGoodsSetsPayMapper.deleteByPrimaryKey(id);
 	}
 
+	
+	@Override
+	public List<BanLiShopGoodsSetsPay> listQuery(int page, int pageSize, String key, Integer payType, Long setId) {
+		return banLiShopGoodsSetsPayMapper.listQuery((page - 1) * pageSize, pageSize, key, payType, setId);
+	}
+	
+	@Override
+	public long countQuery(String key, Integer payType, Long setId) {
+		return banLiShopGoodsSetsPayMapper.countQuery(key, payType, setId);
+	}
+
+
 }

--
Gitblit v1.8.0