public String listAjax() { KlShoppingCarthistoryQuery query = newQuery(KlShoppingCarthistoryQuery.class, DEFAULT_SORT_COLUMNS); String sort = this.getRequest().getParameter("sort"); if (StringUtils.isNotEmpty(sort)) query.setSortColumns(sort); Page page = klShoppingCarthistoryManager.findPage(query); Map map = new HashMap(); map.put("total", page.getTotalCount()); map.put("rows", page.getResult()); return writeAjaxResponse(Json.toJson(map)); }
/** 执行搜索 */ public String list() { KlShoppingCarthistoryQuery query = newQuery(KlShoppingCarthistoryQuery.class, DEFAULT_SORT_COLUMNS); String sort = this.getRequest().getParameter("sort"); if (StringUtils.isNotEmpty(sort)) query.setSortColumns(sort); Page page = klShoppingCarthistoryManager.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; } }