當前位置: 首頁>>代碼示例>>Java>>正文


Java RowBounds.getLimit方法代碼示例

本文整理匯總了Java中org.apache.ibatis.session.RowBounds.getLimit方法的典型用法代碼示例。如果您正苦於以下問題:Java RowBounds.getLimit方法的具體用法?Java RowBounds.getLimit怎麽用?Java RowBounds.getLimit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.ibatis.session.RowBounds的用法示例。


在下文中一共展示了RowBounds.getLimit方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getPage

import org.apache.ibatis.session.RowBounds; //導入方法依賴的package包/類
/**
 * 獲取分頁參數
 *
 * @param params RowBounds參數
 * @return 返回Page對象
 */
public PageHelper getPage(Object params) {
    PageHelper page = getLocalPage();
    if (page == null) {
        if (params instanceof RowBounds) {
            RowBounds rowBounds = (RowBounds) params;
            if (offsetAsPageNum) {
                page = new PageHelper(rowBounds.getOffset(), rowBounds.getLimit(), rowBoundsWithCount);
            } else {
                page = new PageHelper(rowBounds, rowBoundsWithCount);
            }
        } else {
            page = getPageFromObject(params);
        }
        setLocalPage(page);
    }
    //分頁合理化
    if (page.getReasonable() == null) {
        page.setReasonable(reasonable);
    }
    //當設置為true的時候,如果pagesize設置為0(或RowBounds的limit=0),就不執行分頁,返回全部結果
    if (page.getPageSizeZero() == null) {
        page.setPageSizeZero(pageSizeZero);
    }
    return page;
}
 
開發者ID:geeker-lait,項目名稱:tasfe-framework,代碼行數:32,代碼來源:SqlUtil.java

示例2: getPage

import org.apache.ibatis.session.RowBounds; //導入方法依賴的package包/類
/**
 * 獲取分頁參數
 *
 * @param rowBounds
 *            RowBounds參數
 * @return 返回Page對象
 */
private Page getPage(RowBounds rowBounds) {
    Page page = LOCAL_PAGE.get();
    // 移除本地變量
    LOCAL_PAGE.remove();
    if (page == null) {
        if (offsetAsPageNum) {
            page = new Page(rowBounds.getOffset(), rowBounds.getLimit(), rowBoundsWithCount);
        } else {
            page = new Page(rowBounds, rowBoundsWithCount);
        }
    }
    // 分頁合理化
    if (page.getReasonable() == null) {
        page.setReasonable(reasonable);
    }
    // 當設置為true的時候,如果pagesize設置為0(或RowBounds的limit=0),就不執行分頁,返回全部結果
    if (page.getPageSizeZero() == null) {
        page.setPageSizeZero(pageSizeZero);
    }
    return page;
}
 
開發者ID:PekingGo,項目名稱:ipayquery,代碼行數:29,代碼來源:PageHelper.java

示例3: PageHelper

import org.apache.ibatis.session.RowBounds; //導入方法依賴的package包/類
public PageHelper(RowBounds rowBounds, int total) {
    super(rowBounds.getLimit() > -1 ? rowBounds.getLimit() : 0);
    this.pageSize = rowBounds.getLimit();
    this.startRow = rowBounds.getOffset();
    //RowBounds方式默認不求count總數,如果想求count,可以修改這裏為SQL_COUNT
    this.total = total;
    this.endRow = this.startRow + this.pageSize;
}
 
開發者ID:geeker-lait,項目名稱:tasfe-framework,代碼行數:9,代碼來源:PageHelper.java

示例4: processIntercept

import org.apache.ibatis.session.RowBounds; //導入方法依賴的package包/類
void processIntercept(final Object[] queryArgs) {
	MappedStatement ms = (MappedStatement) queryArgs[MAPPED_STATEMENT_INDEX];
	Object parameter = queryArgs[PARAMETER_INDEX];
	final RowBounds rowBounds = (RowBounds) queryArgs[ROWBOUNDS_INDEX];
	int offset = rowBounds.getOffset();
	int limit = rowBounds.getLimit();
	if (dialect.supportsLimit() && (offset != RowBounds.NO_ROW_OFFSET || limit != RowBounds.NO_ROW_LIMIT)) {
		BoundSql boundSql = ms.getBoundSql(parameter);
		String sql = boundSql.getSql().trim();
		if (dialect.supportsLimitOffset()) {
			sql = dialect.getLimitString(sql, offset, limit);
			offset = RowBounds.NO_ROW_OFFSET;
		} else {
			sql = dialect.getLimitString(sql, 0, limit);
		}
		limit = RowBounds.NO_ROW_LIMIT;
		queryArgs[ROWBOUNDS_INDEX] = new RowBounds(offset, limit);
		BoundSql newBoundSql = new BoundSql(ms.getConfiguration(), sql, boundSql.getParameterMappings(),
				boundSql.getParameterObject());
		for (ParameterMapping mapping : boundSql.getParameterMappings()) {
			String prop = mapping.getProperty();
			if (boundSql.hasAdditionalParameter(prop)) {
				newBoundSql.setAdditionalParameter(prop, boundSql.getAdditionalParameter(prop));
			}
		}
		MappedStatement newMs = copyFromMappedStatement(ms, new BoundSqlSqlSource(newBoundSql));
		queryArgs[MAPPED_STATEMENT_INDEX] = newMs;
	}
}
 
