当前位置: 首页>>代码示例>>Java>>正文


Java MappedStatement.getKeyProperties方法代码示例

本文整理汇总了Java中org.apache.ibatis.mapping.MappedStatement.getKeyProperties方法的典型用法代码示例。如果您正苦于以下问题:Java MappedStatement.getKeyProperties方法的具体用法?Java MappedStatement.getKeyProperties怎么用?Java MappedStatement.getKeyProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.ibatis.mapping.MappedStatement的用法示例。


在下文中一共展示了MappedStatement.getKeyProperties方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: copyFromMappedStatement

import org.apache.ibatis.mapping.MappedStatement; //导入方法依赖的package包/类
private MappedStatement copyFromMappedStatement(MappedStatement ms,
		SqlSource newSqlSource) {
	MappedStatement.Builder builder = new MappedStatement.Builder(
			ms.getConfiguration(), ms.getId(), newSqlSource,
			ms.getSqlCommandType());
	builder.resource(ms.getResource());
	builder.fetchSize(ms.getFetchSize());
	builder.statementType(ms.getStatementType());
	builder.keyGenerator(ms.getKeyGenerator());
	if (null != ms.getKeyProperties()) {
		for (String keyProperty : ms.getKeyProperties()) {
			builder.keyProperty(keyProperty);
		}
	}
	builder.timeout(ms.getTimeout());
	builder.parameterMap(ms.getParameterMap());
	builder.resultMaps(ms.getResultMaps());
	builder.cache(ms.getCache());
	return builder.build();
}
 
开发者ID:jiangzongyao,项目名称:kettle_support_kettle8.0,代码行数:21,代码来源:PaginationInterceptor.java

示例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();
}
 
开发者ID:wulizhong,项目名称:mybatis-dao,代码行数:29,代码来源:PagePlugin.java

示例3: copyFromMappedStatement

import org.apache.ibatis.mapping.MappedStatement; //导入方法依赖的package包/类
private MappedStatement copyFromMappedStatement(MappedStatement ms,SqlSource newSqlSource) {
	Builder builder = new Builder(ms.getConfiguration(),ms.getId(),newSqlSource,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){
           StringBuffer keyProperties = new StringBuffer();
           for(String keyProperty : ms.getKeyProperties()){
               keyProperties.append(keyProperty).append(",");
           }
           keyProperties.delete(keyProperties.length()-1, keyProperties.length());
		builder.keyProperty(keyProperties.toString());
	}
	
	//setStatementTimeout()
	builder.timeout(ms.getTimeout());
	
	//setStatementResultMap()
	builder.parameterMap(ms.getParameterMap());
	
	//setStatementResultMap()
       builder.resultMaps(ms.getResultMaps());
	builder.resultSetType(ms.getResultSetType());
    
	//setStatementCache()
	builder.cache(ms.getCache());
	builder.flushCacheRequired(ms.isFlushCacheRequired());
	builder.useCache(ms.isUseCache());
	
	return builder.build();
}
 
开发者ID:AsuraTeam,项目名称:asura,代码行数:34,代码来源:OffsetLimitInterceptor.java

示例4: copyFromMappedStatement

import org.apache.ibatis.mapping.MappedStatement; //导入方法依赖的package包/类
private MappedStatement copyFromMappedStatement(MappedStatement ms, SqlSource newSqlSource)
{
	Builder builder = new MappedStatement.Builder(ms.getConfiguration(), ms.getId(), newSqlSource, ms.getSqlCommandType());
	builder.resource(ms.getResource());
	builder.fetchSize(ms.getFetchSize());
	builder.statementType(ms.getStatementType());
	builder.keyGenerator(ms.getKeyGenerator());
	String[] arr = ms.getKeyProperties();
	if(arr != null && arr.length > 0)
	{
		StringBuilder sb = new StringBuilder();
		for(String s : arr)
		{
			sb.append(",").append(s);
		}
		if(sb.length() > 0)
		{
			sb.delete(0, 1);
		}
		builder.keyProperty(sb.toString());
	}
	// setStatementTimeout()
	builder.timeout(ms.getTimeout());
	// setStatementResultMap()
	builder.parameterMap(ms.getParameterMap());
	// setStatementResultMap()
	builder.resultMaps(ms.getResultMaps());
	builder.resultSetType(ms.getResultSetType());
	// setStatementCache()
	builder.cache(ms.getCache());
	builder.flushCacheRequired(ms.isFlushCacheRequired());
	builder.useCache(ms.isUseCache());
	return builder.build();
}
 
开发者ID:skeychen,项目名称:dswork,代码行数:35,代码来源:OffsetLimitInterceptor.java

示例5: 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;
    }

}
 
开发者ID:warlock-china,项目名称:azeroth,代码行数:59,代码来源:PaginationHandler.java


注:本文中的org.apache.ibatis.mapping.MappedStatement.getKeyProperties方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。