當前位置: 首頁>>代碼示例>>Java>>正文


Java MappedStatement.getSqlSource方法代碼示例

本文整理匯總了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);
                }
            }
        }
    }
}
 
開發者ID:Yanweichen,項目名稱:MybatisGeneatorUtil,代碼行數:25,代碼來源:MapperHelper.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: 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

示例4: isDynamic

import org.apache.ibatis.mapping.MappedStatement; //導入方法依賴的package包/類
/**
 * 判斷當前執行的是否為動態sql
 *
 * @param ms
 * @return
 */
public boolean isDynamic(MappedStatement ms) {
    return ms.getSqlSource() instanceof DynamicSqlSource;
}
 
開發者ID:PekingGo,項目名稱:ipayquery,代碼行數:10,代碼來源:SqlUtil.java


注:本文中的org.apache.ibatis.mapping.MappedStatement.getSqlSource方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。