List of usage examples for org.apache.ibatis.mapping SqlSource getBoundSql
BoundSql getBoundSql(Object parameterObject);
From source file:cn.com.bricks.mybatis.rbac.DynamicRbacInterceptor.java
protected BoundSql getBoundSql(Configuration configuration, Object parameterObject, SqlNode sqlNode) throws SQLException { DynamicContext context = new DynamicContext(configuration, parameterObject); sqlNode.apply(context);/* w w w . j av a2 s .co m*/ String countextSql = context.getSql(); // ? SqlSourceBuilder sqlSourceParser = new SqlSourceBuilder(configuration); Class<?> parameterType = parameterObject == null ? Object.class : parameterObject.getClass(); String sql = modifySqlAddUserRole(countextSql, parameterObject); SqlSource sqlSource = sqlSourceParser.parse(sql, 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; }
From source file:com.appleframework.orm.mybatis.pagehelper.sqlsource.PageDynamicSqlSource.java
License:Open Source License
@Override protected BoundSql getDefaultBoundSql(Object parameterObject) { DynamicContext context = new DynamicContext(configuration, parameterObject); rootSqlNode.apply(context);/*ww w.ja v a 2 s . c om*/ 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; }
From source file:com.appleframework.orm.mybatis.pagehelper.sqlsource.PageDynamicSqlSource.java
License:Open Source License
@Override protected BoundSql getCountBoundSql(Object parameterObject) { DynamicContext context = new DynamicContext(configuration, parameterObject); rootSqlNode.apply(context);//from w ww. j a v a 2 s . c om 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); sqlSource = new StaticSqlSource(configuration, localParser.get().getCountSql(boundSql.getSql()), boundSql.getParameterMappings()); boundSql = sqlSource.getBoundSql(parameterObject); //?? for (Map.Entry<String, Object> entry : context.getBindings().entrySet()) { boundSql.setAdditionalParameter(entry.getKey(), entry.getValue()); } return boundSql; }
From source file:com.appleframework.orm.mybatis.pagehelper.sqlsource.PageDynamicSqlSource.java
License:Open Source License
@SuppressWarnings("rawtypes") @Override/*from w ww. java 2 s .co m*/ protected BoundSql getPageBoundSql(Object parameterObject) { DynamicContext context; //??parameterObject??? //??Map?KEY //bug#25:http://git.oschina.net/free/Mybatis_PageHelper/issues/25 if (parameterObject != null && parameterObject instanceof Map && ((Map) parameterObject).containsKey(ORIGINAL_PARAMETER_OBJECT)) { context = new DynamicContext(configuration, ((Map) parameterObject).get(ORIGINAL_PARAMETER_OBJECT)); } else { 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); sqlSource = new StaticSqlSource(configuration, localParser.get().getPageSql(boundSql.getSql()), localParser.get().getPageParameterMapping(configuration, boundSql)); boundSql = sqlSource.getBoundSql(parameterObject); //?? for (Map.Entry<String, Object> entry : context.getBindings().entrySet()) { boundSql.setAdditionalParameter(entry.getKey(), entry.getValue()); } return boundSql; }
From source file:com.appleframework.orm.mybatis.pagehelper.sqlsource.PageProviderSqlSource.java
License:Open Source License
@Override protected BoundSql getDefaultBoundSql(Object parameterObject) { SqlSource sqlSource = createSqlSource(parameterObject); return sqlSource.getBoundSql(parameterObject); }
From source file:com.appleframework.orm.mybatis.pagehelper.sqlsource.PageProviderSqlSource.java
License:Open Source License
@Override protected BoundSql getCountBoundSql(Object parameterObject) { BoundSql boundSql;//from w ww.j a va 2 s.c om SqlSource sqlSource = createSqlSource(parameterObject); boundSql = sqlSource.getBoundSql(parameterObject); return new BoundSql(configuration, localParser.get().getCountSql(boundSql.getSql()), boundSql.getParameterMappings(), parameterObject); }
From source file:com.appleframework.orm.mybatis.pagehelper.sqlsource.PageProviderSqlSource.java
License:Open Source License
@SuppressWarnings("rawtypes") @Override// ww w . jav a 2 s . com protected BoundSql getPageBoundSql(Object parameterObject) { BoundSql boundSql; if (parameterObject instanceof Map && ((Map) parameterObject).containsKey(PROVIDER_OBJECT)) { SqlSource sqlSource = createSqlSource(((Map) parameterObject).get(PROVIDER_OBJECT)); boundSql = sqlSource.getBoundSql(((Map) parameterObject).get(PROVIDER_OBJECT)); } else { SqlSource sqlSource = createSqlSource(parameterObject); boundSql = sqlSource.getBoundSql(parameterObject); } return new BoundSql(configuration, localParser.get().getPageSql(boundSql.getSql()), localParser.get().getPageParameterMapping(configuration, boundSql), parameterObject); }
From source file:com.autonavi.tsp.workbackend.util.page.SqlUtil.java
License:Open Source License
/** * ?sqlSource/*ww w . ja v a 2s. c o m*/ * * @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)); }
From source file:com.autonavi.tsp.workbackend.util.page.SqlUtil.java
License:Open Source License
/** * ?countsqlSource/*from w w w. j a va 2s. com*/ * * @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()); }
From source file:com.dao.genericdao.mybatis.plugins.page.support.SqlUtil.java
License:Open Source License
/** * ?sqlSource//from w w w . j av a 2 s. co m * * @param configuration * @param sqlSource * @return */ private SqlSource getPageSqlSource(Configuration configuration, SqlSource sqlSource, Object parameterObject) { BoundSql boundSql = sqlSource.getBoundSql(parameterObject); return new StaticSqlSource(configuration, parser.getPageSql(boundSql.getSql()), parser.getPageParameterMapping(configuration, boundSql)); }