admin
2018-12-25 4cb15e222cd7d099d533ccbeb7f9a8cd99bf180c
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);
   }
}