Browse Source

小小训练营

zouxuan 3 years ago
parent
commit
472c0951eb

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/LiveGoodsServiceImpl.java

@@ -46,6 +46,11 @@ public class LiveGoodsServiceImpl extends BaseServiceImpl<Integer, LiveGoods>  i
 		if (liveGoodsMapperService.findByLiveGoodsIdAndStatus(liveGoods.getId(),true).size() > 0) {
 			throw new BizException("商品已在直播间上架,不能修改");
 		}
+		//商品名称不能重复
+		LiveGoods goodsDaoByName = liveGoodsDao.getByName(liveGoods.getName());
+		if (goodsDaoByName != null && !goodsDaoByName.getId().equals(liveGoods.getId())) {
+			throw new BizException("商品名称已存在");
+		}
 		//下架直播间商品,并通知直播间
 //		if (!liveGoods.getStatus()) liveGoodsMapperService.downGoods(liveGoods.getId());
 		//更新商品信息