開發者ID:yi-jun,項目名稱:aaden-pay,代碼行數:30,代碼來源:PagePluging.java

示例5: PageBounds

import org.apache.ibatis.session.RowBounds; //導入方法依賴的package包/類
public PageBounds(RowBounds rowBounds) {
    if(rowBounds instanceof PageBounds){
        PageBounds pageBounds = (PageBounds)rowBounds;
        this.page = pageBounds.page;
        this.limit = pageBounds.limit;
        this.orders = pageBounds.orders;
        this.containsTotalCount = pageBounds.containsTotalCount;
        this.asyncTotalCount = pageBounds.asyncTotalCount;
    }else{
        this.page = (rowBounds.getOffset()/rowBounds.getLimit())+1;
        this.limit = rowBounds.getLimit();
    }

}
 
開發者ID:AsuraTeam,項目名稱:asura,代碼行數:15,代碼來源:PageBounds.java

示例6: Page

import org.apache.ibatis.session.RowBounds; //導入方法依賴的package包/類
public Page(RowBounds rowBounds, int total) {
    super(rowBounds.getLimit() > -1 ? rowBounds.getLimit() : 0);
    this.pageSize = rowBounds.getLimit();
    this.startRow = rowBounds.getOffset();
    // RowBounds方式默認不求count總數,如果想求count,可以修改這裏為SQL_COUNT
    this.total = total;
    this.endRow = this.startRow + this.pageSize;
}
 
開發者ID:PekingGo,項目名稱:ipayquery,代碼行數:9,代碼來源:Page.java

示例7: Pagination

import org.apache.ibatis.session.RowBounds; //導入方法依賴的package包/類
public Pagination(RowBounds rowBounds) {
	this.limit = rowBounds.getLimit();
	this.offset = rowBounds.getOffset();
	this.page = offset / limit + 1;
}
 
開發者ID:jiangzongyao,項目名稱:kettle_support_kettle8.0,代碼行數:6,代碼來源:Pagination.java

示例8: processIntercept

import org.apache.ibatis.session.RowBounds; //導入方法依賴的package包/類
void processIntercept(final Object[] queryArgs) throws Exception
{
	/*
	// 以下代碼可根據數據源動態加載方言,用於多數據源的情況下
	Dialect dialect = this.dialect;
	String str = DynamicDataSource.getDbType();
	if(!str.equals("1"))
	{
		String dialectClass = this.properties.getProperty(str);
		try
		{
			System.out.println("dbType是" + str + ",加載動態方言:" + dialectClass);
			dialect = (Dialect) Class.forName(dialectClass).newInstance();
		}
		catch (Exception e)
		{
			throw new RuntimeException("無法初始化方言:" + dialectClass, e);
		}
	}
	*/
	final RowBounds rowBounds = (RowBounds) queryArgs[ROWBOUNDS_INDEX];
	int offset = rowBounds.getOffset();
	int limit = rowBounds.getLimit();
	if (dialect.supportsLimitOffset() && (offset != RowBounds.NO_ROW_OFFSET || limit != RowBounds.NO_ROW_LIMIT))
	{
		MappedStatement ms = (MappedStatement) queryArgs[MAPPED_STATEMENT_INDEX];
		Object parameter = queryArgs[PARAMETER_INDEX];
		BoundSql boundSql = ms.getBoundSql(parameter);
		String sql = boundSql.getSql().trim();
		
		sql = dialect.getLimitString(sql, offset, limit);
		offset = RowBounds.NO_ROW_OFFSET;
		
		limit = RowBounds.NO_ROW_LIMIT;
		queryArgs[ROWBOUNDS_INDEX] = new RowBounds(offset, limit);
		BoundSql newBoundSql = new BoundSql(ms.getConfiguration(), sql, boundSql.getParameterMappings(), boundSql.getParameterObject());
		String prop;
		for(ParameterMapping p : boundSql.getParameterMappings())
		{
			prop = p.getProperty();
			if(boundSql.hasAdditionalParameter(prop))
			{
				newBoundSql.setAdditionalParameter(prop, boundSql.getAdditionalParameter(prop));
			}
		}
		MappedStatement newMs = copyFromMappedStatement(ms, new BoundSqlSqlSource(newBoundSql));
		queryArgs[MAPPED_STATEMENT_INDEX] = newMs;
	}
}
 
開發者ID:skeychen,項目名稱:dswork,代碼行數:50,代碼來源:OffsetLimitInterceptor.java


注:本文中的org.apache.ibatis.session.RowBounds.getLimit方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。