public void query() throws ServletException, IOException { HttpServletRequest request = Struts2Utils.getRequest(); List<TbBaseUserInfo> list = null; List<PropertyFilter> filters = HibernateWebUtils.buildPropertyFilters(Struts2Utils.getRequest()); GridServerHandler gridServerHandler = new GridServerHandler(Struts2Utils.getRequest(), Struts2Utils.getResponse()); // 角色查询 String vcRoleNo = request.getParameter("role_search"); if (vcRoleNo != null && !vcRoleNo.equals("")) { String vcUserNos = baseUserInfoManager.getUserIdByRoleId(vcRoleNo); String[] vun = vcUserNos.split(","); filters.add(new PropertyFilter("id", vun, MatchType.IN)); } page.setOrderBy("id"); page.setOrder("desc"); page.setPageSize(gridServerHandler.getPageSize()); page.setPageNo(gridServerHandler.getPageInfo().getPageNum()); page = baseUserInfoManager.search(page, filters); int totalRowNum = gridServerHandler.getTotalRowNum(); if (totalRowNum < 1) { totalRowNum = page.getTotalCount(); gridServerHandler.setTotalRowNum(totalRowNum); } list = page.getResult(); gridServerHandler.setData(this.formatViewData(list)); Struts2Utils.renderJson(gridServerHandler.getLoadResponseText()); }
/** * 分页查询数据 * * @throws ServiceStartupException */ public void setPaginationdataList() throws ServiceStartupException { HttpServletRequest request = Struts2Utils.getRequest(); List<PropertyFilter> filters = HibernateWebUtils.buildPropertyFilters(request); // 如果选择按角色查询条件,则设置角色的过滤 String vcRoleNo = request.getParameter("vcRoleNo2"); if (vcRoleNo != null && !vcRoleNo.equals("")) { String vcUserNos = baseUserInfoManager.getUserIdByRoleId(vcRoleNo); String[] vun = vcUserNos.split(","); filters.add(new PropertyFilter("id", vun, MatchType.IN)); } if (page.getOrderBy() == null) { page.setOrderBy("id"); } page = baseUserInfoManager.search(page, filters); List dataList = page.getVresult(); request.setAttribute("dataList", dataList); }