use of org.apache.ibatis.scripting.xmltags.DynamicContext in project qiuyj-code by qiuyuanjun.
the class ReturnValueWrapper method generateSqlSource.
/**
* 生成对应的SqlSource,这里仅仅会生成DynamicSqlSource和StaticSqlSource
*/
public SqlSource generateSqlSource(Configuration configuration) {
if (Objects.isNull(sqlNode)) {
throw new IllegalArgumentException("SqlNode can not be null");
} else {
SqlSource sqlSource;
if (generateStaticSqlSource) {
DynamicContext context = new DynamicContext(configuration, null);
sqlNode.apply(context);
sqlSource = new StaticSqlSource(configuration, context.getSql(), parameterMappings);
} else {
sqlSource = new DynamicSqlSource(configuration, sqlNode);
}
return new MapperSqlSource(sqlSource);
}
}
use of org.apache.ibatis.scripting.xmltags.DynamicContext in project mybatis-3 by mybatis.
the class RawSqlSource method getSql.
private static String getSql(Configuration configuration, SqlNode rootSqlNode) {
DynamicContext context = new DynamicContext(configuration, null);
rootSqlNode.apply(context);
return context.getSql();
}
Aggregations