From 51a4ff5d777028d52a19c314a99f796334cb7b51 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期六, 23 十一月 2019 18:30:01 +0800
Subject: [PATCH] 配置文件修改

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopGoodsSetServiceImpl.java |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 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 4d8a42f..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) {

--
Gitblit v1.8.0