From 718ddb45b7f05a1d37c18ab7c3fc7862a2aa7d06 Mon Sep 17 00:00:00 2001
From: 喻健 <喻健@Admin>
Date: 星期五, 16 十一月 2018 10:45:38 +0800
Subject: [PATCH] 热门搜索迁移

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/config/SuperHotSearchSerivceImpl.java |   63 +++++++++++++++++++++++++++++++
 1 files changed, 62 insertions(+), 1 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/config/SuperHotSearchSerivceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/config/SuperHotSearchSerivceImpl.java
index 4bceb36..0201047 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/config/SuperHotSearchSerivceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/config/SuperHotSearchSerivceImpl.java
@@ -20,6 +20,7 @@
 import com.yeshi.fanli.entity.system.System;
 import com.yeshi.fanli.service.inter.config.SuperHotSearchService;
 import com.yeshi.fanli.service.inter.config.SystemService;
+import com.yeshi.fanli.util.StringUtil;
 
 @Service
 public class SuperHotSearchSerivceImpl implements SuperHotSearchService {
@@ -67,7 +68,23 @@
 				strat, count, new Serializable[] { id, key });
 
 	}
-
+	
+	@Override
+	@SuppressWarnings({ "unchecked", "rawtypes" })
+	public List<SuperHotSearch> listSuperHotSearch(List<Long> list) {
+		
+		List<SuperHotSearch> listObj = (List<SuperHotSearch>) superHotSearchDao.excute(new HibernateCallback<List<SuperHotSearch>>() {
+			public List<SuperHotSearch> doInHibernate(Session session) throws HibernateException {
+				Query query = session.createQuery("from SuperHotSearch srs where srs.hotSearch.id in (:array)");
+				 query.setParameterList("array",list);     
+                 return query.list();
+			}
+		});
+		
+		return listObj;
+	}
+	
+	
 	public Integer deleteSuperHotSearch(final long hsid, final String platform, final String packageName) {
 		return (Integer) superHotSearchDao.excute(new HibernateCallback<Integer>() {
 
@@ -101,4 +118,48 @@
 		return getSuperHotSearchBySystemId(id);
 	}
 
+	
+	@SuppressWarnings({ "unchecked", "rawtypes" })
+	@Override
+	public List<SuperHotSearch> getHotSearchSystem(Long id, Long systemId) {
+		
+		List<SuperHotSearch> listObj = (List<SuperHotSearch>) superHotSearchDao.excute(new HibernateCallback<List<SuperHotSearch>>() {
+			public List<SuperHotSearch> doInHibernate(Session session) throws HibernateException {
+				 
+				Query query = session.createQuery("from SuperHotSearch shs " + " where shs.hotSearch.id=? and shs.system.id=?");
+				query.setLong(0, id);
+				query.setLong(1,systemId);
+					
+                return query.list();
+			}
+		});
+		
+		return listObj;
+	}
+	
+	@Override
+	public Integer deleteSuper(Long id, Long systemId) {
+		return (Integer) superHotSearchDao.excute(new HibernateCallback<Integer>() {
+			public Integer doInHibernate(Session session) throws HibernateException {
+				Transaction transaction = session.beginTransaction();
+				Query query = session
+						.createQuery("delete SuperHotSearch shs " + " where shs.hotSearch.id=? and shs.system.id=?");
+				query.setLong(0, id);
+				query.setLong(1, systemId);
+				int i = query.executeUpdate();
+				transaction.commit();
+				return i;
+			}
+		});
+	}
+	
+	@Override
+	public void addSuper(Long id, System system) {
+		SuperHotSearch superHotSearch = new SuperHotSearch();
+		HotSearch hotSearch = new HotSearch();
+		hotSearch.setId(id);
+		superHotSearch.setHotSearch(hotSearch);
+		superHotSearch.setSystem(system);
+		superHotSearchDao.create(superHotSearch);
+	}
 }

--
Gitblit v1.8.0