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


Java CacheKey.update方法代码示例

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


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

示例1: processPageParameter

import org.apache.ibatis.cache.CacheKey; //导入方法依赖的package包/类
@Override
public Object processPageParameter(MappedStatement ms, Map<String, Object> paramMap, Page page, BoundSql boundSql, CacheKey pageKey) {
    paramMap.put(PAGEPARAMETER_FIRST, page.getPageSize());
    paramMap.put(PAGEPARAMETER_SECOND, page.getStartRow());
    //处理pageKey
    pageKey.update(page.getPageSize());
    pageKey.update(page.getStartRow());
    //处理参数配置
    if (boundSql.getParameterMappings() != null) {
        List<ParameterMapping> newParameterMappings = new ArrayList<ParameterMapping>();
        if (boundSql != null && boundSql.getParameterMappings() != null) {
            newParameterMappings.addAll(boundSql.getParameterMappings());
        }
        if (page.getPageSize() > 0) {
            newParameterMappings.add(new ParameterMapping.Builder(ms.getConfiguration(), PAGEPARAMETER_FIRST, Integer.class).build());
        }
        if (page.getStartRow() > 0) {
            newParameterMappings.add(new ParameterMapping.Builder(ms.getConfiguration(), PAGEPARAMETER_SECOND, Integer.class).build());
        }
        MetaObject metaObject = MetaObjectUtil.forObject(boundSql);
        metaObject.setValue("parameterMappings", newParameterMappings);
    }
    return paramMap;
}
 
开发者ID:pagehelper,项目名称:Mybatis-PageHelper,代码行数:25,代码来源:HsqldbDialect.java

示例2: processPageParameter

import org.apache.ibatis.cache.CacheKey; //导入方法依赖的package包/类
@Override
public Object processPageParameter(MappedStatement ms, Map<String, Object> paramMap, Page page, BoundSql boundSql, CacheKey pageKey) {
    paramMap.put(PAGEPARAMETER_FIRST, page.getStartRow());
    paramMap.put(PAGEPARAMETER_SECOND, page.getPageSize());
    //处理pageKey
    pageKey.update(page.getStartRow());
    pageKey.update(page.getPageSize());
    //处理参数配置
    if (boundSql.getParameterMappings() != null) {
        List<ParameterMapping> newParameterMappings = new ArrayList<ParameterMapping>();
        if (page.getStartRow() > 0) {
            newParameterMappings.add(new ParameterMapping.Builder(ms.getConfiguration(), PAGEPARAMETER_FIRST, Integer.class).build());
        }
        if (page.getPageSize() > 0) {
            newParameterMappings.add(new ParameterMapping.Builder(ms.getConfiguration(), PAGEPARAMETER_SECOND, Integer.class).build());
        }
        if (boundSql != null && boundSql.getParameterMappings() != null) {
            newParameterMappings.addAll(boundSql.getParameterMappings());
        }
        MetaObject metaObject = MetaObjectUtil.forObject(boundSql);
        metaObject.setValue("parameterMappings", newParameterMappings);
    }
    return paramMap;
}
 
开发者ID:pagehelper,项目名称:Mybatis-PageHelper,代码行数:25,代码来源:InformixDialect.java

示例3: processPageParameter

