コード例 #1
0
  public void queryKey() throws ServletException, IOException {
    GridServerHandler gridServerHandler =
        new GridServerHandler(Struts2Utils.getRequest(), Struts2Utils.getResponse());
    SortInfo si = gridServerHandler.getSingleSortInfo();
    if (si != null) {
      String order = si.getSortOrder();
      if ("defaultsort".equals(order)) {
        page.setOrder("desc");
        page.setOrderBy("fullDate");
      } else {
        page.setOrder(order);
        page.setOrderBy(MantoEyeUtils.getSortField(si.getFieldName()));
      }
      // 默认排序方式
    } else {
      page.setOrderBy("fullDate");
      page.setOrder("desc");
    }

    page.setPageSize(gridServerHandler.getPageSize());
    page.setPageNo(gridServerHandler.getPageInfo().getPageNum());
    page = keywordsTacticsImpl.queryKey(page, id, startTime, endTime);

    int totalRowNum = gridServerHandler.getTotalRowNum();
    if (totalRowNum < 1) {
      totalRowNum = page.getTotalCount();
      gridServerHandler.setTotalRowNum(totalRowNum);
    }
    gridServerHandler.setData(page.getResult(), KeywordsDetail.class);
    Struts2Utils.renderJson(gridServerHandler.getLoadResponseText());
  }
  /** 查询数据 */
  public void query() throws ServletException, IOException {
    List<CommonFlush> list = null;
    GridServerHandler gridServerHandler =
        new GridServerHandler(Struts2Utils.getRequest(), Struts2Utils.getResponse());
    SortInfo si = gridServerHandler.getSingleSortInfo();
    if (si != null) {
      String order = si.getSortOrder();
      if ("defaultsort".equals(order)) {
        page.setOrder("desc");
        page.setOrderBy("nmFlush");
      } else {
        page.setOrder(order);
        page.setOrderBy(MantoEyeUtils.getSortField(si.getFieldName()));
      }
      // 默认排序方式
    } else {
      page.setOrderBy("nmFlush");
      page.setOrder("desc");
    }
    page.setPageSize(gridServerHandler.getPageSize());
    page.setPageNo(gridServerHandler.getPageInfo().getPageNum());

    page =
        spaceDistributeBusinessManager.query(
            page,
            Integer.parseInt(dataType_search),
            Common.StringToInt(spaceLevel_search),
            businessName,
            Integer.parseInt(timeLevel_search),
            time_search);

    int totalRowNum = gridServerHandler.getTotalRowNum();
    if (totalRowNum < 1) {
      totalRowNum = page.getTotalCount();
      gridServerHandler.setTotalRowNum(totalRowNum);
    }
    list = page.getResult();
    gridServerHandler.setData(list, CommonFlush.class);
    Struts2Utils.renderJson(gridServerHandler.getLoadResponseText());
  }