@RequestMapping(value = "/list", method = RequestMethod.GET)
  public String searchByList(HttpServletRequest request, Model model) throws Exception {
    int rowsPerPage = 10;
    List<Maintance> list = maintanceService.queryMaintance("from " + Maintance.class.getName());
    int totalCount = list.size();
    if (totalCount > rowsPerPage) {
      list = list.subList(0, rowsPerPage - 1);
    }
    model.addAttribute("maintanceList", list);

    int currentPageNum = 1;

    Pagination pagination = new Pagination();
    pagination.setCurrentPageNum(currentPageNum);
    pagination.setTotalCount(totalCount);
    pagination.setRowsPerPage(rowsPerPage);
    pagination.setTotalPageNum(totalCount / rowsPerPage + 1);
    doList(model, pagination);
    return "maintance/list"; //  返回到页面
  }
  @RequestMapping(value = "/list", method = RequestMethod.POST)
  public String search(HttpServletRequest request, Model model) throws Exception {
    String maintanceId = request.getParameter("maintanceId");
    String condition = "";
    //        buyId = "1077852873274";
    if (StringUtils.isNotEmpty(maintanceId)) {
      //   build Condition
      condition = "  maintanceId='" + maintanceId + "'";
    }

    int currentPageNum = 1;
    try {
      currentPageNum = Integer.parseInt(request.getParameter("pageNum"));
    } catch (Exception ex) {

    }

    int rowsPerPage = 10;
    try {
      rowsPerPage = Integer.parseInt(request.getParameter("numPerPage"));
    } catch (Exception ex) {

    }

    int totalCount = maintanceService.getTotalCount();
    List<Maintance> list =
        maintanceService.queryByPagination((currentPageNum - 1) * rowsPerPage, rowsPerPage);
    model.addAttribute("maintanceId", maintanceId);
    model.addAttribute("maintanceList", list);

    Pagination pagination = new Pagination();
    pagination.setCurrentPageNum(currentPageNum);
    pagination.setTotalCount(totalCount);
    pagination.setRowsPerPage(rowsPerPage);
    pagination.setTotalPageNum(totalCount / rowsPerPage + 1);

    doList(model, pagination);
    return "maintance/list"; //  返回到页面
  }