@Override public Map<String, Object> getBindings() { return delegate.getBindings(); }
@Override public String getSql() { return delegate.getSql(); }
@Override public boolean apply(DynamicContext context) { context.appendSql(text); return true; }
@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; }
private static String getSql(Configuration configuration, SqlNode rootSqlNode) { DynamicContext context = new DynamicContext(configuration, null); rootSqlNode.apply(context); return context.getSql(); }
@Override public boolean apply(DynamicContext context) { final Object value = OgnlCache.getValue(expression, context.getBindings()); context.bind(name, value); return true; }
@Override public boolean apply(DynamicContext context) { Map<String, Object> bindings = context.getBindings(); final Iterable<?> iterable = evaluator.evaluateIterable(collectionExpression, bindings); if (!iterable.iterator().hasNext()) { context = new PrefixedContext(context, separator); int uniqueNumber = context.getUniqueNumber(); context.getBindings().remove(item); context.getBindings().remove(index); return true;
@Override public void bind(String name, Object value) { delegate.bind(name, value); }
@Override public int getUniqueNumber() { return delegate.getUniqueNumber(); } }
@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; }
private static String getSql(Configuration configuration, SqlNode rootSqlNode) { DynamicContext context = new DynamicContext(configuration, null); rootSqlNode.apply(context); return context.getSql(); }
@Override public boolean apply(DynamicContext context) { final Object value = OgnlCache.getValue(expression, context.getBindings()); context.bind(name, value); return true; }
@Override public boolean apply(DynamicContext context) { Map<String, Object> bindings = context.getBindings(); final Iterable<?> iterable = evaluator.evaluateIterable(collectionExpression, bindings); if (!iterable.iterator().hasNext()) { context = new PrefixedContext(context, ""); int uniqueNumber = context.getUniqueNumber();
@Override public void bind(String name, Object value) { delegate.bind(name, value); }
@Override public int getUniqueNumber() { return delegate.getUniqueNumber(); } }
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; } }
@Override public Map<String, Object> getBindings() { return delegate.getBindings(); }
@Override public String getSql() { return delegate.getSql(); }
private void applyOpen(DynamicContext context) { if (open != null) { context.appendSql(open); } }
@Override public void bind(String name, Object value) { delegate.bind(name, value); }