From 30d8e227e8d823b6c38c3b9c90ac2df03b63befe Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 25 二月 2025 16:41:22 +0800
Subject: [PATCH] 淘宝转链接口更新

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/lable/LabelServiceImpl.java |  795 ++++++++++++++++++++++++++++----------------------------
 1 files changed, 398 insertions(+), 397 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/lable/LabelServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/lable/LabelServiceImpl.java
index 5da3b12..65cedd9 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/lable/LabelServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/lable/LabelServiceImpl.java
@@ -1,397 +1,398 @@
-package com.yeshi.fanli.service.impl.lable;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-
-import javax.annotation.Resource;
-
-import org.springframework.cache.annotation.Cacheable;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.multipart.MultipartFile;
-import org.yeshi.utils.tencentcloud.COSManager;
-
-import com.yeshi.fanli.dao.mybatis.lable.LabelClassMapper;
-import com.yeshi.fanli.dao.mybatis.lable.LabelGoodsMapper;
-import com.yeshi.fanli.dao.mybatis.lable.LabelMapper;
-import com.yeshi.fanli.entity.bus.lable.Label;
-import com.yeshi.fanli.entity.bus.lable.LabelGoods;
-import com.yeshi.fanli.entity.common.AdminUser;
-import com.yeshi.fanli.exception.LabelException;
-import com.yeshi.fanli.service.inter.lable.LabelService;
-import com.yeshi.fanli.util.StringUtil;
-
-import jxl.Sheet;
-import jxl.Workbook;
-
-@Service
-public class LabelServiceImpl implements LabelService {
-
-	@Resource
-	private LabelMapper labelMapper;
-	
-	@Resource
-	private LabelGoodsMapper labelGoodsMapper;
-	
-	@Resource
-	private LabelClassMapper labelClassMapper;
-	
-
-	@Override
-	public int insertSelective(Label record) throws LabelException{
-		return labelMapper.insertSelective(record);
-	}
-
-	@Override
-	@Transactional
-	public void insertList(List<Label>  records,AdminUser admin) throws LabelException{
-		if (records != null && records.size() > 0) {
-			for (Label label : records) {
-				
-				//   褰曞叆鏂瑰紡
-				label.setEntrymode(Label.MODE_BACKSTAGE);
-				
-				Date nowTime = new Date();
-				// 褰曞叆鏃堕棿銆備汉
-				label.setCreatetime(nowTime);
-				label.setUpdatetime(nowTime);
-				label.setCreateUser(admin);
-				label.setIosClick(0l);
-				label.setAndroidClick(0l);
-				
-				labelMapper.insertSelective(label);
-			}
-		}
-		
-	}
-	
-	
-	@Override
-	public void insertSingle(Label label, AdminUser admin,MultipartFile file) throws Exception{
-				
-		Date nowTime = new Date();
-		// 褰曞叆鏃堕棿銆備汉
-		label.setCreatetime(nowTime);
-		label.setUpdatetime(nowTime);
-		label.setCreateUser(admin);
-		label.setIosClick(0l);
-		label.setAndroidClick(0l);
-		//   褰曞叆鏂瑰紡
-		label.setEntrymode(Label.MODE_BACKSTAGE);
-		
-		labelMapper.insertSelective(label);
-		
-		// 涓婁紶鍥剧墖
-		if (file != null) {
-			uploadPicture(file, label);
-		}
-				
-		
-	}
-	
-	@Override
-	@Transactional
-	public void updateList(List<Label>  records) throws LabelException{
-		if (records != null && records.size() > 0) {
-			for (Label label : records) {
-				
-				Date nowTime = new Date();
-				label.setUpdatetime(nowTime);
-				
-				labelMapper.updateByPrimaryKeySelective(label);
-			}
-		}
-		
-	}
-	
-	
-	@Override
-	public int updateByPrimaryKey(Label record) throws LabelException{
-		// TODO Auto-generated method stub
-		return labelMapper.updateByPrimaryKey(record);
-	}
-
-	@Override
-	public int updateByPrimaryKeySelective(Label record) throws LabelException{
-		// TODO Auto-generated method stub
-		return labelMapper.updateByPrimaryKeySelective(record);
-	}
-
-	
-	@Override
-	@Transactional
-	public int deleteBatchById(long[] ids) throws LabelException{
-		return labelMapper.deleteBatchByPrimaryKey(ids);
-	}
-
-	@Override
-	@Transactional
-	public void deleteBatchByPrimaryKey(List<Long> ids) throws LabelException {
-		for (Long id : ids) {
-			Label label = labelMapper.selectByPrimaryKey(id);
-			if (label != null) {
-				// 鍒犻櫎鍥剧墖
-				deleteImg(label);
-				// 鍒犻櫎鏁版嵁淇℃伅
-				labelMapper.deleteByPrimaryKey(id);
-				
-				// 鍒犻櫎鍟嗗搧瀵瑰簲鐨勬爣绛�
-				labelGoodsMapper.deleteByLabId(id);
-				// 鍒犻櫎鍒嗙被瀵瑰簲鐨勬爣绛�
-				labelClassMapper.deleteByLabId(id);
-			}
-		}
-	}
-
-	@Override
-	public Label selectByPrimaryKey(Long id) throws LabelException{
-		return labelMapper.selectByPrimaryKey(id);
-	}
-	
-	@Override
-	public List<Label> selectByTitle(String title) throws LabelException{
-		return labelMapper.selectByTitle(title);
-	}
-
-	
-	@Override
-	@Cacheable(value = "labelCache",key="'getByTitleCache-'+#labKey +'-'+#title")
-	public Label getByTitleCache(String labKey, String title) throws LabelException{
-		return labelMapper.getByTitle(title);
-	}
-	
-	
-	@Override
-	@Cacheable(value = "labelCache",key="'listByTitlesCache-'+#list")
-	public List<Label> listByTitlesCache(List<String> list){
-		return labelMapper.listByTitles(list);
-	}
-	
-	
-	@Override
-	public List<Label> query(int pageIndex, int pageSize, String key,
-			String startTime, String endTime, String orderMode) throws LabelException {
-		return labelMapper.query(pageIndex, pageSize, key, startTime, endTime,orderMode);
-	}
-	
-	@Override
-	public int getQueryCount( String key, String startTime, String endTime) throws LabelException {
-		return labelMapper.getQueryCount(key, startTime, endTime);
-	}
-	
-	/**
-	 * 浠巈xcel鏂囦欢瑙f瀽璁㈠崟
-	 * 
-	 * @param in
-	 * @return
-	 */
-	@Override
-	public void analysisExcel(InputStream in, AdminUser admin) throws Exception {
-
-		jxl.Workbook rwb = Workbook.getWorkbook(in);
-		Sheet sheet = rwb.getSheet(0);
-
-		Date nowTime = new Date();
-		
-		Set<String> titles = new HashSet<String>();
-		for (int r = 1; r < sheet.getRows(); r++) {
-		
-			for (int c = 0; c < sheet.getColumns(); c++) {
-				String content = sheet.getCell(c, r).getContents();
-
-				if (StringUtil.isNullOrEmpty(content)) 
-					break;// 涓虹┖鍒欑粨鏉熷綋鍓嶈閬嶅巻
-				
-				// 鍘绘帀閲嶅瀛楁
-				titles.add(content.trim());
-			}
-		}
-		
-		
-		
-		if (titles != null && titles.size() > 0) {
-			
-			for (String title : titles) {
-				
-				List<Label> labels = selectByTitle(title.trim());
-				// 鑻ュ凡瀛樺湪鍒欎笉瀛樺叆鏁版嵁搴�
-				if (labels == null || labels.size() == 0) {
-					Label label = new Label();
-					
-					label.setTitle(title.trim()); // 鍚嶇О
-					label.setEntrymode(Label.MODE_EXCEL); // 鎵归噺褰曞叆
-					label.setCreatetime(nowTime);
-					label.setUpdatetime(nowTime);
-					label.setCreateUser(admin);
-					
-					insertSelective(label);
-				}
-
-			}
-		}
-
-	}
-	
-	@Override
-	public int uploadPicture(MultipartFile file, Label label) throws Exception {
-		
-		InputStream inputStream = file.getInputStream();
-		String contentType = file.getContentType();
-		String type = contentType.substring(contentType.indexOf("/") + 1);
-		// 涓婁紶鏂囦欢鐩稿浣嶇疆
-		String fileUrl="LableImg/"+UUID.randomUUID().toString().replace("-", "") + "." + type;
-		
-		boolean deleteFile =true;
-		
-		/*  淇敼鍥剧墖鏃讹紝鍏堝垹闄ゅ凡瀛樺湪鍥剧墖  */
-		String picture = label.getPicture();
-		if (!StringUtil.isNullOrEmpty(picture)) 
-			deleteFile = COSManager.getInstance().deleteFile(picture);
-		
-		
-		int result = 2;
-		
-		/*  涓婁紶鏂板浘鐗�  */
-		if (deleteFile) {
-			
-			String uploadFilePath = COSManager.getInstance().uploadFile(inputStream, fileUrl).getUrl();
-			
-			/*  鏇存柊鏁版嵁搴撲俊鎭�  */
-			if (!StringUtil.isNullOrEmpty(uploadFilePath)) {
-				
-				Date nowTime = new Date();
-				
-				label.setPicture(uploadFilePath);
-				label.setUpdatetime(nowTime);
-				
-				result = updateByPrimaryKeySelective(label);
-			}
-		}
-		
-		return result;
-		
-	}
-	
-	/**
-	 * 鍒犻櫎鍥剧墖
-	 */
-	@Override
-	public int deleteImg(Label label) throws LabelException {
-		
-		String fileUrl = label.getPicture();
-		
-		int result = 2;
-		boolean deleteFile = true;
-		
-		if (!StringUtil.isNullOrEmpty(fileUrl)) {
-			
-			deleteFile = COSManager.getInstance().deleteFile(fileUrl);
-			
-			if (deleteFile) {
-				Date nowTime = new Date();
-				
-				label.setPicture(null);
-				label.setUpdatetime(nowTime);
-				// 鏇存柊鏁版嵁搴�
-				result = updateByPrimaryKey(label);
-			}
-			
-		}
-		return result;
-		
-	}
-	
-	
-	@Override
-	public Map<String, Object> getCountByEntryMode() throws LabelException{
-		return labelMapper.getCountByEntryMode();
-	}
-
-	@Override
-	public long getCountToday() throws LabelException{
-		return labelMapper.getCountToday();
-	}
-
-	@Override
-	public long getCount() {
-		return labelMapper.getCount();
-	}
-	
-	@Override
-	public List<Label> queryGoodsCandidate(int start, int count, String key, Long classId) throws LabelException{
-		return labelMapper.queryGoodsCandidate(start, count, key, classId);
-	}
-	
-	@Override
-	public int getCountQueryGoodsCandidate( String key, Long classId) throws LabelException{
-		return labelMapper.getCountQueryGoodsCandidate(key, classId);
-	}
-	
-	@Override
-	public List<Label> queryClassCandidate(int start, int count, String key, Long classId) throws LabelException{
-		return labelMapper.queryClassCandidate(start, count, key, classId);
-	}
-	
-	@Override
-	public int getCountQueryClassCandidate( String key, Long classId) throws LabelException{
-		return labelMapper.getCountQueryClassCandidate(key, classId);
-	}
-	
-	@Override
-	public List<Label> querySubClassCandidate(int start, int count, String key, Long subClassId) throws LabelException{
-		return labelMapper.querySubClassCandidate(start, count, key, subClassId);
-	}
-
-	@Override
-	public int getCountQuerySubClassCandidate( String key, Long subClassId) throws LabelException{
-		return labelMapper.getCountQuerySubClassCandidate(key, subClassId);
-	}
-
-	@Override
-	public List<LabelGoods> getByGoodsId(Long goodsId) {
-		return labelMapper.getByGoodsId(goodsId);
-	}
-	
-	@Override
-	public List<Label> addBatchByNames(String lableNames, AdminUser admin) throws LabelException{
-		if (lableNames == null || lableNames.trim().length() == 0) {
-			return null;
-		}
-
-		List<Label> listLabs = new ArrayList<Label>();
-		// 绌烘牸闅斿紑
-		String[] arrtitles = lableNames.split("\\s+");
-		
-		for (String title : arrtitles) {
-			/* 閬嶅巻鏍囩鍚嶇О锛氭煡璇㈡暟鎹簱涓槸鍚﹀凡瀛樺湪 */
-			List<Label> labels = selectByTitle(title.trim());
-			if (labels != null && labels.size() > 0) {
-				Label label = labels.get(0);
-				listLabs.add(label);
-			} else {
-				// 鏂板
-				Label label = new Label();
-				label.setTitle(title);// 鍚嶇О
-				label.setEntrymode(Label.MODE_SYSTEM); // 鎵归噺褰曞叆
-				label.setCreatetime(new Date());
-				label.setUpdatetime(new Date());
-				label.setCreateUser(admin);
-				label.setIosClick(0l);
-				label.setAndroidClick(0l);
-				insertSelective(label);
-				
-				listLabs.add(label);
-			}
-		}
-		
-		return listLabs;
-	}
-	
-}
-
+package com.yeshi.fanli.service.impl.lable;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
+import javax.annotation.Resource;
+
+import org.springframework.cache.annotation.Cacheable;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+import org.yeshi.utils.tencentcloud.COSManager;
+
+import com.yeshi.fanli.dao.mybatis.lable.LabelClassMapper;
+import com.yeshi.fanli.dao.mybatis.lable.LabelGoodsMapper;
+import com.yeshi.fanli.dao.mybatis.lable.LabelMapper;
+import com.yeshi.fanli.entity.bus.lable.Label;
+import com.yeshi.fanli.entity.bus.lable.LabelGoods;
+import com.yeshi.fanli.entity.common.AdminUser;
+import com.yeshi.fanli.exception.goods.quality.LabelException;
+import com.yeshi.fanli.service.inter.lable.LabelService;
+import com.yeshi.fanli.util.FilePathEnum;
+import com.yeshi.fanli.util.StringUtil;
+
+import jxl.Sheet;
+import jxl.Workbook;
+
+@Service
+public class LabelServiceImpl implements LabelService {
+
+	@Resource
+	private LabelMapper labelMapper;
+	
+	@Resource
+	private LabelGoodsMapper labelGoodsMapper;
+	
+	@Resource
+	private LabelClassMapper labelClassMapper;
+	
+
+	@Override
+	public int insertSelective(Label record) throws LabelException{
+		return labelMapper.insertSelective(record);
+	}
+
+	@Override
+	@Transactional(rollbackFor=Exception.class)
+	public void insertList(List<Label>  records,AdminUser admin) throws LabelException{
+		if (records != null && records.size() > 0) {
+			for (Label label : records) {
+				
+				//   褰曞叆鏂瑰紡
+				label.setEntrymode(Label.MODE_BACKSTAGE);
+				
+				Date nowTime = new Date();
+				// 褰曞叆鏃堕棿銆備汉
+				label.setCreatetime(nowTime);
+				label.setUpdatetime(nowTime);
+				label.setCreateUser(admin);
+				label.setIosClick(0l);
+				label.setAndroidClick(0l);
+				
+				labelMapper.insertSelective(label);
+			}
+		}
+		
+	}
+	
+	
+	@Override
+	public void insertSingle(Label label, AdminUser admin,MultipartFile file) throws Exception{
+				
+		Date nowTime = new Date();
+		// 褰曞叆鏃堕棿銆備汉
+		label.setCreatetime(nowTime);
+		label.setUpdatetime(nowTime);
+		label.setCreateUser(admin);
+		label.setIosClick(0l);
+		label.setAndroidClick(0l);
+		//   褰曞叆鏂瑰紡
+		label.setEntrymode(Label.MODE_BACKSTAGE);
+		
+		labelMapper.insertSelective(label);
+		
+		// 涓婁紶鍥剧墖
+		if (file != null) {
+			uploadPicture(file, label);
+		}
+				
+		
+	}
+	
+	@Override
+	@Transactional(rollbackFor=Exception.class)
+	public void updateList(List<Label>  records) throws LabelException{
+		if (records != null && records.size() > 0) {
+			for (Label label : records) {
+				
+				Date nowTime = new Date();
+				label.setUpdatetime(nowTime);
+				
+				labelMapper.updateByPrimaryKeySelective(label);
+			}
+		}
+		
+	}
+	
+	
+	@Override
+	public int updateByPrimaryKey(Label record) throws LabelException{
+		// TODO Auto-generated method stub
+		return labelMapper.updateByPrimaryKey(record);
+	}
+
+	@Override
+	public int updateByPrimaryKeySelective(Label record) throws LabelException{
+		// TODO Auto-generated method stub
+		return labelMapper.updateByPrimaryKeySelective(record);
+	}
+
+	
+	@Override
+	@Transactional(rollbackFor=Exception.class)
+	public int deleteBatchById(long[] ids) throws LabelException{
+		return labelMapper.deleteBatchByPrimaryKey(ids);
+	}
+
+	@Override
+	@Transactional(rollbackFor=Exception.class)
+	public void deleteBatchByPrimaryKey(List<Long> ids) throws LabelException {
+		for (Long id : ids) {
+			Label label = labelMapper.selectByPrimaryKey(id);
+			if (label != null) {
+				// 鍒犻櫎鍥剧墖
+				deleteImg(label);
+				// 鍒犻櫎鏁版嵁淇℃伅
+				labelMapper.deleteByPrimaryKey(id);
+				
+				// 鍒犻櫎鍟嗗搧瀵瑰簲鐨勬爣绛�
+				labelGoodsMapper.deleteByLabId(id);
+				// 鍒犻櫎鍒嗙被瀵瑰簲鐨勬爣绛�
+				labelClassMapper.deleteByLabId(id);
+			}
+		}
+	}
+
+	@Override
+	public Label selectByPrimaryKey(Long id) throws LabelException{
+		return labelMapper.selectByPrimaryKey(id);
+	}
+	
+	@Override
+	public List<Label> selectByTitle(String title) throws LabelException{
+		return labelMapper.selectByTitle(title);
+	}
+
+	
+	@Override
+	@Cacheable(value = "labelCache",key="'getByTitleCache-'+#labKey +'-'+#title")
+	public Label getByTitleCache(String labKey, String title) throws LabelException{
+		return labelMapper.getByTitle(title);
+	}
+	
+	
+	@Override
+	@Cacheable(value = "labelCache",key="'listByTitlesCache-'+#list")
+	public List<Label> listByTitlesCache(List<String> list){
+		return labelMapper.listByTitles(list);
+	}
+	
+	
+	@Override
+	public List<Label> query(int pageIndex, int pageSize, String key,
+			String startTime, String endTime, String orderMode) throws LabelException {
+		return labelMapper.query(pageIndex, pageSize, key, startTime, endTime,orderMode);
+	}
+	
+	@Override
+	public int getQueryCount( String key, String startTime, String endTime) throws LabelException {
+		return labelMapper.getQueryCount(key, startTime, endTime);
+	}
+	
+	/**
+	 * 浠巈xcel鏂囦欢瑙f瀽璁㈠崟
+	 * 
+	 * @param in
+	 * @return
+	 */
+	@Override
+	public void analysisExcel(InputStream in, AdminUser admin) throws Exception {
+
+		jxl.Workbook rwb = Workbook.getWorkbook(in);
+		Sheet sheet = rwb.getSheet(0);
+
+		Date nowTime = new Date();
+		
+		Set<String> titles = new HashSet<String>();
+		for (int r = 1; r < sheet.getRows(); r++) {
+		
+			for (int c = 0; c < sheet.getColumns(); c++) {
+				String content = sheet.getCell(c, r).getContents();
+
+				if (StringUtil.isNullOrEmpty(content)) 
+					break;// 涓虹┖鍒欑粨鏉熷綋鍓嶈閬嶅巻
+				
+				// 鍘绘帀閲嶅瀛楁
+				titles.add(content.trim());
+			}
+		}
+		
+		
+		
+		if (titles != null && titles.size() > 0) {
+			
+			for (String title : titles) {
+				
+				List<Label> labels = selectByTitle(title.trim());
+				// 鑻ュ凡瀛樺湪鍒欎笉瀛樺叆鏁版嵁搴�
+				if (labels == null || labels.size() == 0) {
+					Label label = new Label();
+					
+					label.setTitle(title.trim()); // 鍚嶇О
+					label.setEntrymode(Label.MODE_EXCEL); // 鎵归噺褰曞叆
+					label.setCreatetime(nowTime);
+					label.setUpdatetime(nowTime);
+					label.setCreateUser(admin);
+					
+					insertSelective(label);
+				}
+
+			}
+		}
+
+	}
+	
+	@Override
+	public int uploadPicture(MultipartFile file, Label label) throws Exception {
+		
+		InputStream inputStream = file.getInputStream();
+		String contentType = file.getContentType();
+		String type = contentType.substring(contentType.indexOf("/") + 1);
+		// 涓婁紶鏂囦欢鐩稿浣嶇疆
+		String fileUrl=FilePathEnum.lable.getPath() + UUID.randomUUID().toString().replace("-", "") + "." + type;
+		
+		boolean deleteFile =true;
+		
+		/*  淇敼鍥剧墖鏃讹紝鍏堝垹闄ゅ凡瀛樺湪鍥剧墖  */
+		String picture = label.getPicture();
+		if (!StringUtil.isNullOrEmpty(picture)) 
+			deleteFile = COSManager.getInstance().deleteFile(picture);
+		
+		
+		int result = 2;
+		
+		/*  涓婁紶鏂板浘鐗�  */
+		if (deleteFile) {
+			
+			String uploadFilePath = COSManager.getInstance().uploadFile(inputStream, fileUrl).getUrl();
+			
+			/*  鏇存柊鏁版嵁搴撲俊鎭�  */
+			if (!StringUtil.isNullOrEmpty(uploadFilePath)) {
+				
+				Date nowTime = new Date();
+				
+				label.setPicture(uploadFilePath);
+				label.setUpdatetime(nowTime);
+				
+				result = updateByPrimaryKeySelective(label);
+			}
+		}
+		
+		return result;
+		
+	}
+	
+	/**
+	 * 鍒犻櫎鍥剧墖
+	 */
+	@Override
+	public int deleteImg(Label label) throws LabelException {
+		
+		String fileUrl = label.getPicture();
+		
+		int result = 2;
+		boolean deleteFile = true;
+		
+		if (!StringUtil.isNullOrEmpty(fileUrl)) {
+			
+			deleteFile = COSManager.getInstance().deleteFile(fileUrl);
+			
+			if (deleteFile) {
+				Date nowTime = new Date();
+				
+				label.setPicture(null);
+				label.setUpdatetime(nowTime);
+				// 鏇存柊鏁版嵁搴�
+				result = updateByPrimaryKey(label);
+			}
+			
+		}
+		return result;
+		
+	}
+	
+	
+	@Override
+	public Map<String, Object> getCountByEntryMode() throws LabelException{
+		return labelMapper.getCountByEntryMode();
+	}
+
+	@Override
+	public long getCountToday() throws LabelException{
+		return labelMapper.getCountToday();
+	}
+
+	@Override
+	public long getCount() {
+		return labelMapper.getCount();
+	}
+	
+	@Override
+	public List<Label> queryGoodsCandidate(int start, int count, String key, Long classId) throws LabelException{
+		return labelMapper.queryGoodsCandidate(start, count, key, classId);
+	}
+	
+	@Override
+	public int getCountQueryGoodsCandidate( String key, Long classId) throws LabelException{
+		return labelMapper.getCountQueryGoodsCandidate(key, classId);
+	}
+	
+	@Override
+	public List<Label> queryClassCandidate(int start, int count, String key, Long classId) throws LabelException{
+		return labelMapper.queryClassCandidate(start, count, key, classId);
+	}
+	
+	@Override
+	public int getCountQueryClassCandidate( String key, Long classId) throws LabelException{
+		return labelMapper.getCountQueryClassCandidate(key, classId);
+	}
+	
+	@Override
+	public List<Label> querySubClassCandidate(int start, int count, String key, Long subClassId) throws LabelException{
+		return labelMapper.querySubClassCandidate(start, count, key, subClassId);
+	}
+
+	@Override
+	public int getCountQuerySubClassCandidate( String key, Long subClassId) throws LabelException{
+		return labelMapper.getCountQuerySubClassCandidate(key, subClassId);
+	}
+
+	@Override
+	public List<LabelGoods> getByGoodsId(Long goodsId) {
+		return labelMapper.getByGoodsId(goodsId);
+	}
+	
+	@Override
+	public List<Label> addBatchByNames(String lableNames, AdminUser admin) throws LabelException{
+		if (lableNames == null || lableNames.trim().length() == 0) {
+			return null;
+		}
+
+		List<Label> listLabs = new ArrayList<Label>();
+		// 绌烘牸闅斿紑
+		String[] arrtitles = lableNames.split("\\s+");
+		
+		for (String title : arrtitles) {
+			/* 閬嶅巻鏍囩鍚嶇О锛氭煡璇㈡暟鎹簱涓槸鍚﹀凡瀛樺湪 */
+			List<Label> labels = selectByTitle(title.trim());
+			if (labels != null && labels.size() > 0) {
+				Label label = labels.get(0);
+				listLabs.add(label);
+			} else {
+				// 鏂板
+				Label label = new Label();
+				label.setTitle(title);// 鍚嶇О
+				label.setEntrymode(Label.MODE_SYSTEM); // 鎵归噺褰曞叆
+				label.setCreatetime(new Date());
+				label.setUpdatetime(new Date());
+				label.setCreateUser(admin);
+				label.setIosClick(0l);
+				label.setAndroidClick(0l);
+				insertSelective(label);
+				
+				listLabs.add(label);
+			}
+		}
+		
+		return listLabs;
+	}
+	
+}
+

--
Gitblit v1.8.0