From 553e4585a5ec8e2c22b50e33a27d14ead6fd034d Mon Sep 17 00:00:00 2001
From: yujian <yujian>
Date: 星期五, 26 四月 2019 15:16:07 +0800
Subject: [PATCH] 店铺足迹删除+ 假删除

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/goods/CommonGoodsServiceImpl.java |   68 +++++++++++++++++++++++++++++++++-
 1 files changed, 66 insertions(+), 2 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/CommonGoodsServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/CommonGoodsServiceImpl.java
index 71eea30..190f35e 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/CommonGoodsServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/CommonGoodsServiceImpl.java
@@ -1,16 +1,18 @@
 package com.yeshi.fanli.service.impl.goods;
 
 import java.util.Date;
+import java.util.List;
 
 import javax.annotation.Resource;
 
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.yeshi.utils.StringUtil;
 
 import com.yeshi.fanli.dao.mybatis.goods.CommonGoodsMapper;
+import com.yeshi.fanli.entity.goods.CommonGoods;
 import com.yeshi.fanli.exception.goods.CommonGoodsException;
-import com.yeshi.fanli.goods.CommonGoods;
 import com.yeshi.fanli.service.inter.goods.CommonGoodsService;
-import com.yeshi.fanli.util.StringUtil;
 
 @Service
 public class CommonGoodsServiceImpl implements CommonGoodsService {
@@ -65,6 +67,23 @@
 		commonGoodsMapper.insertSelective(commonGoods);
 		return commonGoods;
 	}
+	
+	
+	@Override
+	public CommonGoods addCommonGoods(CommonGoods commonGoods) throws CommonGoodsException {
+		filterCommonGoods(commonGoods);
+		CommonGoods goods = commonGoodsMapper.selectByGoodsIdAndGoodsType(commonGoods.getGoodsId(),
+				commonGoods.getGoodsType());
+		if (goods != null) {
+			commonGoods.setId(goods.getId());
+			return commonGoods;
+		}
+		commonGoods.setCreateTime(new Date());
+		commonGoods.setUpdateTime(new Date());
+		commonGoodsMapper.insertSelective(commonGoods);
+		return commonGoods;
+	}
+
 
 	@Override
 	public void updateCommonGoods(CommonGoods commonGoods) throws CommonGoodsException {
@@ -99,4 +118,49 @@
 		return commonGoodsMapper.selectByGoodsIdAndGoodsType(goodsId, goodsType);
 	}
 
+	@Override
+	@Transactional
+	public void updateBatchCommonGoods(List<CommonGoods> listCommonGoods) {
+		
+		if (listCommonGoods == null || listCommonGoods.size() == 0) {
+			return;
+		}
+		
+		for (CommonGoods commonGoods: listCommonGoods) {
+			try {
+				updateCommonGoods(commonGoods);
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+		}
+	}
+	
+	@Override
+	@Transactional
+	public void addBatchCommonGoods(List<CommonGoods> listCommonGoods) {
+		
+		if (listCommonGoods == null || listCommonGoods.size() == 0) {
+			return;
+		}
+		
+		for (CommonGoods commonGoods: listCommonGoods) {
+			try {
+				addCommonGoods(commonGoods);
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+		}
+	}
+	
+	
+	@Override
+	public List<CommonGoods> listBySellerId(Long sellerId) {
+		return commonGoodsMapper.listBySellerId(sellerId);
+	} 
+	
+	
+	@Override
+	public long countBySellerIdAndHasCoupon(Long sellerId) {
+		return commonGoodsMapper.countBySellerIdAndHasCoupon(sellerId);
+	}
 }

--
Gitblit v1.8.0