日期:2014-05-20 浏览次数:20873 次
/** * 总排行榜 * @return List类型,原本是ArrayList型,元素是包含项目序号和名称的ArrayList型 */ public List getZong() { ArrayList alist = new ArrayList(); org.hibernate.Session s = HibernateSessionFactory.currentSession(); String hql = "select count(x.xmh),x,m from Xzb x,Xmb m where x.xmh=m.xh and m.sc=0 group by x.xmh order by col_0_0_ desc"; org.hibernate.Query query = s.createQuery(hql); query.setMaxResults(7); List list = query.list(); Object[] o = null; for (Iterator its = list.iterator(); its.hasNext(); ) { o = (Object[])its.next(); Xzb xzb = (Xzb)o[1]; ArrayList tmplist = new ArrayList(); Xmb xmb = xzb.getXmh(); tmplist.add(xmb.getXh()); tmplist.add(xmb.getXmm()); int count = ((Integer)o[0]).intValue(); //int count = ((Long)o[0]).intValue(); tmplist.add(count); alist.add(tmplist); } HibernateSessionFactory.closeSession(); return alist; }