Example usage for org.apache.ibatis.mapping SqlSource SqlSource

List of usage examples for org.apache.ibatis.mapping SqlSource SqlSource

Introduction

In this page you can find the example usage for org.apache.ibatis.mapping SqlSource SqlSource.

Prototype

SqlSource

Source Link

Usage

From source file:com.ewcms.common.mybatis.plugin.PaginationQueryPlugin.java

License:Open Source License

/**
 * ?{@link MppedStatement}/*from w  w  w  .  ja v  a 2s.c om*/
 * 
 * @param statement 
 * @param boundSql 
 * @param rowBounds
 * @return
 */
private MappedStatement newMappedStatement(final MappedStatement statement, final BoundSql boundSql,
        final RowBounds rowBounds) {

    setPagination(boundSql, rowBounds);
    Builder builder = new MappedStatement.Builder(statement.getConfiguration(), statement.getId(),
            new SqlSource() {
                @Override
                public BoundSql getBoundSql(Object parameterObject) {
                    return boundSql;
                }
            }, statement.getSqlCommandType()).cache(statement.getCache()).databaseId(statement.getDatabaseId())
                    .fetchSize(statement.getFetchSize())
                    .keyColumn(arrayToCommaDelimitedString(statement.getKeyColumns()))
                    .keyGenerator(statement.getKeyGenerator())
                    .keyProperty(arrayToCommaDelimitedString(statement.getKeyProperties()))
                    .parameterMap(statement.getParameterMap()).resource(statement.getResource())
                    .resultMaps(statement.getResultMaps()).statementType(statement.getStatementType())
                    .timeout(statement.getTimeout()).useCache(statement.isUseCache());

    return builder.build();
}