import org.apache.ibatis.cache.CacheKey; //导入方法依赖的package包/类
@Override
public Object processPageParameter(MappedStatement ms, Map<String, Object> paramMap, Page page, BoundSql boundSql, CacheKey pageKey) {
    paramMap.put(PAGEPARAMETER_FIRST, page.getStartRow());
    paramMap.put(PAGEPARAMETER_SECOND, page.getPageSize());
    //处理pageKey
    pageKey.update(page.getStartRow());
    pageKey.update(page.getPageSize());
    //处理参数配置
    if (boundSql.getParameterMappings() != null) {
        List<ParameterMapping> newParameterMappings = new ArrayList<ParameterMapping>();
        if (boundSql != null && boundSql.getParameterMappings() != null) {
            newParameterMappings.addAll(boundSql.getParameterMappings());
        }
        if (page.getStartRow() == 0) {
            newParameterMappings.add(new ParameterMapping.Builder(ms.getConfiguration(), PAGEPARAMETER_SECOND, Integer.class).build());
        } else {
            newParameterMappings.add(new ParameterMapping.Builder(ms.getConfiguration(), PAGEPARAMETER_FIRST, Integer.class).build());
            newParameterMappings.add(new ParameterMapping.Builder(ms.getConfiguration(), PAGEPARAMETER_SECOND, Integer.class).build());
        }
        MetaObject metaObject = MetaObjectUtil.forObject(boundSql);
        metaObject.setValue("parameterMappings", newParameterMappings);
    }
    return paramMap;
}
 
开发者ID:pagehelper,项目名称:Mybatis-PageHelper,代码行数:25,代码来源:MySqlDialect.java

示例4: createKeyForMultipleResults

import org.apache.ibatis.cache.CacheKey; //导入方法依赖的package包/类
private CacheKey createKeyForMultipleResults(ResultSet rs, ResultMapping resultMapping, String names, String columns) throws SQLException {
  CacheKey cacheKey = new CacheKey();
  cacheKey.update(resultMapping);
  if (columns != null && names != null) {
    String[] columnsArray = columns.split(",");
    String[] namesArray = names.split(",");
    for (int i = 0 ; i < columnsArray.length ; i++) {
      Object value = rs.getString(columnsArray[i]);
      if (value != null) {
        cacheKey.update(namesArray[i]);
        cacheKey.update(value);
      }
    }
  }
  return cacheKey;
}
 
开发者ID:yuexiahandao,项目名称:MybatisCode,代码行数:17,代码来源:DefaultResultSetHandler.java

示例5: createRowKey

import org.apache.ibatis.cache.CacheKey; //导入方法依赖的package包/类
private CacheKey createRowKey(ResultMap resultMap, ResultSetWrapper rsw, String columnPrefix) throws SQLException {
  final CacheKey cacheKey = new CacheKey();
  cacheKey.update(resultMap.getId());
  List<ResultMapping> resultMappings = getResultMappingsForRowKey(resultMap);
  if (resultMappings.size() == 0) {
    if (Map.class.isAssignableFrom(resultMap.getType())) {
      createRowKeyForMap(rsw, cacheKey);
    } else {
      createRowKeyForUnmappedProperties(resultMap, rsw, cacheKey, columnPrefix);
    }
  } else {
    createRowKeyForMappedProperties(resultMap, rsw, cacheKey, resultMappings, columnPrefix);
  }
  if (cacheKey.getUpdateCount() < 2) {
    return CacheKey.NULL_CACHE_KEY;
  }    
  return cacheKey;
}
 
开发者ID:yuexiahandao,项目名称:MybatisCode,代码行数:19,代码来源:DefaultResultSetHandler.java

示例6: createRowKeyForMappedProperties

import org.apache.ibatis.cache.CacheKey; //导入方法依赖的package包/类
private void createRowKeyForMappedProperties(ResultMap resultMap, ResultSetWrapper rsw, CacheKey cacheKey, List<ResultMapping> resultMappings, String columnPrefix) throws SQLException {
  for (ResultMapping resultMapping : resultMappings) {
    if (resultMapping.getNestedResultMapId() != null && resultMapping.getResultSet() == null) {
      // Issue #392
      final ResultMap nestedResultMap = configuration.getResultMap(resultMapping.getNestedResultMapId());
      createRowKeyForMappedProperties(nestedResultMap, rsw, cacheKey, nestedResultMap.getConstructorResultMappings(),
          prependPrefix(resultMapping.getColumnPrefix(), columnPrefix));
    } else if (resultMapping.getNestedQueryId() == null) {
      final String column = prependPrefix(resultMapping.getColumn(), columnPrefix);
      final TypeHandler<?> th = resultMapping.getTypeHandler();
      List<String> mappedColumnNames = rsw.getMappedColumnNames(resultMap, columnPrefix);
      // Issue #114
      if (column != null && mappedColumnNames.contains(column.toUpperCase(Locale.ENGLISH))) {
        final Object value = th.getResult(rsw.getResultSet(), column);
        if (value != null) {
          cacheKey.update(column);
          cacheKey.update(value);
        }
      }
    }
  }
}
 
