当前位置: 首页>>代码示例>>Java>>正文


Java Page.getStartRow方法代码示例

本文整理汇总了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;
}
 
开发者ID:pagehelper,项目名称:Mybatis-PageHelper,代码行数:25,代码来源:HsqldbDialect.java

示例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;
}
 
开发者ID:pagehelper,项目名称:Mybatis-PageHelper,代码行数:25,代码来源:InformixDialect.java

示例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;
}
 
开发者ID:pagehelper,项目名称:Mybatis-PageHelper,代码行数:25,代码来源:MySqlDialect.java

示例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();
}
 
开发者ID:pagehelper,项目名称:Mybatis-PageHelper,代码行数:13,代码来源:HsqldbDialect.java

示例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();
}
 
开发者ID:pagehelper,项目名称:Mybatis-PageHelper,代码行数:16,代码来源:InformixDialect.java

示例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();
}
 
开发者ID:pagehelper,项目名称:Mybatis-PageHelper,代码行数:13,代码来源:MySqlDialect.java


注:本文中的com.github.pagehelper.Page.getStartRow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。