本文整理汇总了Java中com.github.pagehelper.Page.getPageSize方法的典型用法代码示例。如果您正苦于以下问题:Java Page.getPageSize方法的具体用法?Java Page.getPageSize怎么用?Java Page.getPageSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.pagehelper.Page
的用法示例。
在下文中一共展示了Page.getPageSize方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processPageParameter
import com.github.pagehelper.Page; //导入方法依赖的package包/类
@Override
public Object processPageParameter(MappedStatement ms, Map<String, Object> paramMap, Page page, BoundSql boundSql, CacheKey pageKey) {
paramMap.put(PAGEPARAMETER_FIRST, page.getPageSize());
paramMap.put(PAGEPARAMETER_SECOND, page.getStartRow());
//处理pageKey
pageKey.update(page.getPageSize());
pageKey.update(page.getStartRow());
//处理参数配置
if (boundSql.getParameterMappings() != null) {
List<ParameterMapping> newParameterMappings = new ArrayList<ParameterMapping>();
if (boundSql != null && boundSql.getParameterMappings() != null) {
newParameterMappings.addAll(boundSql.getParameterMappings());
}
if (page.getPageSize() > 0) {
newParameterMappings.add(new ParameterMapping.Builder(ms.getConfiguration(), PAGEPARAMETER_FIRST, Integer.class).build());
}
if (page.getStartRow() > 0) {
newParameterMappings.add(new ParameterMapping.Builder(ms.getConfiguration(), PAGEPARAMETER_SECOND, Integer.class).build());
}
MetaObject metaObject = MetaObjectUtil.forObject(boundSql);
metaObject.setValue("parameterMappings", newParameterMappings);
}
return paramMap;
}
示例2: processPageParameter
import com.github.pagehelper.Page; //导入方法依赖的package包/类
@Override
public Object processPageParameter(MappedStatement ms, Map<String, Object> paramMap, Page page, BoundSql boundSql, CacheKey pageKey) {
paramMap.put(PAGEPARAMETER_FIRST, page.getStartRow());
paramMap.put(PAGEPARAMETER_SECOND, page.getPageSize());
//处理pageKey
pageKey.update(page.getStartRow());
pageKey.update(page.getPageSize());
//处理参数配置
if (boundSql.getParameterMappings() != null) {
List<ParameterMapping> newParameterMappings = new ArrayList<ParameterMapping>();
if (page.getStartRow() > 0) {
newParameterMappings.add(new ParameterMapping.Builder(ms.getConfiguration(), PAGEPARAMETER_FIRST, Integer.class).build());
}
if (page.getPageSize() > 0) {
newParameterMappings.add(new ParameterMapping.Builder(ms.getConfiguration(), PAGEPARAMETER_SECOND, Integer.class).build());
}
if (boundSql != null && boundSql.getParameterMappings() != null) {
newParameterMappings.addAll(boundSql.getParameterMappings());
}
MetaObject metaObject = MetaObjectUtil.forObject(boundSql);
metaObject.setValue("parameterMappings", newParameterMappings);
}
return paramMap;
}
示例3: afterPage
import com.github.pagehelper.Page; //导入方法依赖的package包/类
@Override
public Object afterPage(List pageList, Object parameterObject, RowBounds rowBounds) {
Page page = getLocalPage();
if (page == null) {
return pageList;
}
page.addAll(pageList);
if (!page.isCount()) {
page.setTotal(-1);
} else if ((page.getPageSizeZero() != null && page.getPageSizeZero()) && page.getPageSize() == 0) {
page.setTotal(pageList.size());
} else if(page.isOrderByOnly()){
page.setTotal(pageList.size());
}
return page;
}
示例4: outPage
import com.github.pagehelper.Page; //导入方法依赖的package包/类
public static <T, TO> PageInfo<TO> outPage(Page<T> page, List<TO> tos) {
if (page == null)
return new PageInfo<TO>();
int pageSize = page.getPageSize();
int pageNo = page.getPageNum();
long total = page.getTotal();
return new PageInfo<TO>(pageNo, pageSize, total, tos);
}
示例5: getPageSql
import com.github.pagehelper.Page; //导入方法依赖的package包/类
@Override
public String getPageSql(String sql, Page page, CacheKey pageKey) {
StringBuilder sqlBuilder = new StringBuilder(sql.length() + 20);
sqlBuilder.append(sql);
if (page.getPageSize() > 0) {
sqlBuilder.append(" LIMIT ? ");
}
if (page.getStartRow() > 0) {
sqlBuilder.append(" OFFSET ? ");
}
return sqlBuilder.toString();
}
示例6: getPageSql
import com.github.pagehelper.Page; //导入方法依赖的package包/类
@Override
public String getPageSql(String sql, Page page, CacheKey pageKey) {
StringBuilder sqlBuilder = new StringBuilder(sql.length() + 40);
sqlBuilder.append("SELECT ");
if (page.getStartRow() > 0) {
sqlBuilder.append(" SKIP ? ");
}
if (page.getPageSize() > 0) {
sqlBuilder.append(" FIRST ? ");
}
sqlBuilder.append(" * FROM ( ");
sqlBuilder.append(sql);
sqlBuilder.append(" ) TEMP_T ");
return sqlBuilder.toString();
}
示例7: afterCount
import com.github.pagehelper.Page; //导入方法依赖的package包/类
@Override
public boolean afterCount(long count, Object parameterObject, RowBounds rowBounds) {
Page page = getLocalPage();
page.setTotal(count);
if (rowBounds instanceof PageRowBounds) {
((PageRowBounds) rowBounds).setTotal(count);
}
//pageSize < 0 的时候,不执行分页查询
//pageSize = 0 的时候,还需要执行后续查询,但是不会分页
if (page.getPageSize() < 0) {
return false;
}
return count > 0;
}
示例8: beforePage
import com.github.pagehelper.Page; //导入方法依赖的package包/类
@Override
public boolean beforePage(MappedStatement ms, Object parameterObject, RowBounds rowBounds) {
Page page = getLocalPage();
if (page.isOrderByOnly() || page.getPageSize() > 0) {
return true;
}
return false;
}