开发者ID:yuexiahandao,项目名称:MybatisCode,代码行数:23,代码来源:DefaultResultSetHandler.java

示例7: createRowKeyForUnmappedProperties

import org.apache.ibatis.cache.CacheKey; //导入方法依赖的package包/类
private void createRowKeyForUnmappedProperties(ResultMap resultMap, ResultSetWrapper rsw, CacheKey cacheKey, String columnPrefix) throws SQLException {
  final MetaClass metaType = MetaClass.forClass(resultMap.getType(), reflectorFactory);
  List<String> unmappedColumnNames = rsw.getUnmappedColumnNames(resultMap, columnPrefix);
  for (String column : unmappedColumnNames) {
    String property = column;
    if (columnPrefix != null && !columnPrefix.isEmpty()) {
      // When columnPrefix is specified, ignore columns without the prefix.
      if (column.toUpperCase(Locale.ENGLISH).startsWith(columnPrefix)) {
        property = column.substring(columnPrefix.length());
      } else {
        continue;
      }
    }
    if (metaType.findProperty(property, configuration.isMapUnderscoreToCamelCase()) != null) {
      String value = rsw.getResultSet().getString(column);
      if (value != null) {
        cacheKey.update(column);
        cacheKey.update(value);
      }
    }
  }
}
 
开发者ID:yuexiahandao,项目名称:MybatisCode,代码行数:23,代码来源:DefaultResultSetHandler.java

示例8: createRowKeyForUnmappedProperties

import org.apache.ibatis.cache.CacheKey; //导入方法依赖的package包/类
private void createRowKeyForUnmappedProperties(ResultMap resultMap, ResultSetWrapper rsw, CacheKey cacheKey, String columnPrefix) throws SQLException {
  final MetaClass metaType = MetaClass.forClass(resultMap.getType());
  List<String> unmappedColumnNames = rsw.getUnmappedColumnNames(resultMap, columnPrefix);
  for (String column : unmappedColumnNames) {
    String property = column;
    if (columnPrefix != null && !columnPrefix.isEmpty()) {
      // When columnPrefix is specified, ignore columns without the prefix.
      if (column.toUpperCase(Locale.ENGLISH).startsWith(columnPrefix)) {
        property = column.substring(columnPrefix.length());
      } else {
        continue;
      }
    }
    if (metaType.findProperty(property, configuration.isMapUnderscoreToCamelCase()) != null) {
      String value = rsw.getResultSet().getString(column);
      if (value != null) {
        cacheKey.update(column);
        cacheKey.update(value);
      }
    }
  }
}
 
开发者ID:shurun19851206,项目名称:mybaties,代码行数:23,代码来源:DefaultResultSetHandler.java

示例9: getPageSql

import org.apache.ibatis.cache.CacheKey; //导入方法依赖的package包/类
@Override
public String getPageSql(String sql, Page page, CacheKey pageKey) {
    //处理pageKey
    pageKey.update(page.getStartRow());
    pageKey.update(page.getPageSize());
    String cacheSql = CACHE_PAGESQL.get(sql);
    if (cacheSql == null) {
        cacheSql = sql;
        cacheSql = replaceSql.replace(cacheSql);
        cacheSql = pageSql.convertToPageSql(cacheSql, null, null);
        cacheSql = replaceSql.restore(cacheSql);
        CACHE_PAGESQL.put(sql, cacheSql);
    }
    cacheSql = cacheSql.replace(String.valueOf(Long.MIN_VALUE), String.valueOf(page.getStartRow()));
    cacheSql = cacheSql.replace(String.valueOf(Long.MAX_VALUE), String.valueOf(page.getPageSize()));
    return cacheSql;
}
 
