本文整理了Java中org.apache.ibatis.mapping.BoundSql.<init>()
方法的一些代码示例,展示了BoundSql.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BoundSql.<init>()
方法的具体详情如下:
包路径:org.apache.ibatis.mapping.BoundSql
类名称:BoundSql
方法名:<init>
暂无
代码示例来源:origin: a466350665/smart
try {
countStmt = connection.prepareStatement(countSql);
BoundSql countBS = new BoundSql(mappedStatement.getConfiguration(), countSql,
boundSql.getParameterMappings(), boundSql.getParameterObject());
setParameters(countStmt, mappedStatement, countBS, boundSql.getParameterObject());
代码示例来源:origin: pagehelper/Mybatis-PageHelper
BoundSql countBoundSql = new BoundSql(countMs.getConfiguration(), countSql, boundSql.getParameterMappings(), parameter);
代码示例来源:origin: pagehelper/Mybatis-PageHelper
BoundSql pageBoundSql = new BoundSql(ms.getConfiguration(), pageSql, boundSql.getParameterMappings(), parameter);
代码示例来源:origin: camunda/camunda-bpm-platform
@Override
public BoundSql getBoundSql(Object parameterObject) {
return new BoundSql(configuration, sql, parameterMappings, parameterObject);
}
代码示例来源:origin: org.mybatis/mybatis
@Override
public BoundSql getBoundSql(Object parameterObject) {
return new BoundSql(configuration, sql, parameterMappings, parameterObject);
}
代码示例来源:origin: camunda/camunda-bpm-platform
public BoundSql getBoundSql(Object parameterObject) {
BoundSql boundSql = sqlSource.getBoundSql(parameterObject);
List<ParameterMapping> parameterMappings = boundSql.getParameterMappings();
if (parameterMappings == null || parameterMappings.isEmpty()) {
boundSql = new BoundSql(configuration, boundSql.getSql(), parameterMap.getParameterMappings(), parameterObject);
}
// check for nested result maps in parameter mappings (issue #30)
for (ParameterMapping pm : boundSql.getParameterMappings()) {
String rmId = pm.getResultMapId();
if (rmId != null) {
ResultMap rm = configuration.getResultMap(rmId);
if (rm != null) {
hasNestedResultMaps |= rm.hasNestedResultMaps();
}
}
}
return boundSql;
}
代码示例来源:origin: org.mybatis/mybatis
public BoundSql getBoundSql(Object parameterObject) {
BoundSql boundSql = sqlSource.getBoundSql(parameterObject);
List<ParameterMapping> parameterMappings = boundSql.getParameterMappings();
if (parameterMappings == null || parameterMappings.isEmpty()) {
boundSql = new BoundSql(configuration, boundSql.getSql(), parameterMap.getParameterMappings(), parameterObject);
}
// check for nested result maps in parameter mappings (issue #30)
for (ParameterMapping pm : boundSql.getParameterMappings()) {
String rmId = pm.getResultMapId();
if (rmId != null) {
ResultMap rm = configuration.getResultMap(rmId);
if (rm != null) {
hasNestedResultMaps |= rm.hasNestedResultMaps();
}
}
}
return boundSql;
}
代码示例来源:origin: yuboon/Aooms
@Override
public BoundSql getBoundSql(Object parameterObject) {
return new BoundSql(configuration, script, null, null);
}
};
代码示例来源:origin: mybatis-book/book
rowBounds,
countKey);
BoundSql countBoundSql = new BoundSql(
ms.getConfiguration(),
countSql,
rowBounds,
pageKey);
BoundSql pageBoundSql = new BoundSql(
ms.getConfiguration(),
pageSql,
代码示例来源:origin: Meituan-Dianping/Zebra
private Object queryCount(Invocation invocation, Object[] args, MappedStatement ms, BoundSql boundSql)
throws InvocationTargetException, IllegalAccessException {
MappedStatement countRowStatement = COUNT_MAPPED_STATS.get(ms.getId());
if (countRowStatement == null) {
String countSql = dialect.getCountSql(boundSql.getSql());
BoundSql newBoundSql = new BoundSql(ms.getConfiguration(), countSql, boundSql.getParameterMappings(),
boundSql.getParameterObject());
MetaObject mo = (MetaObject) ReflectionUtils.getFieldValue(boundSql, "metaParameters");
ReflectionUtils.setFieldValue(newBoundSql, "metaParameters", mo);
Object additionalParameters = ReflectionUtils.getFieldValue(boundSql, "additionalParameters");
ReflectionUtils.setFieldValue(newBoundSql, "additionalParameters", additionalParameters);
List<ResultMap> resultMaps = new ArrayList<ResultMap>();
ResultMap resultMap = new ResultMap.Builder(ms.getConfiguration(), ms.getId(), int.class,
EMPTY_RESULTMAPPING).build();
resultMaps.add(resultMap);
countRowStatement = buildMappedStatement(ms, new SqlSourceWrapper(newBoundSql), ms.getId() + "_COUNT",
resultMaps);
}
args[0] = countRowStatement;
args[2] = new RowBounds();
args[3] = null;
try {
DaoContextHolder.setSqlName(buildDaoName(ms.getId()) + "_COUNT");
return invocation.proceed();
} finally {
DaoContextHolder.clearSqlName();
}
}
代码示例来源:origin: mybatis-book/book
@SuppressWarnings("rawtypes")
@Override
public Object intercept(Invocation invocation) throws Throwable {
Executor executor = (Executor)invocation.getTarget();
Object[] args = invocation.getArgs();
MappedStatement ms = (MappedStatement)args[0];
Object parameterObject = args[1];
RowBounds rowBounds = (RowBounds)args[2];
ResultHandler resultHandler = (ResultHandler)args[3];
BoundSql boundSql = ms.getBoundSql(parameterObject);
CacheKey pageKey = null, countKey = null;
if(executor instanceof CachingExecutor){
pageKey = ((CachingExecutor)executor).createCacheKey(ms, parameterObject, rowBounds, boundSql);
countKey = ((CachingExecutor)executor).createCacheKey(ms, parameterObject, rowBounds, boundSql);
} else {
pageKey = ((BaseExecutor)executor).createCacheKey(ms, parameterObject, rowBounds, boundSql);
countKey = ((BaseExecutor)executor).createCacheKey(ms, parameterObject, rowBounds, boundSql);
}
countKey.update("Count");
BoundSql countSql = new BoundSql(ms.getConfiguration(), "select count(*) from (" + boundSql.getSql() + ") temp", boundSql.getParameterMappings(), parameterObject);
Object r2 = executor.query(ms, parameterObject, rowBounds, resultHandler, pageKey, boundSql);
MappedStatement countMs = newMappedStatement(ms, Long.class);
Object r1 = executor.query(countMs, parameterObject, rowBounds, resultHandler, countKey, countSql);
System.out.println(r1);
return r2;
}
代码示例来源:origin: Meituan-Dianping/Zebra
private Object queryLimit(Invocation invocation, Object[] args, MappedStatement ms, BoundSql boundSql, RowBounds rb)
throws InvocationTargetException, IllegalAccessException {
String limitSql = dialect.getLimitSql(boundSql.getSql(), rb.getOffset(), rb.getLimit());
BoundSql newBoundSql = new BoundSql(ms.getConfiguration(), limitSql, boundSql.getParameterMappings(),
boundSql.getParameterObject());
MetaObject mo = (MetaObject) ReflectionUtils.getFieldValue(boundSql, "metaParameters");
ReflectionUtils.setFieldValue(newBoundSql, "metaParameters", mo);
args[0] = buildMappedStatement(ms, new SqlSourceWrapper(newBoundSql), ms.getId() + "_LIMIT",
ms.getResultMaps());
args[2] = new RowBounds();
args[3] = null;
try {
DaoContextHolder.setSqlName(buildDaoName(ms.getId()) + "_LIMIT");
return invocation.proceed();
} finally {
DaoContextHolder.clearSqlName();
}
}
代码示例来源:origin: org.apache.ibatis/ibatis-core
public BoundSql getBoundSql(Object parameterObject) {
BoundSql boundSql = sqlSource.getBoundSql(parameterObject);
List<ParameterMapping> parameterMappings = boundSql.getParameterMappings();
if (parameterMappings == null || parameterMappings.size() <= 0) {
boundSql = new BoundSql(configuration, boundSql.getSql(), parameterMap.getParameterMappings(), parameterObject);
}
return boundSql;
}
代码示例来源:origin: vakinge/jeesuite-libs
@SuppressWarnings("rawtypes")
private List executeQuery(Executor executor, MappedStatement ms,
Object parameter, BoundSql boundSql,
RowBounds rowBounds, ResultHandler resultHandler,PageParams pageParams) throws IllegalAccessException, SQLException {
CacheKey countKey = executor.createCacheKey(ms, parameter, RowBounds.DEFAULT, boundSql);
String orignSql = StringUtils.replace(boundSql.getSql(), ";$", StringUtils.EMPTY);
String pageSql = PageSqlUtils.getLimitSQL(dbType,orignSql,pageParams);
BoundSql countBoundSql = new BoundSql(ms.getConfiguration(), pageSql, boundSql.getParameterMappings(),
parameter);
List<?> resultList = executor.query(ms, parameter, RowBounds.DEFAULT, resultHandler, countKey,
countBoundSql);
return resultList;
}
代码示例来源:origin: miemiedev/mybatis-paginator
private BoundSql copyFromBoundSql(MappedStatement ms, BoundSql boundSql,
String sql, List<ParameterMapping> parameterMappings,Object parameter) {
BoundSql newBoundSql = new BoundSql(ms.getConfiguration(),sql, parameterMappings, parameter);
for (ParameterMapping mapping : boundSql.getParameterMappings()) {
String prop = mapping.getProperty();
if (boundSql.hasAdditionalParameter(prop)) {
newBoundSql.setAdditionalParameter(prop, boundSql.getAdditionalParameter(prop));
}
}
return newBoundSql;
}
代码示例来源:origin: com.github.miemiedev/mybatis-paginator
private BoundSql copyFromBoundSql(MappedStatement ms, BoundSql boundSql,
String sql, List<ParameterMapping> parameterMappings,Object parameter) {
BoundSql newBoundSql = new BoundSql(ms.getConfiguration(),sql, parameterMappings, parameter);
for (ParameterMapping mapping : boundSql.getParameterMappings()) {
String prop = mapping.getProperty();
if (boundSql.hasAdditionalParameter(prop)) {
newBoundSql.setAdditionalParameter(prop, boundSql.getAdditionalParameter(prop));
}
}
return newBoundSql;
}
代码示例来源:origin: makersoft/mybatis-shards
private BoundSql buildBoundSql(MappedStatement ms, BoundSql boundSql, String sql) {
BoundSql newBoundSql = new BoundSql(ms.getConfiguration(), sql,
boundSql.getParameterMappings(), boundSql.getParameterObject());
for (ParameterMapping mapping : boundSql.getParameterMappings()) {
String prop = mapping.getProperty();
if (boundSql.hasAdditionalParameter(prop)) {
newBoundSql.setAdditionalParameter(prop, boundSql.getAdditionalParameter(prop));
}
}
return newBoundSql;
}
代码示例来源:origin: com.github.monee1988/mybatis-page
private BoundSql copyFromBoundSql(MappedStatement ms, BoundSql boundSql, String sql) {
BoundSql newBoundSql = new BoundSql(ms.getConfiguration(), sql, boundSql.getParameterMappings(),
boundSql.getParameterObject());
for (ParameterMapping mapping : boundSql.getParameterMappings()) {
String prop = mapping.getProperty();
if (boundSql.hasAdditionalParameter(prop)) {
newBoundSql.setAdditionalParameter(prop, boundSql.getAdditionalParameter(prop));
}
}
return newBoundSql;
}
代码示例来源:origin: com.lodsve/lodsve-mybatis
private static BoundSql copyFromBoundSql(MappedStatement ms, BoundSql boundSql, String sql) {
BoundSql newBoundSql = new BoundSql(ms.getConfiguration(), sql, boundSql.getParameterMappings(), boundSql.getParameterObject());
for (ParameterMapping mapping : boundSql.getParameterMappings()) {
String prop = mapping.getProperty();
if (boundSql.hasAdditionalParameter(prop)) {
newBoundSql.setAdditionalParameter(prop, boundSql.getAdditionalParameter(prop));
}
}
return newBoundSql;
}
代码示例来源:origin: net.lizhaoweb.spring.plugin/spring-plugin-mybatis
/**
* 复制BoundSql对象
*/
private BoundSql copyFromBoundSql(MappedStatement ms, BoundSql boundSql, String sql) {
BoundSql newBoundSql = new BoundSql(ms.getConfiguration(), sql, boundSql.getParameterMappings(), boundSql.getParameterObject());
for (ParameterMapping mapping : boundSql.getParameterMappings()) {
String prop = mapping.getProperty();
if (boundSql.hasAdditionalParameter(prop)) {
newBoundSql.setAdditionalParameter(prop, boundSql.getAdditionalParameter(prop));
}
}
return newBoundSql;
}
内容来源于网络,如有侵权,请联系作者删除!