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

    世界上所有的不公平都是由于当事人能力不足造成的.
  • 相关阅读:
    软件工程个人作业1
    构建之法问题以及阅读计划
    软件工程概论课后作业1
    动手动脑7补
    学习进度条06
    软件工程课堂测试07(结对开发)
    团队介绍
    软件工程结对作业02(借鉴版)
    软件工程结对作业02(原创版)
    构建之法阅读笔记06
  • 原文地址:https://www.cnblogs.com/javayida/p/13346802.html
Copyright © 2011-2022 走看看