开发者ID:pagehelper,项目名称:Mybatis-PageHelper,代码行数:18,代码来源:SqlServerDialect.java

示例10: processPageParameter

import org.apache.ibatis.cache.CacheKey; //导入方法依赖的package包/类
@Override
public Object processPageParameter(MappedStatement ms, Map<String, Object> paramMap, Page page, BoundSql boundSql, CacheKey pageKey) {
    paramMap.put(PAGEPARAMETER_FIRST, page.getStartRow() + 1);
    paramMap.put(PAGEPARAMETER_SECOND, page.getEndRow());
    //处理pageKey
    pageKey.update(page.getStartRow() + 1);
    pageKey.update(page.getEndRow());
    //处理参数配置
    if (boundSql.getParameterMappings() != null) {
        List<ParameterMapping> newParameterMappings = new ArrayList<ParameterMapping>();
        if (boundSql != null && boundSql.getParameterMappings() != null) {
            newParameterMappings.addAll(boundSql.getParameterMappings());
        }
        newParameterMappings.add(new ParameterMapping.Builder(ms.getConfiguration(), PAGEPARAMETER_FIRST, Integer.class).build());
        newParameterMappings.add(new ParameterMapping.Builder(ms.getConfiguration(), PAGEPARAMETER_SECOND, Integer.class).build());
        MetaObject metaObject = MetaObjectUtil.forObject(boundSql);
        metaObject.setValue("parameterMappings", newParameterMappings);
    }
    return paramMap;
}
 
开发者ID:pagehelper,项目名称:Mybatis-PageHelper,代码行数:21,代码来源:Db2Dialect.java

示例11: processPageParameter

import org.apache.ibatis.cache.CacheKey; //导入方法依赖的package包/类
@Override
public Object processPageParameter(MappedStatement ms, Map<String, Object> paramMap, Page page, BoundSql boundSql, CacheKey pageKey) {
    paramMap.put(PAGEPARAMETER_FIRST, page.getEndRow());
    paramMap.put(PAGEPARAMETER_SECOND, page.getStartRow());
    //处理pageKey
    pageKey.update(page.getEndRow());
    pageKey.update(page.getStartRow());
    //处理参数配置
    if (boundSql.getParameterMappings() != null) {
        List<ParameterMapping> newParameterMappings = new ArrayList<ParameterMapping>();
        if (boundSql != null && boundSql.getParameterMappings() != null) {
            newParameterMappings.addAll(boundSql.getParameterMappings());
        }
        newParameterMappings.add(new ParameterMapping.Builder(ms.getConfiguration(), PAGEPARAMETER_FIRST, Integer.class).build());
        newParameterMappings.add(new ParameterMapping.Builder(ms.getConfiguration(), PAGEPARAMETER_SECOND, Integer.class).build());
        MetaObject metaObject = MetaObjectUtil.forObject(boundSql);
        metaObject.setValue("parameterMappings", newParameterMappings);
    }
    return paramMap;
}
 
开发者ID:pagehelper,项目名称:Mybatis-PageHelper,代码行数:21,代码来源:OracleDialect.java

示例12: getPageSql

import org.apache.ibatis.cache.CacheKey; //导入方法依赖的package包/类
@Override
public String getPageSql(String sql, Page page, CacheKey pageKey) {
    StringBuilder sqlBuilder = new StringBuilder(sql.length() + 14);
    sqlBuilder.append(sql);
    if (page.getStartRow() == 0) {
        sqlBuilder.append(" LIMIT ? ");
    } else {
        sqlBuilder.append(" LIMIT ?, ? ");
    }
    pageKey.update(page.getPageSize());
    return sqlBuilder.toString();
}
 
