本文整理汇总了Java中org.apache.ibatis.mapping.MappedStatement.getSqlSource方法的典型用法代码示例。如果您正苦于以下问题:Java MappedStatement.getSqlSource方法的具体用法?Java MappedStatement.getSqlSource怎么用?Java MappedStatement.getSqlSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ibatis.mapping.MappedStatement
的用法示例。
在下文中一共展示了MappedStatement.getSqlSource方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processConfiguration
import org.apache.ibatis.mapping.MappedStatement; //导入方法依赖的package包/类
/**
* 配置指定的接口
*
* @param configuration
* @param mapperInterface
*/
public void processConfiguration(Configuration configuration, Class<?> mapperInterface) {
String prefix;
if (mapperInterface != null) {
prefix = mapperInterface.getCanonicalName();
} else {
prefix = "";
}
for (Object object : new ArrayList<Object>(configuration.getMappedStatements())) {
if (object instanceof MappedStatement) {
MappedStatement ms = (MappedStatement) object;
if (ms.getId().startsWith(prefix) && isMapperMethod(ms.getId())) {
if (ms.getSqlSource() instanceof ProviderSqlSource) {
setSqlSource(ms);
}
}
}
}
}
示例2: createCountMappedStatement
import org.apache.ibatis.mapping.MappedStatement; //导入方法依赖的package包/类
private MappedStatement createCountMappedStatement(MappedStatement ms, String newMsId) {
MappedStatement.Builder builder = new MappedStatement.Builder(ms.getConfiguration(), newMsId, ms.getSqlSource(), ms.getSqlCommandType());
builder.resource(ms.getResource());
builder.fetchSize(ms.getFetchSize());
builder.statementType(ms.getStatementType());
builder.keyGenerator(ms.getKeyGenerator());
if (ms.getKeyProperties() != null && ms.getKeyProperties().length != 0) {
StringBuilder keyProperties = new StringBuilder();
for (String keyProperty : ms.getKeyProperties()) {
keyProperties.append(keyProperty).append(",");
}
keyProperties.delete(keyProperties.length() - 1, keyProperties.length());
builder.keyProperty(keyProperties.toString());
}
builder.timeout(ms.getTimeout());
builder.parameterMap(ms.getParameterMap());
//count查询返回值int
List<ResultMap> resultMaps = new ArrayList<ResultMap>();
ResultMap resultMap = new ResultMap.Builder(ms.getConfiguration(), ms.getId(), Long.class, new ArrayList<ResultMapping>(0)).build();
resultMaps.add(resultMap);
builder.resultMaps(resultMaps);
builder.resultSetType(ms.getResultSetType());
builder.cache(ms.getCache());
builder.flushCacheRequired(ms.isFlushCacheRequired());
builder.useCache(ms.isUseCache());
return builder.build();
}
示例3: getCountMappedStatement
import org.apache.ibatis.mapping.MappedStatement; //导入方法依赖的package包/类
/**
* 新建count查询的MappedStatement
*
* @param ms
* @return
*/
public MappedStatement getCountMappedStatement(MappedStatement ms) {
String newMsId = ms.getId() + PAGE_COUNT_SUFFIX;
MappedStatement statement = null;
Configuration configuration = ms.getConfiguration();
try {
statement = configuration.getMappedStatement(newMsId);
if (statement != null) { return statement; }
} catch (Exception e) {
}
synchronized (configuration) {
if (configuration.hasStatement(newMsId)) { return configuration.getMappedStatement(newMsId); }
MappedStatement.Builder builder = new MappedStatement.Builder(ms.getConfiguration(),
newMsId, ms.getSqlSource(), ms.getSqlCommandType());
builder.resource(ms.getResource());
builder.fetchSize(ms.getFetchSize());
builder.statementType(ms.getStatementType());
builder.keyGenerator(ms.getKeyGenerator());
if (ms.getKeyProperties() != null && ms.getKeyProperties().length != 0) {
StringBuilder keyProperties = new StringBuilder();
for (String keyProperty : ms.getKeyProperties()) {
keyProperties.append(keyProperty).append(",");
}
keyProperties.delete(keyProperties.length() - 1, keyProperties.length());
builder.keyProperty(keyProperties.toString());
}
builder.timeout(ms.getTimeout());
builder.parameterMap(ms.getParameterMap());
//count查询返回值int
List<ResultMap> resultMaps = new ArrayList<ResultMap>();
String id = newMsId + "-Inline";
ResultMap resultMap = new ResultMap.Builder(configuration, id, Long.class,
new ArrayList<ResultMapping>(0)).build();
resultMaps.add(resultMap);
builder.resultMaps(resultMaps);
builder.resultSetType(ms.getResultSetType());
builder.cache(ms.getCache());
builder.flushCacheRequired(ms.isFlushCacheRequired());
builder.useCache(ms.isUseCache());
statement = builder.build();
configuration.addMappedStatement(statement);
return statement;
}
}
示例4: isDynamic
import org.apache.ibatis.mapping.MappedStatement; //导入方法依赖的package包/类
/**
* 判断当前执行的是否为动态sql
*
* @param ms
* @return
*/
public boolean isDynamic(MappedStatement ms) {
return ms.getSqlSource() instanceof DynamicSqlSource;
}