admin
2021-07-30 19533a17aa55fafc70d0a385928e785cb50e1ebc
src/main/java/com/yeshi/buwan/service/imp/StarService.java
@@ -11,17 +11,18 @@
import javax.annotation.Resource;
import com.yeshi.buwan.service.inter.video.VideoInfoExtraService;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.orm.hibernate4.HibernateCallback;
import org.springframework.stereotype.Service;
import com.yeshi.buwan.dao.DetailSystemDao;
import com.yeshi.buwan.dao.system.DetailSystemDao;
import com.yeshi.buwan.dao.HotStarDao;
import com.yeshi.buwan.dao.SuperHotStarDao;
import com.yeshi.buwan.dao.VideoInfoDao;
import com.yeshi.buwan.domain.DetailSystem;
import com.yeshi.buwan.domain.system.DetailSystem;
import com.yeshi.buwan.domain.HotStar;
import com.yeshi.buwan.domain.SuperHotStar;
import com.yeshi.buwan.domain.VideoInfo;
@@ -33,356 +34,338 @@
@Service
public class StarService {
   @Resource
   private HotStarDao hotStarDao;
   @Resource
   private VideoInfoDao videoInfoDao;
   @Resource
   private SuperHotStarDao superHotStarDao;
    @Resource
    private HotStarDao hotStarDao;
    @Resource
    private VideoInfoDao videoInfoDao;
    @Resource
    private SuperHotStarDao superHotStarDao;
   @Resource
   private DetailSystemDao detailSystemDao;
    @Resource
    private DetailSystemDao detailSystemDao;
   public SuperHotStarDao getSuperHotStarDao() {
      return superHotStarDao;
   }
   public void setSuperHotStarDao(SuperHotStarDao superHotStarDao) {
      this.superHotStarDao = superHotStarDao;
   }
    @Resource
    private VideoInfoExtraService videoInfoExtraService;
   public VideoInfoDao getVideoInfoDao() {
      return videoInfoDao;
   }
    public StarService() {
   public void setVideoInfoDao(VideoInfoDao videoInfoDao) {
      this.videoInfoDao = videoInfoDao;
   }
    }
   public HotStarDao getHotStarDao() {
      return hotStarDao;
   }
    @Cacheable(value = "classCache", key = "'getHotStarList'+'-'+#page+'-'+#pageCount")
    public List<HotStar> getHotStarList(int page, int pageCount) {
   public void setHotStarDao(HotStarDao hotStarDao) {
      this.hotStarDao = hotStarDao;
   }
        List<HotStar> list = hotStarDao.list("from HotStar h order by h.orderby desc,h.createtime desc",
                (page - 1) * pageCount, pageCount, new String[]{});
        return list;
    }
   public StarService() {
    public List<HotStar> getHotStarList(String detailSystem, int page) {
        List<HotStar> list = hotStarDao.list(
                "select h.hotStar from SuperHotStar h where h.detailSystem.id=? order by h.hotStar.orderby desc,h.hotStar.createtime desc",
                (page - 1) * Constant.pageCount, Constant.pageCount, new String[]{detailSystem});
        return list;
    }
   }
    @Cacheable(value = "classCache", key = "'getHotStarDetail'+'-'+#id")
    public HotStar getHotStarDetail(String id) {
   @Cacheable(value = "classCache", key = "'getHotStarList'+'-'+#page+'-'+#pageCount")
   public List<HotStar> getHotStarList(int page, int pageCount) {
        return hotStarDao.find(HotStar.class, id);
    }
      List<HotStar> list = hotStarDao.list("from HotStar h order by h.orderby desc,h.createtime desc",
            (page - 1) * pageCount, pageCount, new String[] {});
      return list;
   }
    public long getHotStarCount() {
   public List<HotStar> getHotStarList(String detailSystem, int page) {
      List<HotStar> list = hotStarDao.list(
            "select h.hotStar from SuperHotStar h where h.detailSystem.id=? order by h.hotStar.orderby desc,h.hotStar.createtime desc",
            (page - 1) * Constant.pageCount, Constant.pageCount, new String[] { detailSystem });
      return list;
   }
        return hotStarDao.getCount("select count(*)  from HotStar");
    }
   @Cacheable(value = "classCache", key = "'getHotStarDetail'+'-'+#id")
   public HotStar getHotStarDetail(String id) {
    public long getHotStarCount(String detailSystem) {
      return hotStarDao.find(HotStar.class, id);
   }
        return hotStarDao.getCount("select count(*)  from SuperHotStar s where s.detailSystem.id=?",
                new String[]{detailSystem});
    }
   public long getHotStarCount() {
    public List<VideoInfo> getHotStarVideo(String starId, int page) {
      return hotStarDao.getCount("select count(*)  from HotStar");
   }
        List<VideoInfo> list = videoInfoDao.list(
                "select h.video from HotStarVideo as h LEFT JOIN h.video as v where h.video.show='1' and v.id=h.video.id and h.star.id=? order by h.video.updatetime desc",
                (page - 1) * Constant.pageCount, Constant.pageCount, new String[]{starId});
        return list;
    }
   public long getHotStarCount(String detailSystem) {
    public long getHotStarVideoCount(String starId) {
      return hotStarDao.getCount("select count(*)  from SuperHotStar s where s.detailSystem.id=?",
            new String[] { detailSystem });
   }
        long count = hotStarDao.getCount(
                "select count(*)  from HotStarVideo as h where h.video.show='1' and h.star.id=?",
                new String[]{starId});
        return count;
    }
   public List<VideoInfo> getHotStarVideo(String starId, int page) {
    public List<HotStar> getStarList() {
        return hotStarDao.list("from HotStar h order by h.orderby DESC");
    }
      List<VideoInfo> list = videoInfoDao.list(
            "select h.video from HotStarVideo as h LEFT JOIN h.video as v where h.video.show='1' and v.id=h.video.id and h.star.id=? order by h.video.updatetime desc",
            (page - 1) * Constant.pageCount, Constant.pageCount, new String[] { starId });
      return list;
   }
    public HotStar getStar(String id) {
        if (!StringUtil.isNullOrEmpty(id)) {
            return (HotStar) hotStarDao.find(HotStar.class, id);
        } else {
            return null;
        }
    }
   public long getHotStarVideoCount(String starId) {
    public HotStar addStar(HotStar star) {
        if (star != null) {
            hotStarDao.save(star);
            List<HotStar> list = hotStarDao.list("from HotStar h where h.createtime=? and h.name=?",
                    new String[]{star.getCreatetime(), star.getName()});
            if (list != null && list.size() > 0)
                return (HotStar) list.get(0);
        }
        return null;
    }
      long count = hotStarDao.getCount(
            "select count(*)  from HotStarVideo as h where h.video.show='1' and h.star.id=?",
            new String[] { starId });
      return count;
   }
    public HotStar updateStar(HotStar star) {
        if (star != null) {
            hotStarDao.update(star);
            List<HotStar> list = hotStarDao.list("from HotStar h where h.createtime=? and h.name=?",
                    new String[]{star.getCreatetime(), star.getName()});
            if (list != null && list.size() > 0)
                return (HotStar) list.get(0);
        }
        return null;
    }
   public List<HotStar> getStarList() {
      return hotStarDao.list("from HotStar h order by h.orderby DESC");
   }
    public void deleteStar(final HotStar star) {
        if (star != null) {
            hotStarDao.excute(new HibernateCallback() {
                public Object doInHibernate(Session session) throws HibernateException {
                    try {
                        @SuppressWarnings("unchecked")
                        List<SuperHotStar> list = session.createQuery("from SuperHotStar sh where sh.hotStar.id=?")
                                .setParameter(0, star.getId()).list();
                        session.getTransaction().begin();
                        for (SuperHotStar sh : list) {
                            session.delete(sh);
                        }
                        session.createQuery("delete from HotStar hs where hs.id=?").setParameter(0, star.getId())
                                .executeUpdate();
                        session.flush();
                        session.getTransaction().commit();
                    } catch (Exception e) {
                        e.printStackTrace();
                        session.getTransaction().rollback();
                    }
                    return null;
                }
            });
   public HotStar getStar(String id) {
      if (!StringUtil.isNullOrEmpty(id)) {
         return (HotStar) hotStarDao.find(HotStar.class, id);
      } else {
         return null;
      }
   }
        }
    }
   public HotStar addStar(HotStar star) {
      if (star != null) {
         hotStarDao.save(star);
         List<HotStar> list = hotStarDao.list("from HotStar h where h.createtime=? and h.name=?",
               new String[] { star.getCreatetime(), star.getName() });
         if (list != null && list.size() > 0)
            return (HotStar) list.get(0);
      }
      return null;
   }
    @SuppressWarnings("unchecked")
    @Cacheable(value = "classCache", key = "'getStarVideo'+'-'+#detailSystemId+'-'+#starId+'-'+#pageIndex+'-'+#cachemd5")
    public List<VideoInfo> getStarVideo(String detailSystemId, String starId, int pageIndex, List<Long> resourceList,
                                        String cachemd5) {
        String resourceWhere = "";
        for (Long rid : resourceList)
            resourceWhere += String.format(" rv.`resourceid`=%d  or", rid);
        if (resourceWhere.endsWith("or"))
            resourceWhere = resourceWhere.substring(0, resourceWhere.length() - 2);
   public HotStar updateStar(HotStar star) {
      if (star != null) {
         hotStarDao.update(star);
         List<HotStar> list = hotStarDao.list("from HotStar h where h.createtime=? and h.name=?",
               new String[] { star.getCreatetime(), star.getName() });
         if (list != null && list.size() > 0)
            return (HotStar) list.get(0);
      }
      return null;
   }
        List<VideoInfo> list = null;
        Session session = hotStarDao.getSession();
        try {
            HotStar star = (HotStar) session.get(HotStar.class, starId);
            String sql = String.format(
                    "SELECT v.* FROM wk_video_video v  LEFT JOIN wk_resource_video rv ON rv.`videoid`=v.`id` AND (%s) WHERE v.`contenttype`=1 AND v.`show`=1 AND v.`mainactor`  LIKE '%s'  AND rv.`videoid` IS NOT NULL and v.area is not null and v.area !='' GROUP BY v.`id` ORDER BY FROM_UNIXTIME(v.`updatetime`/1000) DESC",
                    resourceWhere, "%" + star.getName() + "%");
            list = session.createSQLQuery(sql).addEntity(VideoInfo.class)
                    .setFirstResult((pageIndex - 1) * Constant.pageCount).setMaxResults(Constant.pageCount).list();
        } catch (Exception e) {
            e.printStackTrace();
        }
   public void deleteStar(final HotStar star) {
      if (star != null) {
         hotStarDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
               try {
                  @SuppressWarnings("unchecked")
                  List<SuperHotStar> list = session.createQuery("from SuperHotStar sh where sh.hotStar.id=?")
                        .setParameter(0, star.getId()).list();
                  session.getTransaction().begin();
                  for (SuperHotStar sh : list) {
                     session.delete(sh);
                  }
                  session.createQuery("delete from HotStar hs where hs.id=?").setParameter(0, star.getId())
                        .executeUpdate();
                  session.flush();
                  session.getTransaction().commit();
               } catch (Exception e) {
                  e.printStackTrace();
                  session.getTransaction().rollback();
               }
               return null;
            }
         });
        list = videoInfoExtraService.batchExtra(list, resourceList);
        return list;
    }
      }
   }
    @Cacheable(value = "classCache", key = "'getStarVideo'+'-'+#detailSystemId+'-'+#starId+'-'+#pageIndex+'-'+#cachemd5")
    public List<VideoInfo> getStarVideo(String detailSystemId, String starId, int pageIndex, String cachemd5) {
        HotStar star = hotStarDao.find(HotStar.class, starId);
        return SolrUtil.searchStarVideos(star.getName(), pageIndex);
    }
   @SuppressWarnings("unchecked")
   @Cacheable(value = "classCache", key = "'getStarVideo'+'-'+#detailSystemId+'-'+#starId+'-'+#pageIndex+'-'+#cachemd5")
   public List<VideoInfo> getStarVideo(String detailSystemId, String starId, int pageIndex, List<Long> resourceList,
         String cachemd5) {
      String resourceWhere = "";
      for (Long rid : resourceList)
         resourceWhere += String.format(" rv.`resourceid`=%d  or", rid);
      if (resourceWhere.endsWith("or"))
         resourceWhere = resourceWhere.substring(0, resourceWhere.length() - 2);
    @Cacheable(value = "classCache", key = "'getStarVideoCount'+'-'+#detailSystemId+'-'+#starId")
    public long getStarVideoCount(String detailSystemId, String starId) {
        long count = 0;
        try {
            HotStar star = (HotStar) hotStarDao.find(HotStar.class, starId);
            count = hotStarDao.getCount(
                    "select count(*) from CategoryVideo cv where cv.video.mainActor like ? and cv.video.contentType=1 and cv.video.area is not null and cv.video.area!=''",
                    new Serializable[]{"%" + star.getName() + "%"});
      List<VideoInfo> list = null;
      Session session = hotStarDao.getSession();
      try {
         HotStar star = (HotStar) session.get(HotStar.class, starId);
         String sql = String.format(
               "SELECT v.* FROM wk_video_video v  LEFT JOIN wk_resource_video rv ON rv.`videoid`=v.`id` AND (%s) WHERE v.`contenttype`=1 AND v.`show`=1 AND v.`mainactor`  LIKE '%s'  AND rv.`videoid` IS NOT NULL and v.area is not null and v.area !='' GROUP BY v.`id` ORDER BY FROM_UNIXTIME(v.`updatetime`/1000) DESC",
               resourceWhere, "%" + star.getName() + "%");
         list = session.createSQLQuery(sql).addEntity(VideoInfo.class)
               .setFirstResult((pageIndex - 1) * Constant.pageCount).setMaxResults(Constant.pageCount).list();
      } catch (Exception e) {
         e.printStackTrace();
      }
      return list;
   }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return count;
    }
   @Cacheable(value = "classCache", key = "'getStarVideo'+'-'+#detailSystemId+'-'+#starId+'-'+#pageIndex+'-'+#cachemd5")
   public List<VideoInfo> getStarVideo(String detailSystemId, String starId, int pageIndex, String cachemd5) {
      HotStar star = hotStarDao.find(HotStar.class, starId);
      return SolrUtil.searchStarVideos(star.getName(), pageIndex);
   }
    public long getStarVideoPage(String detailSystemId, String starId) {
        long count = getStarVideoCount(detailSystemId, starId);
        return count % (long) Constant.pageCount != 0L ? count / (long) Constant.pageCount + 1L
                : count / (long) Constant.pageCount;
    }
   @Cacheable(value = "classCache", key = "'getStarVideoCount'+'-'+#detailSystemId+'-'+#starId")
   public long getStarVideoCount(String detailSystemId, String starId) {
      long count = 0;
      try {
         HotStar star = (HotStar) hotStarDao.find(HotStar.class, starId);
         count = hotStarDao.getCount(
               "select count(*) from CategoryVideo cv where cv.video.mainActor like ? and cv.video.contentType=1 and cv.video.area is not null and cv.video.area!=''",
               new Serializable[] { "%" + star.getName() + "%" });
    @SuppressWarnings("unchecked")
    public List<HotStarAdmin> getHotStarAdmin(String key, String systemId, int detailSystem, int page) {
        key = StringUtil.isNullOrEmpty(key) ? "" : key;
        List<HotStarAdmin> zhiBoClassList = new ArrayList<>();
      } catch (Exception e) {
         e.printStackTrace();
      }
      return count;
   }
        try {
            List<DetailSystem> detailSystemList = detailSystemDao.list("from DetailSystem ds where ds.system.id=" + systemId);
            String sql = "";
            if (detailSystem > 0)
                sql = "select sh.hotStar from SuperHotStar sh where  sh.detailSystem.id=" + detailSystem
                        + " and sh.hotStar.name like ?  order by  sh.hotStar.orderby desc";
            else
                sql = "from HotStar zb where zb.name like ? and zb.system.id=" + systemId + " order by zb.orderby desc";
   public long getStarVideoPage(String detailSystemId, String starId) {
      long count = getStarVideoCount(detailSystemId, starId);
      return count % (long) Constant.pageCount != 0L ? count / (long) Constant.pageCount + 1L
            : count / (long) Constant.pageCount;
   }
            List<HotStar> list = hotStarDao.list(sql, (page - 1) * Constant.pageCount, Constant.pageCount,
                    new Serializable[]{"%" + key + "%"});
            for (HotStar vb : list) {
                List<DetailSystem> detailSystemS = detailSystemDao
                        .list("select vb.detailSystem from SuperHotStar vb where vb.hotStar.id=" + vb.getId());
   @SuppressWarnings("unchecked")
   public List<HotStarAdmin> getHotStarAdmin(String key, int detailSystem, int page) {
      key = StringUtil.isNullOrEmpty(key) ? "" : key;
      List<HotStarAdmin> zhiBoClassList = new ArrayList<HotStarAdmin>();
                List<DetailSystemSelect> dssList = new ArrayList<>();
      try {
         List<DetailSystem> detailSystemList = detailSystemDao.list("from DetailSystem");
         String sql = "";
         if (detailSystem > 0)
            sql = "select sh.hotStar from SuperHotStar sh where  sh.detailSystem.id=" + detailSystem
                  + " and sh.hotStar.name like ?  order by  sh.hotStar.orderby desc";
         else
            sql = "from HotStar zb where zb.name like ? order by zb.orderby desc";
                for (DetailSystem ds : detailSystemList) {
                    DetailSystemSelect dss = new DetailSystemSelect();
                    dss.setDetailSystem(ds);
                    dss.setSelected(false);
                    dssList.add(dss);
                }
         List<HotStar> list = hotStarDao.list(sql, (page - 1) * Constant.pageCount, Constant.pageCount,
               new Serializable[] { "%" + key + "%" });
         for (HotStar vb : list) {
            List<DetailSystem> detailSystemS = detailSystemDao
                  .list("select vb.detailSystem from SuperHotStar vb where vb.hotStar.id=" + vb.getId());
                for (DetailSystem ds : detailSystemS) {
                    for (DetailSystemSelect dss : dssList) {
                        if (dss.getDetailSystem().getId().equalsIgnoreCase(ds.getId())) {
                            dss.setSelected(true);
                            break;
                        }
                    }
                }
                SuperHotStar sz = new SuperHotStar();
                sz.setDetailSystem(null);
                sz.setHotStar(vb);
                zhiBoClassList.add(new HotStarAdmin(sz, dssList));
            }
            List<DetailSystemSelect> dssList = new ArrayList<DetailSystemSelect>();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return zhiBoClassList;
    }
            for (DetailSystem ds : detailSystemList) {
               DetailSystemSelect dss = new DetailSystemSelect();
               dss.setDetailSystem(ds);
               dss.setSelected(false);
               dssList.add(dss);
            }
    public long getHotStarAdminCount(String key, String systemId, int detailSystem) {
        key = StringUtil.isNullOrEmpty(key) ? "" : key;
            for (DetailSystem ds : detailSystemS) {
               for (DetailSystemSelect dss : dssList) {
                  if (dss.getDetailSystem().getId().equalsIgnoreCase(ds.getId())) {
                     dss.setSelected(true);
                     break;
                  }
               }
            }
            SuperHotStar sz = new SuperHotStar();
            sz.setDetailSystem(null);
            sz.setHotStar(vb);
            zhiBoClassList.add(new HotStarAdmin(sz, dssList));
         }
        String sql = "";
        if (detailSystem > 0)
            sql = "select count(*) from  (select count(*) from wk_video_super_hotstar zb left join wk_video_hotstar c on c.id=zb.hotstarid where zb.detailsystemid="
                    + detailSystem + " and c.name like '%" + key + "%' group by zb.hotstarid) s";
        else
            sql = "select count(*) from  (select count(*) from wk_video_hotstar zb left join wk_video_hotstar c on c.id=zb.id where c.name like '%"
                    + key + "%' and zb.system=" + systemId + "  group by zb.id) s";
      } catch (Exception e) {
         e.printStackTrace();
      }
      return zhiBoClassList;
   }
        return hotStarDao.getCountSQL(sql);
    }
   public long getHotStarAdminCount(String key, int detailSystem) {
      key = StringUtil.isNullOrEmpty(key) ? "" : key;
    @SuppressWarnings("unchecked")
    public void deleteHotStarAdmin(final String classId, final String detailSystemId) {
        hotStarDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
      String sql = "";
      if (detailSystem > 0)
         sql = "select count(*) from  (select count(*) from wk_video_super_hotstar zb left join wk_video_hotstar c on c.id=zb.hotstarid where zb.detailsystemid="
               + detailSystem + " and c.name like '%" + key + "%' group by zb.hotstarid) s";
      else
         sql = "select count(*) from  (select count(*) from wk_video_hotstar zb left join wk_video_hotstar c on c.id=zb.id where c.name like '%"
               + key + "%'  group by zb.id) s";
                    List<SuperHotStar> list = session
                            .createQuery("from SuperHotStar vb where vb.hotStar.id=? and vb.detailSystem.id=?")
                            .setParameter(0, classId).setParameter(1, detailSystemId).list();
                    if (list != null && list.size() > 0) {
                        session.getTransaction().begin();
                        for (SuperHotStar vb : list)
                            session.delete(vb);
                        session.flush();
                        session.getTransaction().commit();
                    }
      return hotStarDao.getCountSQL(sql);
   }
                } catch (Exception e) {
                    e.printStackTrace();
                }
                return null;
            }
        });
   @SuppressWarnings("unchecked")
   public void deleteHotStarAdmin(final String classId, final String detailSystemId) {
      hotStarDao.excute(new HibernateCallback() {
         public Object doInHibernate(Session session) throws HibernateException {
            try {
    }
               List<SuperHotStar> list = session
                     .createQuery("from SuperHotStar vb where vb.hotStar.id=? and vb.detailSystem.id=?")
                     .setParameter(0, classId).setParameter(1, detailSystemId).list();
               if (list != null && list.size() > 0) {
                  session.getTransaction().begin();
                  for (SuperHotStar vb : list)
                     session.delete(vb);
                  session.flush();
                  session.getTransaction().commit();
               }
    /**
     * 明星
     */
            } catch (Exception e) {
               e.printStackTrace();
            }
            return null;
         }
      });
    public List<HotStar> getHotStarList(String detailSystem) {
   }
        return hotStarDao.list("select hs.hotStar FROM SuperHotStar hs where hs.detailSystem.id=" + detailSystem
                + " order by hs.hotStar.orderby desc");
    }
   /**
    * 明星
    */
    public List<SuperHotStar> getSuperHotStarList(String detailSystem) {
        return superHotStarDao.list(
                "FROM SuperHotStar hs where hs.detailSystem.id=" + detailSystem + " order by hs.hotStar.orderby desc");
    }
   public List<HotStar> getHotStarList(String detailSystem) {
    public void addSuperHotStar(SuperHotStar sv) {
        List<SuperHotStar> list = superHotStarDao.list("from SuperHotStar sv where sv.hotStar.id="
                + sv.getHotStar().getId() + " and sv.detailSystem.id=" + sv.getDetailSystem().getId());
        if (list != null && list.size() > 0)
            return;
        superHotStarDao.create(sv);
    }
      return hotStarDao.list("select hs.hotStar FROM SuperHotStar hs where hs.detailSystem.id=" + detailSystem
            + " order by hs.hotStar.orderby desc");
   }
    public void updateSuperHotStar(SuperHotStar hotSearch) {
        superHotStarDao.update(hotSearch);
    }
   public List<SuperHotStar> getSuperHotStarList(String detailSystem) {
      return superHotStarDao.list(
            "FROM SuperHotStar hs where hs.detailSystem.id=" + detailSystem + " order by hs.hotStar.orderby desc");
   }
    public void deleteSuperHotStar(SuperHotStar hotSearch) {
        superHotStarDao.delete(hotSearch);
    }
   public void addSuperHotStar(SuperHotStar sv) {
      List<SuperHotStar> list = superHotStarDao.list("from SuperHotStar sv where sv.hotStar.id="
            + sv.getHotStar().getId() + " and sv.detailSystem.id=" + sv.getDetailSystem().getId());
      if (list != null && list.size() > 0)
         return;
      superHotStarDao.create(sv);
   }
    @SuppressWarnings("unchecked")
    public void updateSuperHotStarList(final String detailSystemId, final List<SuperHotStar> typeList) {
        hotStarDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
                    List<SuperHotStar> list = session
                            .createQuery("from SuperHotStar sh where sh.detailSystem.id=" + detailSystemId).list();
                    session.getTransaction().begin();
                    for (SuperHotStar ad : list) {
                        session.delete(ad);
                    }
   public void updateSuperHotStar(SuperHotStar hotSearch) {
      superHotStarDao.update(hotSearch);
   }
                    for (SuperHotStar videoType : typeList) {
                        session.persist(videoType);
                    }
                    session.flush();
                    session.getTransaction().commit();
                } catch (Exception e) {
                    e.printStackTrace();
                    session.getTransaction().rollback();
                }
                return null;
            }
        });
   public void deleteSuperHotStar(SuperHotStar hotSearch) {
      superHotStarDao.delete(hotSearch);
   }
    }
   @SuppressWarnings("unchecked")
   public void updateSuperHotStarList(final String detailSystemId, final List<SuperHotStar> typeList) {
      hotStarDao.excute(new HibernateCallback() {
         public Object doInHibernate(Session session) throws HibernateException {
            try {
               List<SuperHotStar> list = session
                     .createQuery("from SuperHotStar sh where sh.detailSystem.id=" + detailSystemId).list();
               session.getTransaction().begin();
               for (SuperHotStar ad : list) {
                  session.delete(ad);
               }
               for (SuperHotStar videoType : typeList) {
                  session.persist(videoType);
               }
               session.flush();
               session.getTransaction().commit();
            } catch (Exception e) {
               e.printStackTrace();
               session.getTransaction().rollback();
            }
            return null;
         }
      });
   }
   @Cacheable(value = "foundCache", key = "'getHotStarOnMain'+'-'+#detailSystemId")
   public List<HotStar> getHotStarOnMain(String detailSystemId) {
      return hotStarDao.list("select hs.hotStar FROM SuperHotStar hs where hs.detailSystem.id=" + detailSystemId
            + " order by hs.hotStar.orderby desc", 0, 3, null);
   }
    @Cacheable(value = "foundCache", key = "'getHotStarOnMain'+'-'+#detailSystemId")
    public List<HotStar> getHotStarOnMain(String detailSystemId) {
        return hotStarDao.list("select hs.hotStar FROM SuperHotStar hs where hs.detailSystem.id=" + detailSystemId
                + " order by hs.hotStar.orderby desc", 0, 3, null);
    }
}