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/goods/SuperGoodsClassServiceImpl.java |  201 ++++++++++++++++++++-----------------------------
 1 files changed, 82 insertions(+), 119 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/SuperGoodsClassServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/SuperGoodsClassServiceImpl.java
index 80c7fa8..57adf76 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/SuperGoodsClassServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/SuperGoodsClassServiceImpl.java
@@ -1,119 +1,82 @@
-package com.yeshi.fanli.service.impl.goods;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.annotation.Resource;
-
-import org.hibernate.HibernateException;
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.hibernate.Transaction;
-import org.springframework.cache.annotation.Cacheable;
-import org.springframework.orm.hibernate4.HibernateCallback;
-import org.springframework.stereotype.Service;
-
-import com.yeshi.fanli.dao.goods.SuperGoodsClassDao;
-import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
-import com.yeshi.fanli.entity.bus.su.clazz.SuperGoodsClass;
-import com.yeshi.fanli.entity.system.BusinessSystem;
-import com.yeshi.fanli.service.inter.config.BusinessSystemService;
-import com.yeshi.fanli.service.inter.goods.SuperGoodsClassService;
-
-@Service
-public class SuperGoodsClassServiceImpl implements SuperGoodsClassService {
-
-	@Resource
-	private SuperGoodsClassDao superGoodsClassDao;
-	
-	@Resource
-	private BusinessSystemService businessSystemService;
-	
-	
-	@Cacheable(value="classCache", key="'getSuperGoodsClassBySystemId-'+#id")
-	public List<SuperGoodsClass> getSuperGoodsClassBySystemId(long id) {
-		
-		return superGoodsClassDao.list("from SuperGoodsClass sgc where sgc.system.id=? order by sgc.goodsClass.orderby ", new Serializable[]{id});
-		
-	}
-
-	public List<SuperGoodsClass> getSuperGoodsClasss(List<Long> gcIdList) {
-		if (gcIdList.size() == 0) {
-			return new ArrayList<SuperGoodsClass>();
-		}
-		StringBuffer sb = new StringBuffer(" from SuperGoodsClass sgc ");
-		Serializable[] serArr = new Serializable[gcIdList.size()];
-		for (int i = 0; i < gcIdList.size(); i++) {
-			if (i == 0) {
-				sb.append(" where sgc.goodsClass.id=? ");
-			} else {
-				sb.append(" or sgc.goodsClass.id=? ");
-			}
-			serArr[i] = gcIdList.get(i);
-		}
-		//sb.append(" order by sgc.goodsClass.orderby  ");
-		String hql = sb.toString();
-
-		return superGoodsClassDao.list(hql, serArr);
-
-	}
-
-	public List<SuperGoodsClass> getSuperGoodsClassList(long id, int start,
-			int count, String key) {
-		return superGoodsClassDao.list("from SuperGoodsClass srs where srs.system.id=? and srs.goodsClass.name like ? order by sgc.goodsClass.orderby ",start,count,new Serializable[]{id, "%"+key+"%"});
-		
-	}
-	
-	@Override
-	public List<SuperGoodsClass> getSuperGoodsClassAll(long id) {
-		return superGoodsClassDao.list("from SuperGoodsClass srs where srs.system.id=?  order by sgc.goodsClass.orderby ",new Serializable[]{id});
-		
-	}
-
-	public Integer deleteSuperGoodsClass(final long gcid, final String platform,
-			final String packageName) {
-
-		return  (Integer) superGoodsClassDao.excute(new HibernateCallback<Integer>() {
-
-			public Integer doInHibernate(Session session)
-					throws HibernateException {
-				BusinessSystem system = businessSystemService.getBusinessSystem(platform, packageName);
-				Transaction transaction = session.beginTransaction();
-				Query query = session.createQuery("delete SuperGoodsClass shs "
-							+ " where shs.goodsClass.id=? and shs.system.id=?");
-				query.setLong(0, gcid);
-				query.setLong(1, system.getId());
-				int i = query.executeUpdate();
-				transaction.commit();
-				return i ;
-			}
-		});
-	}
-
-	public void addSuperGoodsClass(long gcid, String platform,
-			String packageName) {
-		BusinessSystem system = businessSystemService.getBusinessSystem(platform,packageName);
-		SuperGoodsClass superGoodsClass = new SuperGoodsClass();
-		GoodsClass goodsClass = new GoodsClass();
-		goodsClass.setId(gcid);
-		superGoodsClass.setGoodsClass(goodsClass);;
-		superGoodsClass.setSystem(system);
-		superGoodsClassDao.create(superGoodsClass);
-	
-	}
-
-	public void deleteSuperGoodsClass(final long gcid) {
-		superGoodsClassDao.excute(new HibernateCallback() {
-			public Object doInHibernate(Session session)
-					throws HibernateException {
-				Query query = session.createQuery("delete from SuperGoodsClass sgc where sgc.goodsClass.id=?");
-				query.setParameter(0, gcid);
-				query.executeUpdate();
-				return null;
-			}
-		});
-	}
-
-
-}
+package com.yeshi.fanli.service.impl.goods;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.Resource;
+
+import org.springframework.cache.annotation.Cacheable;
+import org.springframework.stereotype.Service;
+
+import com.yeshi.fanli.dao.mybatis.SuperGoodsClassMapper;
+import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
+import com.yeshi.fanli.entity.bus.su.clazz.SuperGoodsClass;
+import com.yeshi.fanli.entity.system.BusinessSystem;
+import com.yeshi.fanli.service.inter.config.BusinessSystemService;
+import com.yeshi.fanli.service.inter.goods.SuperGoodsClassService;
+
+@Service
+public class SuperGoodsClassServiceImpl implements SuperGoodsClassService {
+
+	@Resource
+	private SuperGoodsClassMapper superGoodsClassMapper;
+	
+	@Resource
+	private BusinessSystemService businessSystemService;
+	
+	
+	@Override
+	@Cacheable(value="classCache", key="'getSuperGoodsClassBySystemId-'+#id")
+	public List<SuperGoodsClass> getSuperGoodsClassBySystemId(long id) {
+		return superGoodsClassMapper.listBySystemId(id);
+	}
+
+	@Override
+	public List<SuperGoodsClass> getSuperGoodsClasss(List<Long> gcIdList) {
+		if (gcIdList == null || gcIdList.size() == 0) {
+			return new ArrayList<SuperGoodsClass>();
+		}
+		return superGoodsClassMapper.listByGoodsclassIds(gcIdList);
+	}
+
+	@Override
+	public List<SuperGoodsClass> getSuperGoodsClassList(long id, int start,	int count, String key) {
+		return superGoodsClassMapper.listBySystemIdAmdClassName(start, count, key, id);
+		
+	}
+	
+	@Override
+	public Integer deleteSuperGoodsClass(final long gcid, final String platform, final String packageName) {
+		
+		BusinessSystem system = businessSystemService.getBusinessSystem(platform, packageName,null);
+		if (system == null) {
+			return 0;
+		}
+		return superGoodsClassMapper.deleteBySystemIdAndClassId(gcid, system.getId());
+	}
+
+	
+	@Override
+	public void addSuperGoodsClass(long gcid, String platform, String packageName) {
+		BusinessSystem system = businessSystemService.getBusinessSystem(platform,packageName,null);
+		
+		GoodsClass goodsClass = new GoodsClass();
+		goodsClass.setId(gcid);
+		
+		SuperGoodsClass superGoodsClass = new SuperGoodsClass();
+		superGoodsClass.setGoodsClass(goodsClass);;
+		superGoodsClass.setSystem(system);
+		superGoodsClassMapper.insert(superGoodsClass);
+	}
+	
+	@Override
+	public void deleteSuperGoodsClass(long gcid) {
+		superGoodsClassMapper.deleteByClassId(gcid);
+	}
+	
+	@Override
+	public void insertSelective(SuperGoodsClass record){
+		superGoodsClassMapper.insertSelective(record);
+	}
+	
+}

--
Gitblit v1.8.0