Package cn.org.rapid_framework.page

Examples of cn.org.rapid_framework.page.Page


    return totalCount;
  }

  private Page pageQuery(String sql, Map paramMap, final int totalCount,int pageSize, int pageNumber, RowMapper rowMapper) {
    if(totalCount <= 0) {
      return new Page(pageNumber,pageSize,0);
    }
    Page page = new Page(pageNumber,pageSize,totalCount);
    List list = pageQuery(sql, paramMap,page.getFirstResult(),pageSize,rowMapper);
    page.setResult(list);
    return page;
  }
View Full Code Here


        }
      });
    }
   
    private static Object executeQueryForPage(final PageRequest pageRequest,Query query, Query countQuery) {
      Page page = new Page(pageRequest,((Number)countQuery.uniqueResult()).intValue());
      if(page.getTotalCount() <= 0) {
        page.setResult(new ArrayList(0));
      }else {
        page.setResult(query.setFirstResult(page.getFirstResult()).setMaxResults(page.getPageSize()).list());
      }
      return page;
    }
View Full Code Here

 
  public static Page pageQuery(SqlSessionTemplate sqlSessionTemplate,String statementName,String countStatementName, PageRequest pageRequest) {
   
    Number totalCount = (Number) sqlSessionTemplate.selectOne(countStatementName,pageRequest);
    if(totalCount == null || totalCount.longValue() <= 0) {
      return new Page(pageRequest,0);
    }
   
    Page page = new Page(pageRequest,totalCount.intValue());
   
    //其它分页参数,用于不喜欢或是因为兼容性而不使用方言(Dialect)的分页用户使用. 与getSqlMapClientTemplate().queryForList(statementName, parameterObject)配合使用
    Map filters = new HashMap();
    filters.put("offset", page.getFirstResult());
    filters.put("pageSize", page.getPageSize());
    filters.put("lastRows", page.getFirstResult() + page.getPageSize());
    filters.put("sortColumns", pageRequest.getSortColumns());
   
    Map parameterObject = PropertyUtils.describe(pageRequest);
    filters.putAll(parameterObject);
   
    List list = sqlSessionTemplate.selectList(statementName, filters,page.getFirstResult(),page.getPageSize());
    page.setResult(list);
    return page;
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  public static Page pageQuery(SqlMapClientTemplate sqlMapClientTemplate,String statementName,String countStatementName, PageRequest pageRequest) {
   
    Number totalCount = (Number) sqlMapClientTemplate.queryForObject(countStatementName,pageRequest);
    if(totalCount == null || totalCount.longValue() <= 0) {
      return new Page(pageRequest,0);
    }
   
    Page page = new Page(pageRequest,totalCount.intValue());
   
    //其它分页参数,用于不喜欢或是因为兼容性而不使用方言(Dialect)的分页用户使用. 与getSqlMapClientTemplate().queryForList(statementName, parameterObject)配合使用
    Map otherFilters = new HashMap();
    otherFilters.put("offset", page.getFirstResult());
    otherFilters.put("pageSize", page.getPageSize());
    otherFilters.put("lastRows", page.getFirstResult() + page.getPageSize());
    otherFilters.put("sortColumns", pageRequest.getSortColumns());
   
    //混合两个filters为一个filters,MapAndObject.get()方法将在两个对象取值,Map如果取值为null,则再在Bean中取值
    Map parameterObject = new MapAndObject(otherFilters,pageRequest);
    List list = sqlMapClientTemplate.queryForList(statementName, parameterObject,page.getFirstResult(),page.getPageSize());
    page.setResult(list);
    return page;
  }
View Full Code Here

TOP

Related Classes of cn.org.rapid_framework.page.Page

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.