本文整理汇总了Java中com.github.pagehelper.Page.getStartRow方法的典型用法代码示例。如果您正苦于以下问题:Java Page.getStartRow方法的具体用法?Java Page.getStartRow怎么用?Java Page.getStartRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.pagehelper.Page
的用法示例。
在下文中一共展示了Page.getStartRow方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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 (boundSql != null && boundSql.getParameterMappings() != null) {
newParameterMappings.addAll(boundSql.getParameterMappings());
}
if (page.getStartRow() == 0) {
newParameterMappings.add(new ParameterMapping.Builder(ms.getConfiguration(), PAGEPARAMETER_SECOND, Integer.class).build());
} else {
newParameterMappings.add(new ParameterMapping.Builder(ms.getConfiguration(), PAGEPARAMETER_FIRST, Integer.class).build());
newParameterMappings.add(new ParameterMapping.Builder(ms.getConfiguration(), PAGEPARAMETER_SECOND, Integer.class).build());
}
MetaObject metaObject = MetaObjectUtil.forObject(boundSql);
metaObject.setValue("parameterMappings", newParameterMappings);
}
return paramMap;
}
示例4: 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();
}
示例5: 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();
}
示例6: getPageSql
import com.github.pagehelper.Page; //导入方法依赖的package包/类
@Override
public String getPageSql(String sql, Page page, CacheKey pageKey) {
StringBuilder sqlBuilder = new StringBuilder(sql.length() + 14);
sqlBuilder.append(sql);
if (page.getStartRow() == 0) {
sqlBuilder.append(" LIMIT ? ");
} else {
sqlBuilder.append(" LIMIT ?, ? ");
}
pageKey.update(page.getPageSize());
return sqlBuilder.toString();
}