-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
关联查询问题 #14
Labels
enhancement
New feature or request
Comments
目前不支持嵌套 in {
"User": {
"userId": "10002"
},
"todo[]":{
"Todo": {
"userId@": "User/userId"
}
}
} out: {
"User": {
"createdAt": "2022-10-24 17:06:09",
"id": 4,
"realname": "史强",
"userId": "10002",
"username": "shiqiang"
},
"todo[]": [
{
"Todo": {
"createdAt": "2022-10-24 17:59:47",
"deletedAt": null,
"id": 24,
"note": null,
"partner": "10003",
"title": "找丁仪发呆",
"todoId": null,
"userId": "10002"
}
},
{
"Todo": {
"createdAt": "2022-10-24 18:00:03",
"deletedAt": null,
"id": 26,
"note": null,
"partner": "10003",
"title": "找丁仪发呆",
"todoId": null,
"userId": "10002"
}
},
],
"ok": true,
"code": 200,
"msg": "success",
"span": "31.4325ms"
} |
这样确实好使 我尝试过 但是还是嵌套数据对前端友好点吧 |
我个人前端使用上来讲,其实都一样。 先把其它完善下,再来增加对这种嵌套的支持吧 |
这种嵌套写法不支持 JOIN,还是建议把 User 和 comment[] 放在同一层级 https://github.com/Tencent/APIJSON/blob/master/Document.md#3.2 |
未必更加友好,尤其是对于客户端来说,建立实体类(JavaBean/Entity 等) 还是把 User 和 List 独立开更好,而不是 class User {
List<Comemnt> commentList;
} 如果是这种,那你想想结构上还可能有各种嵌套组合导致不方便处理,以及对应带来的循环引用导致内存泄漏等问题 class Comemnt {
User owner;
} class User {
List<Moment> momentList;
} class Moment {
User publisher;
List<Comment> commentList;
} ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
能不能像APIJSON官方一样 支持这种嵌套查询
The text was updated successfully, but these errors were encountered: