From 32f8ab2806fb088335e24983477f5179064ada9d Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期五, 29 十一月 2019 17:37:01 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java
index 38fcb3d..11967ac 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java
@@ -86,13 +86,9 @@
 		if (brandClass ==null || brandClass.getId() == null)
 			throw new BrandInfoException(1, "鍒嗙被涓嶈兘涓虹┖");
 		
-		String shopKey = record.getShopKey();
-		if (StringUtil.isNullOrEmpty(shopKey))
-			record.setShopKey(name);
-		
-		String searchKey = record.getSearchKey();
-		if (StringUtil.isNullOrEmpty(searchKey))
-			record.setSearchKey(name);
+		BrandInfo existBrand = brandInfoMapper.selectByUniqueName(name.trim(), brandClass.getId(), record.getId());
+		if (existBrand != null)
+			throw new BrandInfoException(1, "璇ュ垎绫讳腑宸插瓨鍦細" + name.trim());
 		
 		Integer state = record.getState();
 		if (state == null) {
@@ -109,6 +105,7 @@
 			}
 		}
 
+		record.setName(name.trim());
 		Long id = record.getId();
 		if (id == null) {
 			record.setCreateTime(new Date());
@@ -119,7 +116,8 @@
 			
 			BrandInfo resultObj = new BrandInfo();
 			resultObj.setId(record.getId());
-			resultObj.setWeight(Double.valueOf(record.getId()));
+			resultObj.setOrder(Integer.valueOf(record.getId().toString()));
+			resultObj.setWeight(500.00);
 			brandInfoMapper.updateByPrimaryKeySelective(resultObj);
 		} else {
 			BrandInfo resultObj = brandInfoMapper.selectByPrimaryKey(id);
@@ -145,6 +143,7 @@
 				record.setShopTotal(resultObj.getShopTotal());
 			}
 			
+			record.setOrder(resultObj.getOrder());
 			record.setWeight(resultObj.getWeight());
 			record.setCreateTime(resultObj.getCreateTime());
 			record.setUpdateTime(new Date());
@@ -226,18 +225,18 @@
 		if (resultObj == null) 
 			throw new BrandInfoException(1, "鎿嶄綔鏁版嵁宸蹭笉瀛樺湪");
 		
-		Double oldOrder = resultObj.getWeight();
+		Integer oldOrder = resultObj.getOrder();
 		BrandInfo changeObj = brandInfoMapper.getByAdjoinOrder(resultObj.getBrandClass().getId(),oldOrder, moveType);
 		if (changeObj == null )
 			throw new BrandInfoException(1, "宸茬粡鍦ㄦ渶杈圭紭锛屾棤鍙氦鎹㈢殑浣嶇疆");
 		
 		BrandInfo changeObj1 = new BrandInfo();
 		changeObj1.setId(id);
-		changeObj1.setWeight(changeObj.getWeight());
+		changeObj1.setOrder(changeObj.getOrder());
 		
 		BrandInfo changeObj2 = new BrandInfo();
 		changeObj2.setId(changeObj.getId());
-		changeObj2.setWeight(oldOrder);
+		changeObj2.setOrder(oldOrder);
 		
 		brandInfoMapper.updateByPrimaryKeySelective(changeObj1);
 		brandInfoMapper.updateByPrimaryKeySelective(changeObj2);
@@ -245,13 +244,13 @@
 	
 
 	@Override
-	public List<BrandInfo> listQuery(long start, int count, String key, Long cid, Integer state) {
-		return brandInfoMapper.listQuery(start, count, key, cid, state);
+	public List<BrandInfo> listQuery(long start, int count, List<String> keys, Long cid, Integer state, Integer showState) {
+		return brandInfoMapper.listQuery(start, count, keys, cid, state,showState);
 	}
 
 	@Override
-	public long countQuery(String key, Long cid, Integer state) {
-		return brandInfoMapper.countQuery(key, cid, state);
+	public long countQuery(List<String> keys, Long cid, Integer state, Integer showState) {
+		return brandInfoMapper.countQuery(keys, cid, state, showState);
 	}
 
 	@Override
@@ -370,6 +369,7 @@
 			brandInfo.setGoodsTotal(numInfo.getGoodsTotal());
 			brandInfo.setShopTotal(numInfo.getShopTotal());
 			brandInfo.setUpdateTime(new Date());
+			brandInfo.setWeight(Math.random() * 1000);
 			brandInfoMapper.updateByPrimaryKeySelective(brandInfo);
 		}
 	}

--
Gitblit v1.8.0