public List getAuthority(TRoleStepDoc bussDoc, PageInfo pageInfo)
throws RuntimeException {
Session session = getHibernateTemplate().getSessionFactory()
.getCurrentSession();
StringBuffer hql = new StringBuffer();
hql
.append("select tc,tr,tb, t from TRolebussdoc t,TBussstep tb,TRole tr ,TCaseType tc ");
hql
.append("where t.roleId=tr.roleId and t.bussId =tb.bussId and t.docType=tc.caseTypeCode ");
if (bussDoc != null) {
String roleId = bussDoc.getRoleId();
if (roleId != null && !"".equals(roleId)) {
hql.append("and t.roleId= '" + roleId + "' ");
}
String busiId = bussDoc.getBussId();
if (busiId != null && !"".equals(busiId)) {
hql.append("and t.bussId= '" + busiId + "' ");
}
String docType = bussDoc.getDocType();
if (docType != null && !"".equals(docType)) {
hql.append("and t.docType= '" + docType + "' ");
}
hql.append("order by tr.roleName,tb.bussName");
}
int pageCount = session.createQuery(hql.toString()).list().size();
pageInfo.setPageCount(String.valueOf(pageCount));
return session.createQuery(hql.toString()).setFirstResult(
Integer.parseInt(pageInfo.getPageBegin())).setMaxResults(
Integer.parseInt(pageInfo.getPageLen())).list();
}