zoukankan      html  css  js  c++  java
  • activity6分页查询,listPage的参数

    在这里插入图片描述
    源码:

    /**
     * Describes basic methods for querying.
     * 
     * @author Frederik Heremans
     */
    public interface Query<T extends Query<?, ?>, U extends Object> {
    
      /**
       * Order the results ascending on the given property as defined in this class (needs to come after a call to one of the orderByXxxx methods).
       */
      T asc();
    
      /**
       * Order the results descending on the given property as defined in this class (needs to come after a call to one of the orderByXxxx methods).
       */
      T desc();
    
      /** Executes the query and returns the number of results */
      long count();
    
      /**
       * Executes the query and returns the resulting entity or null if no entity matches the query criteria.
       * 
       * @throws ActivitiException
       *           when the query results in more than one entities.
       */
      U singleResult();
    
      /** Executes the query and get a list of entities as the result. */
      List<U> list();
    
      /** Executes the query and get a list of entities as the result. */
      List<U> listPage(int firstResult, int maxResults);
    }
    

    firstResult指的是第一条,并不是第几页,
    第几条就像mysql分页一样,重0开始,maxResults就像pageSize,重0开始往后第10条.
    第二页则是(2-1)*10 ,10 就是重第十条开始,往后第十条.
    所以应该写为:(pageNum - 1) * pageSize, pageSize

    世界上所有的不公平都是由于当事人能力不足造成的.
  • 相关阅读:
    上传文件过大的问题FileUploadBase$SizeLimitExceededException
    Oracle分页2
    详解struts2中struts.properties
    Oracle 分页
    Xcode常见错误以及解决方案
    设置时间格式
    UIScrollView解决touchesBegan等方法不能触发的解方案
    ViewController 之间设置转场动画
    IQKeyboredManager使用
    SVN
  • 原文地址:https://www.cnblogs.com/javayida/p/13346802.html
Copyright © 2011-2022 走看看