@Override
	public List<Article> getAllArticleByPage(int totle, int page,String tag) {
		String hql ;
		if(totle==0){
			totle = ArticleDaoImpl.totle;
		}
		if(null==tag||"".equals(tag)){
		 hql = "from Article article  order by create_tm ";
		}else{
		 hql = "from Article where id in  (:idlist)    order by create_tm ";
		}
		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);
		}
		query.setFirstResult(totle*page);
		query.setMaxResults(totle);
		List<Article> list =query.list();
		return list;
	}