@Override
	public Integer getTotlePages(String tag) {
		String hql = "from Article ";
		if(null==tag||"".equals(tag)){
			 hql = "from Article ";
			}else{
			 hql = "from Article where id in  (:idlist)  ";
			}
		Query query = null;
		if(null!=tag&&!"".equals(tag)){
			List<Integer> re = (List<Integer>) sessionFactory.getCurrentSession().createSQLQuery("select article_id from tag  where tag = '"+tag+"'").list();
			query = sessionFactory.getCurrentSession().createQuery(hql);
			List<String> rs = new ArrayList<String>();
			for (int i = 0; i < re.size(); i++) {
				rs.add(String.valueOf(re.get(i)));
			}
			query.setParameterList("idlist", rs);
		}else{
			query = sessionFactory.getCurrentSession().createQuery(hql);
		}
		int totleAll = query.list().size();
		return totleAll%totle==0?totleAll/totle:totleAll/totle+1;
	}