APIJSON icon indicating copy to clipboard operation
APIJSON copied to clipboard

GETS请求获取集合怎么配置Request表中的structure

Open bluesfdm opened this issue 4 years ago • 2 comments

环境信息

  • 系统:
  • JDK:
  • 数据库:
  • APIJSON:

问题描述 由GET请求换成GETS请求,发现要配置Request表 image

结果: image

-----然后改成:

{"child": {"CmsRole": {}, "CmsUserRole": {}}, "CmsUser": {"VERIFY": {"id{}": [1]}}}

请求参数:

{
    "tag": "user",
    //"@explain":true,
    "version": 1,
    "CmsUser": {
        "id": 1,
        "@column": "id,authing_id,name,email,mobile,state"
    },
    "child": {
        "CmsUserRole": {
            "user_Id@": "CmsUser/id",
            "@column": "user_Id,role_id"
        },
        "CmsRole": {
            "id@": "/CmsUserRole/role_id",
            "@column": "name"
        }
    }
}

结果这样:

{
    "CmsUser": {
        "id": 1,
        "authing_id": 123123214,
        "name": "测试用户1",
        "email": "[email protected]",
        "mobile": "123124124324",
        "state": "D"
    },
    "child": {
        "CmsUserRole": {
            "user_Id": "1",
            "role_id": 1,
            "@RAW@LIST": [
                {
                    "user_Id": "1",
                    "role_id": 1,
                    "@RAW@LIST": [
                        {
                            "$ref": ".."
                        },
                        {
                            "user_Id": "1",
                            "role_id": 2
                        }
                    ]
                },
                {
                    "$ref": "$.child.CmsUserRole.\\@RAW\\@LIST[0].\\@RAW\\@LIST[1]"
                }
            ]
        },
        "CmsRole": {
            "name": "运营"
        }
    },
    "ok": true,
    "code": 200,
    "msg": "success",
    "sql:generate|cache|execute|maxExecute": "3|0|3|200",
    "depth:count|max": "2|5",
    "time:start|duration|end": "1626835266270|23|1626835266293"
}

What!!!!!! 这是什么结构?且返回结果不正确,多方查找文档得不到结果,QQ群也没人回答,只能麻烦博主大佬“详细”解答了 相信很多小伙伴也有同样问题

GET请求参数如下:

{
    "tag": "user",
    //"@explain":true,
    "version": 1,
    "CmsUser": {
        "id": 1,
        "@column": "id,authing_id,name,email,mobile,state"
    },
    "child:[]": {
        "CmsUserRole": {
            "user_Id@": "CmsUser/id",
            "@column": "user_Id,role_id"
        },
        "CmsRole": {
            "id@": "/CmsUserRole/role_id",
            "@column": "name"
        }
    }
}

结果如下:

{
    "CmsUser": {
        "id": 1,
        "authing_id": 123123214,
        "name": "测试用户1",
        "email": "[email protected]",
        "mobile": "123131231",
        "state": "D"
    },
    "child:[]": [
        {
            "CmsUserRole": {
                "user_Id": "1",
                "role_id": 1
            },
            "CmsRole": {
                "name": "运营"
            }
        },
        {
            "CmsUserRole": {
                "user_Id": "1",
                "role_id": 2
            },
            "CmsRole": {
                "name": "管理员"
            }
        }
    ],
    "tag": "user",
    "version": 1,
    "ok": true,
    "code": 200,
    "msg": "success",
    "sql:generate|cache|execute|maxExecute": "4|0|4|200",
    "depth:count|max": "3|5",
    "time:start|duration|end": "1626835788340|28|1626835788368"
}

我只想GETS也能得到这样的结果就这么难吗???

bluesfdm avatar Jul 21 '21 02:07 bluesfdm

GETS 不支持查多条记录,用 GET 就行了,不用在 Request 表配置 structure。

返回 @RAW@LIST 是个 bug。

感谢反馈

TommyLemon avatar Jul 21 '21 03:07 TommyLemon

GETS 已支持使用数组 key[]:{} 来查多条记录,用最新版试试 https://github.com/Tencent/APIJSON/releases

TommyLemon avatar Jan 07 '22 17:01 TommyLemon