예제 #1
0
  /**
   * json数据,为APP提供数据
   *
   * @param request
   * @param model
   * @param auditlog
   * @return
   * @throws Exception
   */
  @RequestMapping("/list/json")
  public @ResponseBody ReturnDatas listjson(
      HttpServletRequest request, Model model, AuditLog auditlog) throws Exception {
    ReturnDatas returnObject = ReturnDatas.getSuccessReturnDatas();

    Page page = newPage(request);
    page.setOrder("operationTime");
    page.setSort("desc");

    List<AuditLog> datas =
        auditlogService.findListDataByFinder(null, page, AuditLog.class, auditlog);
    returnObject.setQueryBean(auditlog);
    returnObject.setPage(page);
    returnObject.setData(datas);
    return returnObject;
  }
예제 #2
0
  private Page newPage(HttpServletRequest request) {
    // ==获取分页信息
    int pageIndex = NumberUtils.toInt(request.getParameter("pageIndex"), 1);
    String order = request.getParameter("order");
    String sort = request.getParameter("sort");
    if (StringUtils.isBlank(order)) {
      order = "id";
    }
    if (StringUtils.isBlank(sort)) {
      sort = "desc";
    }

    Page page = new Page(pageIndex);
    page.setOrder(order);
    page.setSort(sort);
    return page;
  }