本文整理汇总了Java中org.apache.ibatis.scripting.xmltags.DynamicContext类的典型用法代码示例。如果您正苦于以下问题:Java DynamicContext类的具体用法?Java DynamicContext怎么用?Java DynamicContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DynamicContext类属于org.apache.ibatis.scripting.xmltags包,在下文中一共展示了DynamicContext类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBoundSql
import org.apache.ibatis.scripting.xmltags.DynamicContext; //导入依赖的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;
}
示例2: getBoundSql
import org.apache.ibatis.scripting.xmltags.DynamicContext; //导入依赖的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());
BoundSql boundSql = sqlSource.getBoundSql(parameterObject);
//设置条件参数
for (Map.Entry<String, Object> entry : context.getBindings().entrySet()) {
boundSql.setAdditionalParameter(entry.getKey(), entry.getValue());
}
BoundSqlSqlSource boundSqlSqlSource = new BoundSqlSqlSource(boundSql);
if (count) {
boundSqlSqlSource = getCountSqlSource(boundSqlSqlSource);
} else {
boundSqlSqlSource = getPageSqlSource(configuration, boundSqlSqlSource);
}
return boundSqlSqlSource.getBoundSql();
}
示例3: getDefaultBoundSql
import org.apache.ibatis.scripting.xmltags.DynamicContext; //导入依赖的package包/类
@Override
protected BoundSql getDefaultBoundSql(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());
sqlSource = new OrderByStaticSqlSource((StaticSqlSource) sqlSource);
BoundSql boundSql = sqlSource.getBoundSql(parameterObject);
//设置条件参数
for (Map.Entry<String, Object> entry : context.getBindings().entrySet()) {
boundSql.setAdditionalParameter(entry.getKey(), entry.getValue());
}
return boundSql;
}
示例4: getSql
import org.apache.ibatis.scripting.xmltags.DynamicContext; //导入依赖的package包/类
private static String getSql(Configuration configuration, SqlNode rootSqlNode) {
DynamicContext context = new DynamicContext(configuration, null);
rootSqlNode.apply(context);
return context.getSql();
}