开发者ID:pagehelper,项目名称:Mybatis-PageHelper,代码行数:13,代码来源:MySqlDialect.java

示例13: processPageParameter

import org.apache.ibatis.cache.CacheKey; //导入方法依赖的package包/类
@Override
public Object processPageParameter(MappedStatement ms, Map<String, Object> paramMap, Page page, BoundSql boundSql, CacheKey pageKey) {
    paramMap.put(PAGEPARAMETER_FIRST, page.getStartRow());
    paramMap.put(PAGEPARAMETER_SECOND, page.getPageSize());
    //处理pageKey
    pageKey.update(page.getStartRow());
    pageKey.update(page.getPageSize());
    //处理参数配置
    if (boundSql.getParameterMappings() != null) {
        List<ParameterMapping> newParameterMappings = new ArrayList<ParameterMapping>();
        if (boundSql != null && boundSql.getParameterMappings() != null) {
            newParameterMappings.addAll(boundSql.getParameterMappings());
        }
        newParameterMappings.add(new ParameterMapping.Builder(ms.getConfiguration(), PAGEPARAMETER_FIRST, Integer.class).build());
        newParameterMappings.add(new ParameterMapping.Builder(ms.getConfiguration(), PAGEPARAMETER_SECOND, Integer.class).build());
        MetaObject metaObject = MetaObjectUtil.forObject(boundSql);
        metaObject.setValue("parameterMappings", newParameterMappings);
    }
    return paramMap;
}
 
开发者ID:pagehelper,项目名称:Mybatis-PageHelper,代码行数:21,代码来源:SqlServer2012Dialect.java

示例14: getPageSql

import org.apache.ibatis.cache.CacheKey; //导入方法依赖的package包/类
@Override
public String getPageSql(String sql, RowBounds rowBounds, CacheKey pageKey) {
    StringBuilder sqlBuilder = new StringBuilder(sql.length() + 14);
    sqlBuilder.append(sql);
    if (rowBounds.getOffset() == 0) {
        sqlBuilder.append(" LIMIT ");
        sqlBuilder.append(rowBounds.getLimit());
    } else {
        sqlBuilder.append(" LIMIT ");
        sqlBuilder.append(rowBounds.getOffset());
        sqlBuilder.append(",");
        sqlBuilder.append(rowBounds.getLimit());
        pageKey.update(rowBounds.getOffset());
    }
    pageKey.update(rowBounds.getLimit());
    return sqlBuilder.toString();
}
 
开发者ID:pagehelper,项目名称:Mybatis-PageHelper,代码行数:18,代码来源:MySqlRowBoundsDialect.java

示例15: getPageSql

import org.apache.ibatis.cache.CacheKey; //导入方法依赖的package包/类
@Override
public String getPageSql(String sql, RowBounds rowBounds, CacheKey pageKey) {
    StringBuilder sqlBuilder = new StringBuilder(sql.length() + 40);
    sqlBuilder.append("SELECT ");
    if (rowBounds.getOffset() > 0) {
        sqlBuilder.append(" SKIP ");
        sqlBuilder.append(rowBounds.getOffset());
        pageKey.update(rowBounds.getOffset());
    }
    if (rowBounds.getLimit() > 0) {
        sqlBuilder.append(" FIRST ");
        sqlBuilder.append(rowBounds.getLimit());
        pageKey.update(rowBounds.getLimit());
    }
    sqlBuilder.append(" * FROM ( ");
    sqlBuilder.append(sql);
    sqlBuilder.append(" ) TEMP_T");
    return sqlBuilder.toString();
}
 
开发者ID:pagehelper,项目名称:Mybatis-PageHelper,代码行数:20,代码来源:InformixRowBoundsDialect.java


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