code: public static String getNamespaceSql(SqlSession session, String namespace, Object params) {
          params = wrapCollection(params);
          Configuration configuration = session.getConfiguration();
          MappedStatement mappedStatement = configuration.getMappedStatement(namespace);
          TypeHandlerRegistry typeHandlerRegistry = mappedStatement.getConfiguration().getTypeHandlerRegistry();
          BoundSql boundSql = mappedStatement.getBoundSql(params);
          List<ParameterMapping> parameterMappings = boundSql.getParameterMappings();
          String sql = boundSql.getSql();
          if (parameterMappings != null) {
              for (int i = 0; i < parameterMappings.size(); i++) {
                  ParameterMapping parameterMapping = parameterMappings.get(i);
                  if (parameterMapping.getMode() != ParameterMode.OUT) {
                      Object value;
                      String propertyName = parameterMapping.getProperty();
                      if (boundSql.hasAdditionalParameter(propertyName)) {
                          value = boundSql.getAdditionalParameter(propertyName);
                      } else if (params == null) {
                          value = null;
                      } else if (typeHandlerRegistry.hasTypeHandler(params.getClass())) {
                          value = params;
                      } else {
                          MetaObject metaObject = configuration.newMetaObject(params);
                          value = metaObject.getValue(propertyName);
                      }
                      JdbcType jdbcType = parameterMapping.getJdbcType();
                      if (value == null && jdbcType == null) {
                          jdbcType = configuration.getJdbcTypeForNull();
                      }
                      sql = replaceParameter(sql, value, jdbcType, parameterMapping.getJavaType());
                  }
              }
          }
          return sql;
      }
docs: 通过命名空间方式获取sql