| | |
| | | } |
| | | |
| | | @SuppressWarnings("unchecked") |
| | | @Cacheable(value = "homeCache", key = "'getHomeType'+'-'+#detailSystem+'-'+#cacheMd5+'-'+#maxNumber+'-'+#vtid") |
| | | @Cacheable(value = "homeCache", key = "'getHomeType'+'-'+#detailSystem+'-'+#cacheMd5+'-'+#maxNumber+'-'+#dataKey") |
| | | public List<HomeType> getHomeType(final String detailSystem, final List<Long> resourceIds, String cacheMd5, |
| | | final int maxNumber, final long vtid) { |
| | | final int maxNumber, final String dataKey) { |
| | | List<HomeType> homeTypeList = (List<HomeType>) homeTypeDao.excute(new HibernateCallback<List<HomeType>>() { |
| | | public List<HomeType> doInHibernate(Session session) throws HibernateException { |
| | | |
| | |
| | | resourceWhere = resourceWhere.substring(0, resourceWhere.length() - 2); |
| | | List resultList = session |
| | | .createSQLQuery( |
| | | "SELECT ht.`id` as htid,ht.`name` as htname,ht.`columns` as htcolumns ,ht.`hasmore`,ht.`activity` ,ht.`params` ,ht.`ioscontrol`,ht.number,hvideo.id as hvid,hvideo.`videoid` AS hvvideoid,hvideo.`picture`as hvpicture ,hvideo.`tag` as hvtag, v.`id` as vid ,v.`picture` as vpicture ,v.`name` as vname ,v.`tag` as vtag ,v.`hpicture` as vhpicture ,v.`latest_hpicture` as vlatest_hpicture ,v.`watchcount` as vwatchcount,v.commentcount,ht.icon as hicon,ht.orderby as htorder,hvideo.orderby as hvorder FROM (SELECT hv.* FROM `wk_resource_video` rv LEFT JOIN `wk_video_homevideo` hv ON rv.`videoid` =hv.`videoid` LEFT JOIN `wk_video_video` v ON v.`id` =hv.`videoid` LEFT JOIN `wk_video_banquan_video` bv ON bv.`videoid`=hv.`videoid` AND bv.`detailsystemid`=" |
| | | "SELECT ht.`id` as htid,ht.`name` as htname,ht.`columns` as htcolumns ,ht.`hasmore`,ht.`activity` ,ht.`params` ,ht.`ioscontrol`,ht.number,hvideo.id as hvid,hvideo.`videoid` AS hvvideoid,hvideo.`picture`as hvpicture ,hvideo.`tag` as hvtag, v.`id` as vid ,v.`picture` as vpicture ,v.`name` as vname ,v.`tag` as vtag ,v.`hpicture` as vhpicture ,v.`latest_hpicture` as vlatest_hpicture ,v.`watchcount` as vwatchcount,v.commentcount,ht.icon as hicon,ht.orderby as htorder,hvideo.orderby as hvorder,need_ad FROM (SELECT hv.* FROM `wk_resource_video` rv LEFT JOIN `wk_video_homevideo` hv ON rv.`videoid` =hv.`videoid` LEFT JOIN `wk_video_video` v ON v.`id` =hv.`videoid` LEFT JOIN `wk_video_banquan_video` bv ON bv.`videoid`=hv.`videoid` AND bv.`detailsystemid`=" |
| | | + detailSystem |
| | | + " AND bv.`show`=1 LEFT JOIN `wk_video_hometype` ht ON ht.id=hv.hometype WHERE (hv.`id`>0 AND v.`show` =1 AND ht.vtid='" |
| | | + vtid + "' AND (" + resourceWhere |
| | | + " AND bv.`show`=1 LEFT JOIN `wk_video_hometype` ht ON ht.id=hv.hometype WHERE (hv.`id`>0 AND v.`show` =1 AND ht.special_data_key='" |
| | | + dataKey + "' AND (" + resourceWhere |
| | | + " ) AND bv.`videoid` IS NULL ) GROUP BY (hv.`id`) ORDER BY hv.`orderby` desc,v.createtime DESC ) hvideo LEFT JOIN `wk_video_super_hometype` sht ON sht.`hometypeid`=hvideo.hometype LEFT JOIN `wk_video_hometype` ht ON sht.`hometypeid` =ht.`id` LEFT JOIN wk_video_video v ON v.`id`=hvideo.videoid WHERE sht.`detailsystemid` =" + detailSystem + " ORDER BY hvideo.`orderby` DESC,v.orderby desc,v.updatetime desc") |
| | | .list(); |
| | | List<HomeType> homeTypeList = new ArrayList<>(); |
| | |
| | | ht.setNumber(Integer.parseInt(obj[7] + "")); |
| | | |
| | | ht.setOrderby(obj[21] + ""); |
| | | ht.setNeedAd(Boolean.parseBoolean(obj[23] + "")); |
| | | |
| | | HomeVideo hv = new HomeVideo(); |
| | | hv.setId(obj[8] + ""); |
| | |
| | | */ |
| | | |
| | | @SuppressWarnings("unchecked") |
| | | public List<HomeTypeAdmin> getHomeTypeAdmin(final String key, final String systemId, final int detailSystem, final int page) { |
| | | public List<HomeTypeAdmin> getHomeTypeAdmin(final String key, final String systemId, final String dataKey, final int detailSystem, final int page) { |
| | | |
| | | return (List<HomeTypeAdmin>) homeTypeDao.excute(new HibernateCallback<List<HomeTypeAdmin>>() { |
| | | public List<HomeTypeAdmin> doInHibernate(Session session) throws HibernateException { |
| | |
| | | try { |
| | | List<DetailSystem> detailSystemList = session.createQuery("from DetailSystem ds where ds.system.id=" + systemId).list(); |
| | | String sql = ""; |
| | | if (detailSystem > 0) |
| | | sql = "select sh.homeType from SuperHomeType sh where sh.homeType.name like ? and sh.detailSystem.id=" |
| | | + detailSystem + " order by sh.homeType.orderby desc"; |
| | | else |
| | | sql = "from HomeType zb where zb.name like ? and zb.system.id=" + systemId + " order by zb.orderby desc"; |
| | | |
| | | List<String> andList = new ArrayList<>(); |
| | | if (detailSystem > 0) { |
| | | andList.add("sh.homeType.name like ?"); |
| | | andList.add("sh.detailSystem.id=" + detailSystem); |
| | | if (dataKey != null) { |
| | | andList.add("sh.homeType.specialDataKey='" + dataKey+"'"); |
| | | } |
| | | sql = "select sh.homeType from SuperHomeType sh where " + org.yeshi.utils.StringUtil.concat(andList, " and ") + " order by sh.homeType.orderby desc"; |
| | | } else { |
| | | andList.add("zb.name like ?"); |
| | | andList.add("zb.system.id=" + systemId); |
| | | if (dataKey != null) { |
| | | andList.add("zb.specialDataKey='" + dataKey+"'"); |
| | | } |
| | | sql = "from HomeType zb where " + org.yeshi.utils.StringUtil.concat(andList, " and ") + " order by zb.orderby desc"; |
| | | } |
| | | List<HomeType> list = session.createQuery(sql).setParameter(0, "%" + key + "%") |
| | | .setFirstResult((page - 1) * Constant.pageCount).setMaxResults(Constant.pageCount).list(); |
| | | for (HomeType vb : list) { |
| | |
| | | |
| | | } |
| | | |
| | | public long getHomeTypeAdminCount(String key, String systemId, int detailSystem) { |
| | | String sql = ""; |
| | | if (detailSystem > 0) |
| | | sql = "select count(*) from (select count(*) from wk_video_super_hometype zb left join wk_video_hometype c on c.id=zb.hometypeid where zb.detailsystemid=" |
| | | + detailSystem + " and c.name like '%" + key + "%' group by zb.hometypeid) s"; |
| | | else |
| | | sql = "select count(*) from (select count(*) from wk_video_super_hometype zb left join wk_video_hometype c on c.id=zb.hometypeid where c.name like '%" |
| | | + key + "%' and c.system=" + systemId + " group by zb.hometypeid) s"; |
| | | public long getHomeTypeAdminCount(String key, String systemId, int detailSystem, final String dataKey) { |
| | | List<String> andList = new ArrayList<>(); |
| | | |
| | | |
| | | String sql = ""; |
| | | if (detailSystem > 0) { |
| | | andList.add("zb.detailsystemid=" + detailSystem); |
| | | andList.add("c.name like '%" + key + "%'"); |
| | | if (dataKey != null) { |
| | | andList.add("c.special_data_key='" + dataKey + "'"); |
| | | } |
| | | |
| | | sql = "select count(*) from (select count(*) from wk_video_super_hometype zb left join wk_video_hometype c on c.id=zb.hometypeid where " + org.yeshi.utils.StringUtil.concat(andList, " and ") + " group by zb.hometypeid) s"; |
| | | |
| | | |
| | | } else { |
| | | |
| | | andList.add("c.name like '%" + key + "%'"); |
| | | andList.add("c.system=" + systemId); |
| | | if (dataKey != null) { |
| | | andList.add("c.special_data_key='" + dataKey + "'"); |
| | | } |
| | | |
| | | sql = "select count(*) from (select count(*) from wk_video_super_hometype zb left join wk_video_hometype c on c.id=zb.hometypeid where " + org.yeshi.utils.StringUtil.concat(andList, " and ") + " group by zb.hometypeid) s"; |
| | | } |
| | | return homeTypeDao.getCountSQL(sql); |
| | | } |
| | | |