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/BanLiShopGoodsSetServiceImpl.java |   46 ++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 42 insertions(+), 4 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopGoodsSetServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopGoodsSetServiceImpl.java
index 8cc8d8a..cd17ff6 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopGoodsSetServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopGoodsSetServiceImpl.java
@@ -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) {
@@ -128,13 +166,13 @@
 	}
 
 	@Override
-	public List<BanLiShopGoodsSets> listQuery(int page, int pageSize, String key) {
-		return banLiShopGoodsSetsMapper.listQuery((page - 1) * pageSize, pageSize, key);
+	public List<BanLiShopGoodsSets> listQuery(int page, int pageSize, String key, Long goodsId) {
+		return banLiShopGoodsSetsMapper.listQuery((page - 1) * pageSize, pageSize, key, goodsId);
 	}
 
 	@Override
-	public long countQuery(String key) {
-		return banLiShopGoodsSetsMapper.countQuery(key);
+	public long countQuery(String key, Long goodsId) {
+		return banLiShopGoodsSetsMapper.countQuery(key, goodsId);
 	}
 
 	@Override

--
Gitblit v1.8.0