日期:2014-05-16 浏览次数:20597 次
/** * 查询所有记录 * * @param mapperId * @param map * @return * @throws Exception */ public List<Map<String, Object>> selectAllList(String sqlKey, Map<String, Object> map) { SqlMapper sqlMapper = sqlTemplate.getSqlMapper(sqlKey); String cacheKey = getCacheKey(sqlKey, map); if (sqlMapper == null) { throw new RuntimeException("load sqlconfig error :" + sqlKey); } if (sqlMapper.isFlushCache()) { dataCache.removeObject(cacheKey); } if (sqlMapper.isUseCache()) { if (dataCache.getObject(cacheKey) != null) { log.debug("load from cacheKey : " + cacheKey); return (List<Map<String, Object>>) dataCache .getObject(cacheKey); } else { log.debug("reload cacheKey : " + cacheKey); List<Map<String, Object>> rs = this.queryForList( sqlTemplate.getSql(sqlKey, map), map); dataCache.putObject(cacheKey, rs); return rs; } } else { List<Map<String, Object>> rs = this.queryForList( sqlTemplate.getSql(sqlKey, map), map); return rs; } }