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


Java SqlSource.getBoundSql方法代码示例

本文整理汇总了Java中org.apache.ibatis.mapping.SqlSource.getBoundSql方法的典型用法代码示例。如果您正苦于以下问题:Java SqlSource.getBoundSql方法的具体用法?Java SqlSource.getBoundSql怎么用?Java SqlSource.getBoundSql使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.ibatis.mapping.SqlSource的用法示例。


在下文中一共展示了SqlSource.getBoundSql方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getBoundSql

import org.apache.ibatis.mapping.SqlSource; //导入方法依赖的package包/类
public BoundSql getBoundSql(Object parameterObject) {
    DynamicContext context = new DynamicContext(configuration, parameterObject);
    rootSqlNode.apply(context);
    SqlSourceBuilder sqlSourceParser = new SqlSourceBuilder(configuration);
    Class<?> parameterType = parameterObject == null ? Object.class : parameterObject.getClass();
    SqlSource sqlSource = sqlSourceParser.parse(context.getSql(), parameterType, context.getBindings());
    if (count) {
        sqlSource = getCountSqlSource(configuration, sqlSource, parameterObject);
    } else {
        sqlSource = getPageSqlSource(configuration, sqlSource, parameterObject);
    }
    BoundSql boundSql = sqlSource.getBoundSql(parameterObject);
    // 设置条件参数
    for (Map.Entry<String, Object> entry : context.getBindings().entrySet()) {
        boundSql.setAdditionalParameter(entry.getKey(), entry.getValue());
    }
    return boundSql;
}
 
开发者ID:PekingGo,项目名称:ipayquery,代码行数:19,代码来源:SqlUtil.java

示例2: getBoundSql

import org.apache.ibatis.mapping.SqlSource; //导入方法依赖的package包/类
@Override
public BoundSql getBoundSql(Object parameterObject) {
  Map<String, Object> bindings = createBindings(parameterObject, configuration);
  VelocityContext context = new VelocityContext(bindings);
  StringWriter sw = new StringWriter();
  script.merge(context, sw);
  VelocitySqlSourceBuilder sqlSourceParser = new VelocitySqlSourceBuilder(configuration);
  Class<?> parameterType = parameterObject == null ? Object.class : parameterObject.getClass();
  SqlSource sqlSource = sqlSourceParser.parse(sw.toString(), parameterType);
  BoundSql boundSql = sqlSource.getBoundSql(parameterObject);
  for (Map.Entry<String, Object> entry : bindings.entrySet()) {
    boundSql.setAdditionalParameter(entry.getKey(), entry.getValue());
  }
  return boundSql;

}
 
开发者ID:yuexiahandao,项目名称:MybatisCode,代码行数:17,代码来源:VelocitySqlSource.java

示例3: getBoundSql

import org.apache.ibatis.mapping.SqlSource; //导入方法依赖的package包/类
@Override
public BoundSql getBoundSql(Object parameterObject) {
  DynamicContext context = new DynamicContext(configuration, parameterObject);
  rootSqlNode.apply(context);
  SqlSourceBuilder sqlSourceParser = new SqlSourceBuilder(configuration);
  Class<?> parameterType = parameterObject == null ? Object.class : parameterObject.getClass();
  SqlSource sqlSource = sqlSourceParser.parse(context.getSql(), parameterType, context.getBindings());
  BoundSql boundSql = sqlSource.getBoundSql(parameterObject);
  for (Map.Entry<String, Object> entry : context.getBindings().entrySet()) {
    boundSql.setAdditionalParameter(entry.getKey(), entry.getValue());
  }
  return boundSql;
}
 
开发者ID:yuexiahandao,项目名称:MybatisCode,代码行数:14,代码来源:DynamicSqlSource.java

示例4: getBoundSql

import org.apache.ibatis.mapping.SqlSource; //导入方法依赖的package包/类
@Override
public BoundSql getBoundSql(Object parameterObject) {
  SqlSource sqlSource = createSqlSource(parameterObject);
  return sqlSource.getBoundSql(parameterObject);
}
 
开发者ID:yuexiahandao,项目名称:MybatisCode,代码行数:6,代码来源:ProviderSqlSource.java

示例5: getPageSqlSource

import org.apache.ibatis.mapping.SqlSource; //导入方法依赖的package包/类
/**
 * 获取分页的sqlSource
 *
 * @param configuration
 * @param sqlSource
 * @return
 */
private SqlSource getPageSqlSource(Configuration configuration, SqlSource sqlSource, Object parameterObject) {
    BoundSql boundSql = sqlSource.getBoundSql(parameterObject);
    return new StaticSqlSource(configuration, sqlParser.getPageSql(boundSql.getSql()), getPageParameterMapping(configuration, boundSql));
}
 
开发者ID:PekingGo,项目名称:ipayquery,代码行数:12,代码来源:SqlUtil.java

示例6: getCountSqlSource

import org.apache.ibatis.mapping.SqlSource; //导入方法依赖的package包/类
/**
 * 获取count的sqlSource
 *
 * @param sqlSource
 * @return
 */
private SqlSource getCountSqlSource(Configuration configuration, SqlSource sqlSource, Object parameterObject) {
    BoundSql boundSql = sqlSource.getBoundSql(parameterObject);
    return new StaticSqlSource(configuration, sqlParser.getCountSql(boundSql.getSql()), boundSql.getParameterMappings());
}
 
开发者ID:PekingGo,项目名称:ipayquery,代码行数:11,代码来源:SqlUtil.java


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