Skip to content

Commit 4858f02

Browse files
committed
解决表对象当表名有别名时被当成普通对象导致查不到数据
1 parent e7058a0 commit 4858f02

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

APIJSONORM/src/main/java/apijson/orm/AbstractObjectParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ public JSONObject onSQLExecute() throws Exception {
853853
list.set(i, obj);
854854

855855
if (obj != null) {
856-
parser.putQueryResult(arrayPath + "/" + i + "/" + table, obj); //解决获取关联数据时requestObject里不存在需要的关联数据
856+
parser.putQueryResult(arrayPath + "/" + i + "/" + name, obj); //解决获取关联数据时requestObject里不存在需要的关联数据
857857
}
858858
}
859859

APIJSONORM/src/main/java/apijson/orm/AbstractParser.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,11 @@ public JSONObject onObjectParse(final JSONObject request
790790
}
791791
}
792792

793-
boolean isTable = apijson.JSONObject.isTableKey(name);
793+
apijson.orm.Entry<String, String> entry = Pair.parseEntry(name, true);
794+
String table = entry.getKey(); //Comment
795+
// String alias = entry.getValue(); //to
796+
797+
boolean isTable = apijson.JSONObject.isTableKey(table);
794798
boolean isArrayMainTable = isSubquery == false && isTable && type == SQLConfig.TYPE_ITEM_CHILD_0 && arrayConfig != null && RequestMethod.isGetMethod(arrayConfig.getMethod(), true);
795799
boolean isReuse = isArrayMainTable && position > 0;
796800

0 commit comments

Comments
 (0)