@Override
  public void select(
      final String statementName, final Object parameterObject, final ResultHandler handler) {
    if (isSqlAuditorBehaviorEnabled()) {
      getSqlAuditor()
          .audit(
              statementName,
              getSqlByStatementName(statementName, parameterObject),
              parameterObject);
    }
    if (isPartitioningBehaviorEnabled()) {
      SortedMap<String, DataSource> dsMap =
          lookupDataSourcesByRouter(statementName, parameterObject);
      if (dsMap != null && !dsMap.isEmpty()) {
        SqlSessionCallback action =
            new SqlSessionCallback() {
              @Override
              public Object doInSession(SqlSession sqlSession) {
                sqlSession.select(statementName, parameterObject, handler);
                return null;
              }
            };

        if (dsMap.size() == 1) {
          executeWith(dsMap.get(dsMap.firstKey()), action);
        } else {
          executeInConcurrency(action, dsMap);
        }
      }
    }
    super.select(statementName, parameterObject, handler);
  }
  @Override
  public Map<?, ?> selectMap(
      final String statementName,
      final Object parameterObject,
      final String mapKey,
      final RowBounds rowBounds) {
    if (isSqlAuditorBehaviorEnabled()) {
      getSqlAuditor()
          .audit(
              statementName,
              getSqlByStatementName(statementName, parameterObject),
              parameterObject);
    }
    if (isPartitioningBehaviorEnabled()) {
      SortedMap<String, DataSource> dsMap =
          lookupDataSourcesByRouter(statementName, parameterObject);
      if (dsMap != null && !dsMap.isEmpty()) {

        SqlSessionCallback action =
            new SqlSessionCallback<Map<?, ?>>() {
              @Override
              public Map<?, ?> doInSession(SqlSession sqlSession) {
                return sqlSession.selectMap(statementName, parameterObject, mapKey, rowBounds);
              }
            };

        if (dsMap.size() == 1) {
          return (Map<?, ?>) executeWith(dsMap.get(dsMap.firstKey()), action);
        } else {
          List<Object> results = executeInConcurrency(action, dsMap);
          Map<?, ?> retVal = Maps.newHashMap();
          if (results != null && !results.isEmpty()) {
            for (int i = 0; i < results.size(); i++) {
              retVal.putAll((Map) results.get(i));
            }
          }

          return retVal;
        }
      }
    }

    return super.selectMap(statementName, parameterObject, mapKey, rowBounds);
  }
  /**
   * 更新记录
   *
   * @param statementName
   * @param parameterObject
   * @return
   */
  @Override
  public int update(final String statementName, final Object parameterObject) {
    if (isSqlAuditorBehaviorEnabled()) {
      getSqlAuditor()
          .audit(
              statementName,
              getSqlByStatementName(statementName, parameterObject),
              parameterObject);
    }
    if (isPartitioningBehaviorEnabled()) {
      SortedMap<String, DataSource> dsMap =
          lookupDataSourcesByRouter(statementName, parameterObject);
      if (dsMap != null && !dsMap.isEmpty()) {
        SqlSessionCallback action =
            new SqlSessionCallback() {
              @Override
              public Object doInSession(SqlSession sqlSession) {
                return sqlSession.update(statementName, parameterObject);
              }
            };

        if (dsMap.size() == 1) {
          return (Integer) executeWith(dsMap.get(dsMap.firstKey()), action);
        } else {
          List<Object> results = executeInConcurrency(action, dsMap);

          Integer rowAffected = 0;

          if (results != null && !results.isEmpty()) {
            for (Object item : results) {
              rowAffected += (Integer) item;
            }
          }
          return rowAffected;
        }
      }
    }
    return super.update(statementName, parameterObject);
  }