From 0a18a8cb0a7a57bf1f82df425251334c57f8c39a Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期六, 23 一月 2021 15:40:37 +0800 Subject: [PATCH] 新增手机号/qq/微信绑定 --- src/main/java/com/yeshi/buwan/service/imp/StarService.java | 590 +++++++++++++++++++++++++++++----------------------------- 1 files changed, 298 insertions(+), 292 deletions(-) diff --git a/src/main/java/com/yeshi/buwan/service/imp/StarService.java b/src/main/java/com/yeshi/buwan/service/imp/StarService.java index 88106d9..65d56a5 100644 --- a/src/main/java/com/yeshi/buwan/service/imp/StarService.java +++ b/src/main/java/com/yeshi/buwan/service/imp/StarService.java @@ -11,6 +11,7 @@ import javax.annotation.Resource; +import com.yeshi.buwan.service.inter.VideoResourceMapExtraInfoService; import org.hibernate.HibernateException; import org.hibernate.Session; import org.springframework.cache.annotation.Cacheable; @@ -33,356 +34,361 @@ @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; - } + @Resource + private VideoResourceMapExtraInfoService videoResourceMapExtraInfoService; - public void setSuperHotStarDao(SuperHotStarDao superHotStarDao) { - this.superHotStarDao = superHotStarDao; - } + public SuperHotStarDao getSuperHotStarDao() { + return superHotStarDao; + } - public VideoInfoDao getVideoInfoDao() { - return videoInfoDao; - } + public void setSuperHotStarDao(SuperHotStarDao superHotStarDao) { + this.superHotStarDao = superHotStarDao; + } - public void setVideoInfoDao(VideoInfoDao videoInfoDao) { - this.videoInfoDao = videoInfoDao; - } + public VideoInfoDao getVideoInfoDao() { + return videoInfoDao; + } - public HotStarDao getHotStarDao() { - return hotStarDao; - } + public void setVideoInfoDao(VideoInfoDao videoInfoDao) { + this.videoInfoDao = videoInfoDao; + } - public void setHotStarDao(HotStarDao hotStarDao) { - this.hotStarDao = hotStarDao; - } + public HotStarDao getHotStarDao() { + return hotStarDao; + } - public StarService() { + public void setHotStarDao(HotStarDao hotStarDao) { + this.hotStarDao = hotStarDao; + } - } + public StarService() { - @Cacheable(value = "classCache", key = "'getHotStarList'+'-'+#page+'-'+#pageCount") - public List<HotStar> getHotStarList(int page, int pageCount) { + } - List<HotStar> list = hotStarDao.list("from HotStar h order by h.orderby desc,h.createtime desc", - (page - 1) * pageCount, pageCount, new String[] {}); - return list; - } + @Cacheable(value = "classCache", key = "'getHotStarList'+'-'+#page+'-'+#pageCount") + public List<HotStar> getHotStarList(int page, int pageCount) { - 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; - } + List<HotStar> list = hotStarDao.list("from HotStar h order by h.orderby desc,h.createtime desc", + (page - 1) * pageCount, pageCount, new String[]{}); + return list; + } - @Cacheable(value = "classCache", key = "'getHotStarDetail'+'-'+#id") - public HotStar getHotStarDetail(String id) { + 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.find(HotStar.class, id); - } + @Cacheable(value = "classCache", key = "'getHotStarDetail'+'-'+#id") + public HotStar getHotStarDetail(String id) { - public long getHotStarCount() { + return hotStarDao.find(HotStar.class, id); + } - return hotStarDao.getCount("select count(*) from HotStar"); - } + public long getHotStarCount() { - public long getHotStarCount(String detailSystem) { + return hotStarDao.getCount("select count(*) from HotStar"); + } - return hotStarDao.getCount("select count(*) from SuperHotStar s where s.detailSystem.id=?", - new String[] { detailSystem }); - } + public long getHotStarCount(String detailSystem) { - public List<VideoInfo> getHotStarVideo(String starId, int page) { + return hotStarDao.getCount("select count(*) from SuperHotStar s where s.detailSystem.id=?", + new String[]{detailSystem}); + } - 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 List<VideoInfo> getHotStarVideo(String starId, int page) { - public long getHotStarVideoCount(String starId) { + 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; + } - 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 long getHotStarVideoCount(String starId) { - public List<HotStar> getStarList() { - return hotStarDao.list("from HotStar h order by h.orderby DESC"); - } + 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 getStar(String id) { - if (!StringUtil.isNullOrEmpty(id)) { - return (HotStar) hotStarDao.find(HotStar.class, id); - } else { - return null; - } - } + public List<HotStar> getStarList() { + return hotStarDao.list("from HotStar h order by h.orderby DESC"); + } - 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; - } + public HotStar getStar(String id) { + if (!StringUtil.isNullOrEmpty(id)) { + return (HotStar) hotStarDao.find(HotStar.class, id); + } else { + return null; + } + } - 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 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; + } - 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 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 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; + } + }); - @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); + } + } - 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; - } + @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 = "'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); - } + 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(); + } - @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 = videoResourceMapExtraInfoService.batchExtraInfo(list, resourceList); + 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, int detailSystem, int page) { - key = StringUtil.isNullOrEmpty(key) ? "" : key; - List<HotStarAdmin> zhiBoClassList = new ArrayList<HotStarAdmin>(); + } catch (Exception e) { + e.printStackTrace(); + } + return count; + } - 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"; + 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<>(); - List<DetailSystemSelect> dssList = new ArrayList<DetailSystemSelect>(); + 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<>(); - } 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, 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 + "%' 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); + } - @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); - } + 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); + } } -- Gitblit v1.8.0