// 管理 查询
  public String manageKbDiseaseFull() {
    log.info("exec action method:manageKbDiseaseFull");

    //      分页查询
    if (pageNo <= 0) {
      pageNo = 1;
    }
    page.setTotalCount(kbDiseaseService.countKbDiseaseRow());
    if (page.getTotalpage() < pageNo) {
      pageNo = page.getTotalpage();
    }
    page.setPageNo(pageNo);

    if (page.getTotalCount() != 0) {
      kbDiseaseFullList = kbDiseaseService.selectKbDiseaseFullByConditionAndPage("", page);
    }

    kbkeshiList = kbkeshiService.selectKbkeshiByCondition("");

    System.out.println("kbkeshiList:" + kbkeshiList.size());
    if (kbkeshiList == null) {
      kbkeshiList = new ArrayList<Kbkeshi>();
    }
    if (kbDiseaseFullList == null) {
      kbDiseaseFullList = new ArrayList<KbDiseaseFull>();
    }
    //      for(int i = 0; i < computerhomeworkFullList.size(); i++){
    //      	System.out.println("id=");
    //      }
    if (callType != null && callType.equals("ajaxType")) {
      return "success2";
    } else {
      return "success1";
    }
  }
Esempio n. 2
0
 /**
  * Split the root page if necessary.
  *
  * @param p the page
  * @param writeVersion the write version
  * @return the new sibling
  */
 protected Page splitRootIfNeeded(Page p, long writeVersion) {
   if (p.getMemory() <= store.getPageSize() || p.getKeyCount() <= 1) {
     return p;
   }
   int at = p.getKeyCount() / 2;
   long totalCount = p.getTotalCount();
   Object k = p.getKey(at);
   Page split = p.split(at);
   Object[] keys = {k};
   long[] children = {p.getPos(), split.getPos()};
   Page[] childrenPages = {p, split};
   long[] counts = {p.getTotalCount(), split.getTotalCount()};
   p =
       Page.create(
           this, writeVersion, 1, keys, null, children, childrenPages, counts, totalCount, 0, 0);
   store.registerUnsavedPage();
   return p;
 }
Esempio n. 3
0
 /**
  * Remove a key-value pair.
  *
  * @param p the page (may not be null)
  * @param writeVersion the write version
  * @param key the key
  * @return the old value, or null if the key did not exist
  */
 protected Object remove(Page p, long writeVersion, Object key) {
   int index = p.binarySearch(key);
   Object result = null;
   if (p.isLeaf()) {
     if (index >= 0) {
       result = p.getValue(index);
       p.remove(index);
       if (p.getKeyCount() == 0) {
         removePage(p.getPos());
       }
     }
     return result;
   }
   // node
   if (index < 0) {
     index = -index - 1;
   } else {
     index++;
   }
   Page cOld = p.getChildPage(index);
   Page c = copyOnWrite(cOld, writeVersion);
   result = remove(c, writeVersion, key);
   if (result == null) {
     return null;
   }
   if (c.getTotalCount() == 0) {
     // this child was deleted
     if (p.getKeyCount() == 0) {
       p.setChild(index, c);
       p.setCounts(index, c);
       removePage(p.getPos());
     } else {
       p.remove(index);
     }
   } else {
     p.setChild(index, c);
     p.setCounts(index, c);
   }
   return result;
 }
Esempio n. 4
0
 public long getSize() {
   checkOpen();
   return root.getTotalCount();
 }
Esempio n. 5
0
  private void hander() {
    if (this.href.indexOf("?") < 0) {
      this.href += "?";
    }
    if ((this.href.endsWith("?")) || (this.href.endsWith("&amp;"))) this.href += "pageIndex=";
    else {
      this.href += "&amp;pageIndex=";
    }
    Page pageList = (Page) this.pageContext.getRequest().getAttribute(this.data);
    if (pageList != null) {
      StringBuffer page = new StringBuffer();
      int pageNumber = Integer.valueOf(pageList.getPageIndex()).intValue();
      int totalPage = Integer.valueOf(pageList.getTotalPage()).intValue();
      int totalRow = Integer.valueOf(pageList.getTotalCount()).intValue();
      int startPage = pageNumber - 4;
      int endPage = pageNumber + 4;

      if (totalRow == 0) {
        pageNumber = 0;
      }

      if (startPage < 1) {
        startPage = 1;
      }

      if (endPage > totalPage) {
        endPage = totalPage;
      }

      if (pageNumber <= 8) {
        startPage = 1;
      }
      if (totalPage - pageNumber < 8) {
        endPage = totalPage;
      }

      page.append(
          "<div class=\"pagin  \"><div class=\"message\">共<i class=\"blue\">"
              + totalRow
              + "</i>条记录,当前显示第&nbsp;<i class=\"blue\">"
              + pageNumber
              + "&nbsp;</i>页</div><ul class=\"paginList\">");

      if (pageNumber <= 1) {
        page.append(
            "<li class=\"paginItem\"><a href=\"javascript:;\"><span  class=\"pagepre\"></span></a></li>");
      }
      if (pageNumber > 1) {
        page.append(
            "<li class=\"paginItem\" ><a href=\""
                + this.href
                + (pageNumber - 1)
                + " \"><span  class=\"pagepre\"></span></a></li>");
      }
      if (pageNumber > 8) {
        page.append("<li class=\"paginItem\" ><a href=\"" + this.href + "1 \">1</a></li>")
            .append("<li class=\"paginItem\" ><a href=\"" + this.href + "2 \">2</a></li>")
            .append("<li class=\"paginItem more\"> <a href='#'>...</a></li>");
      }

      for (int i = startPage; i <= endPage; i++) {
        if (pageNumber == i)
          page.append("<li class=\"paginItem current\"><a href='#'>" + i + "</a></li>");
        else {
          page.append(
              "<li class=\"paginItem\"><a href=\"" + this.href + i + " \">" + i + "</a></li>");
        }
      }
      if (totalPage - pageNumber >= 8) {
        page.append("<li class=\"paginItem more\"> <a href='#'>...</a></li>")
            .append(
                "<li class=\"paginItem\"><a href=\""
                    + this.href
                    + (totalPage - 1)
                    + " \">"
                    + (totalPage - 1)
                    + "</a></li>")
            .append(
                "<li class=\"paginItem\"><a href=\""
                    + this.href
                    + totalPage
                    + " \">"
                    + totalPage
                    + "</a></li>");
      }

      if (pageNumber == totalPage)
        page.append("<li class=\"paginItem\"><a href='#'><span class=\"pagenxt\"></span></a></li>");
      else {
        page.append(
            "<li class=\"paginItem\"><a href=\""
                + this.href
                + (pageNumber + 1)
                + " \"><span  class=\"pagenxt\"></span></a></li>");
      }

      page.append("</ul></div>");
      this.output.append(page);
    }
  }