From 2e53c542b4dfac6d1e62c7a2e7d21a3984e797c2 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期一, 11 十一月 2019 17:24:44 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopGoodsSetPayServiceImpl.java |   52 ++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 48 insertions(+), 4 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 679d072..c18a993 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
@@ -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) {
@@ -99,13 +143,13 @@
 
 	
 	@Override
-	public List<BanLiShopGoodsSetsPay> listQuery(int page, int pageSize, String key, Integer payType) {
-		return banLiShopGoodsSetsPayMapper.listQuery((page - 1) * pageSize, pageSize, key, payType);
+	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) {
-		return banLiShopGoodsSetsPayMapper.countQuery(key, payType);
+	public long countQuery(String key, Integer payType, Long setId) {
+		return banLiShopGoodsSetsPayMapper.countQuery(key, payType, setId);
 	}
 
 

--
Gitblit v1.8.0