public String listAjax() { CmsRequestlogQuery query = newQuery(CmsRequestlogQuery.class, DEFAULT_SORT_COLUMNS); String sort = this.getRequest().getParameter("sort"); if (StringUtils.isNotEmpty(sort)) query.setSortColumns(sort); Page page = cmsRequestlogManager.findPage(query); Map map = new HashMap(); map.put("total", page.getTotalCount()); map.put("rows", page.getResult()); return writeAjaxResponse(Json.toJson(map)); }
/** 执行搜索 */ public String list() { CmsRequestlogQuery query = newQuery(CmsRequestlogQuery.class, DEFAULT_SORT_COLUMNS); String sort = this.getRequest().getParameter("sort"); if (StringUtils.isNotEmpty(sort)) query.setSortColumns(sort); Page page = cmsRequestlogManager.findPage(query); if ("ajax".equalsIgnoreCase(Utils.getParam(getRequest(), "ajax"))) { Map map = new HashMap(); map.put("pg", page); return writeAjaxResponse(Json.toJson(map)); } else { this.getRequest().setAttribute("pg", page); return LIST_JSP; } }