diff --git a/APIJSONORM/src/main/java/apijson/orm/AbstractObjectParser.java b/APIJSONORM/src/main/java/apijson/orm/AbstractObjectParser.java index 003aee026..3f3a09a04 100755 --- a/APIJSONORM/src/main/java/apijson/orm/AbstractObjectParser.java +++ b/APIJSONORM/src/main/java/apijson/orm/AbstractObjectParser.java @@ -332,22 +332,22 @@ else if (sqlConfig.isClickHouse()) { } if (isTable) { - if (parser.getGlobleDatabase() != null && sqlRequest.get(JSONRequest.KEY_DATABASE) == null) { - sqlRequest.put(JSONRequest.KEY_DATABASE, parser.getGlobleDatabase()); + if (parser.getGlobalDatabase() != null && sqlRequest.get(JSONRequest.KEY_DATABASE) == null) { + sqlRequest.put(JSONRequest.KEY_DATABASE, parser.getGlobalDatabase()); } - if (parser.getGlobleSchema() != null && sqlRequest.get(JSONRequest.KEY_SCHEMA) == null) { - sqlRequest.put(JSONRequest.KEY_SCHEMA, parser.getGlobleSchema()); + if (parser.getGlobalSchema() != null && sqlRequest.get(JSONRequest.KEY_SCHEMA) == null) { + sqlRequest.put(JSONRequest.KEY_SCHEMA, parser.getGlobalSchema()); } - if (parser.getGlobleDatasource() != null && sqlRequest.get(JSONRequest.KEY_DATASOURCE) == null) { - sqlRequest.put(JSONRequest.KEY_DATASOURCE, parser.getGlobleDatasource()); + if (parser.getGlobalDatasource() != null && sqlRequest.get(JSONRequest.KEY_DATASOURCE) == null) { + sqlRequest.put(JSONRequest.KEY_DATASOURCE, parser.getGlobalDatasource()); } if (isSubquery == false) { //解决 SQL 语法报错,子查询不能 EXPLAIN - if (parser.getGlobleExplain() != null && sqlRequest.get(JSONRequest.KEY_EXPLAIN) == null) { - sqlRequest.put(JSONRequest.KEY_EXPLAIN, parser.getGlobleExplain()); + if (parser.getGlobalExplain() != null && sqlRequest.get(JSONRequest.KEY_EXPLAIN) == null) { + sqlRequest.put(JSONRequest.KEY_EXPLAIN, parser.getGlobalExplain()); } - if (parser.getGlobleCache() != null && sqlRequest.get(JSONRequest.KEY_CACHE) == null) { - sqlRequest.put(JSONRequest.KEY_CACHE, parser.getGlobleCache()); + if (parser.getGlobalCache() != null && sqlRequest.get(JSONRequest.KEY_CACHE) == null) { + sqlRequest.put(JSONRequest.KEY_CACHE, parser.getGlobalCache()); } } } diff --git a/APIJSONORM/src/main/java/apijson/orm/AbstractParser.java b/APIJSONORM/src/main/java/apijson/orm/AbstractParser.java index 25e851bf0..f56af8cc8 100755 --- a/APIJSONORM/src/main/java/apijson/orm/AbstractParser.java +++ b/APIJSONORM/src/main/java/apijson/orm/AbstractParser.java @@ -187,69 +187,69 @@ public AbstractParser setRequest(JSONObject request) { return this; } - protected Boolean globleFormat; - public AbstractParser setGlobleFormat(Boolean globleFormat) { - this.globleFormat = globleFormat; + protected Boolean globalFormat; + public AbstractParser setGlobalFormat(Boolean globalFormat) { + this.globalFormat = globalFormat; return this; } @Override - public Boolean getGlobleFormat() { - return globleFormat; + public Boolean getGlobalFormat() { + return globalFormat; } - protected String globleRole; - public AbstractParser setGlobleRole(String globleRole) { - this.globleRole = globleRole; + protected String globalRole; + public AbstractParser setGlobalRole(String globalRole) { + this.globalRole = globalRole; return this; } @Override - public String getGlobleRole() { - return globleRole; + public String getGlobalRole() { + return globalRole; } - protected String globleDatabase; - public AbstractParser setGlobleDatabase(String globleDatabase) { - this.globleDatabase = globleDatabase; + protected String globalDatabase; + public AbstractParser setGlobalDatabase(String globalDatabase) { + this.globalDatabase = globalDatabase; return this; } @Override - public String getGlobleDatabase() { - return globleDatabase; + public String getGlobalDatabase() { + return globalDatabase; } - protected String globleSchema; - public AbstractParser setGlobleSchema(String globleSchema) { - this.globleSchema = globleSchema; + protected String globalSchema; + public AbstractParser setGlobalSchema(String globalSchema) { + this.globalSchema = globalSchema; return this; } @Override - public String getGlobleSchema() { - return globleSchema; + public String getGlobalSchema() { + return globalSchema; } - protected String globleDatasource; + protected String globalDatasource; @Override - public String getGlobleDatasource() { - return globleDatasource; + public String getGlobalDatasource() { + return globalDatasource; } - public AbstractParser setGlobleDatasource(String globleDatasource) { - this.globleDatasource = globleDatasource; + public AbstractParser setGlobalDatasource(String globalDatasource) { + this.globalDatasource = globalDatasource; return this; } - protected Boolean globleExplain; - public AbstractParser setGlobleExplain(Boolean globleExplain) { - this.globleExplain = globleExplain; + protected Boolean globalExplain; + public AbstractParser setGlobalExplain(Boolean globalExplain) { + this.globalExplain = globalExplain; return this; } @Override - public Boolean getGlobleExplain() { - return globleExplain; + public Boolean getGlobalExplain() { + return globalExplain; } - protected String globleCache; - public AbstractParser setGlobleCache(String globleCache) { - this.globleCache = globleCache; + protected String globalCache; + public AbstractParser setGlobalCache(String globalCache) { + this.globalCache = globalCache; return this; } @Override - public String getGlobleCache() { - return globleCache; + public String getGlobalCache() { + return globalCache; } @Override @@ -383,9 +383,9 @@ public JSONObject parseResponse(JSONObject request) { } //必须在parseCorrectRequest后面,因为parseCorrectRequest可能会添加 @role - if (isNeedVerifyRole() && globleRole == null) { + if (isNeedVerifyRole() && globalRole == null) { try { - setGlobleRole(requestObject.getString(JSONRequest.KEY_ROLE)); + setGlobalRole(requestObject.getString(JSONRequest.KEY_ROLE)); requestObject.remove(JSONRequest.KEY_ROLE); } catch (Exception e) { return extendErrorResult(requestObject, e, requestMethod, getRequestURL(), isRoot); @@ -393,12 +393,12 @@ public JSONObject parseResponse(JSONObject request) { } try { - setGlobleFormat(requestObject.getBoolean(JSONRequest.KEY_FORMAT)); - setGlobleDatabase(requestObject.getString(JSONRequest.KEY_DATABASE)); - setGlobleSchema(requestObject.getString(JSONRequest.KEY_SCHEMA)); - setGlobleDatasource(requestObject.getString(JSONRequest.KEY_DATASOURCE)); - setGlobleExplain(requestObject.getBoolean(JSONRequest.KEY_EXPLAIN)); - setGlobleCache(requestObject.getString(JSONRequest.KEY_CACHE)); + setGlobalFormat(requestObject.getBoolean(JSONRequest.KEY_FORMAT)); + setGlobalDatabase(requestObject.getString(JSONRequest.KEY_DATABASE)); + setGlobalSchema(requestObject.getString(JSONRequest.KEY_SCHEMA)); + setGlobalDatasource(requestObject.getString(JSONRequest.KEY_DATASOURCE)); + setGlobalExplain(requestObject.getBoolean(JSONRequest.KEY_EXPLAIN)); + setGlobalCache(requestObject.getString(JSONRequest.KEY_CACHE)); requestObject.remove(JSONRequest.KEY_FORMAT); requestObject.remove(JSONRequest.KEY_DATABASE); @@ -435,7 +435,7 @@ public JSONObject parseResponse(JSONObject request) { requestObject = error == null ? extendSuccessResult(requestObject, isRoot) : extendErrorResult(requestObject, error, requestMethod, getRequestURL(), isRoot); - JSONObject res = (globleFormat != null && globleFormat) && JSONResponse.isSuccess(requestObject) ? new JSONResponse(requestObject) : requestObject; + JSONObject res = (globalFormat != null && globalFormat) && JSONResponse.isSuccess(requestObject) ? new JSONResponse(requestObject) : requestObject; long endTime = System.currentTimeMillis(); long duration = endTime - startTime; @@ -493,8 +493,8 @@ public void onVerifyRole(@NotNull SQLConfig config) throws Exception { if (isNeedVerifyRole()) { if (config.getRole() == null) { - if (globleRole != null) { - config.setRole(globleRole); + if (globalRole != null) { + config.setRole(globalRole); } else { config.setRole(getVisitor().getId() == null ? AbstractVerifier.UNKNOWN : AbstractVerifier.LOGIN); } @@ -548,7 +548,7 @@ public JSONObject parseCorrectRequest(RequestMethod method, String tag, int vers JSONObject target = wrapRequest(method, tag, object, true); //JSONObject clone 浅拷贝没用,Structure.parse 会导致 structure 里面被清空,第二次从缓存里取到的就是 {} - return getVerifier().verifyRequest(method, name, target, request, maxUpdateCount, getGlobleDatabase(), getGlobleSchema(), creator); + return getVerifier().verifyRequest(method, name, target, request, maxUpdateCount, getGlobalDatabase(), getGlobalSchema(), creator); } diff --git a/APIJSONORM/src/main/java/apijson/orm/Parser.java b/APIJSONORM/src/main/java/apijson/orm/Parser.java index 135dc1c7a..db98ea1f5 100755 --- a/APIJSONORM/src/main/java/apijson/orm/Parser.java +++ b/APIJSONORM/src/main/java/apijson/orm/Parser.java @@ -118,13 +118,13 @@ JSONObject parseCorrectRequest(RequestMethod method, String tag, int version, St Verifier getVerifier(); - Boolean getGlobleFormat(); - String getGlobleRole(); - String getGlobleDatabase(); - String getGlobleSchema(); - String getGlobleDatasource(); - Boolean getGlobleExplain(); - String getGlobleCache(); + Boolean getGlobalFormat(); + String getGlobalRole(); + String getGlobalDatabase(); + String getGlobalSchema(); + String getGlobalDatasource(); + Boolean getGlobalExplain(); + String getGlobalCache(); int getTransactionIsolation(); diff --git a/APIJSONORM/src/main/java/apijson/orm/Verifier.java b/APIJSONORM/src/main/java/apijson/orm/Verifier.java index 76f142fc5..366adb070 100755 --- a/APIJSONORM/src/main/java/apijson/orm/Verifier.java +++ b/APIJSONORM/src/main/java/apijson/orm/Verifier.java @@ -74,7 +74,7 @@ public interface Verifier { * @throws Exception */ JSONObject verifyRequest(RequestMethod method, String name, JSONObject target, JSONObject request, - int maxUpdateCount, String globleDatabase, String globleSchema, SQLCreator creator) throws Exception; + int maxUpdateCount, String globalDatabase, String globalSchema, SQLCreator creator) throws Exception; /**验证返回结果的数据和结构 * @param table