更新时间:2024-08-08 GMT+08:00
分享

queryRelationship

功能介绍

queryRelationship接口可根据源/目标数据模型的ID和角色,查询关系实体的实例数据列表(实例中包含源和目标的信息)。

入参

{
       "params":{
              "objectId": "XXXX",
              "role":"source",
              "latestOnly":false
       }
}
  • objectId:对象ID。
  • role:角色,源数据模型或目标数据模型。
  • latestOnly:目标对象是否仅返回源对象关联的最新版本目标对象,默认为false。(仅对M-V模型有效,即返回所有版本)

出参

返回关系实例的查询结果列表。

示例场景

假设有一个源端为RelationLeft,目标端为RelationRight的关系实体(RelationTest)。其中,

  • RelationLeft有两个关系实例,唯一编码为454580805678901111和454580805678902222。
  • RelationRight有两个关系实例,唯一编码为454580805678903333和454580805678904444。

并创建了如下唯一编码的关系实例:

  • 1313:源端为454580805678901111,目标端为454580805678903333。
  • 2424:源端为454580805678902222,目标端为454580805678904444。
  • 1414:源端为454580805678901111,目标端为454580805678904444。

入参示例

根据源端RelationLeft的ID为454580805678901111的关系实例,查询符合条件的全部数据。

{
       "params":{
              "objectId":"454580805678901111",
              "role":"source",
              "latestOnly":false
       }
}

出参示例

{
    "result": "SUCCESS",
    "data": [
        {
            "id": "454580805678901111",
            "creator": "xdm_pub_validation f9828b63ee074aa69a2b3fb30aXXXXXX",
            "modifier": "xdm_pub_validation f9828b63ee074aa69a2b3fb30aXXXXXX",
            "createTime": "2023-01-12T11:56:55.551+0000",
            "lastUpdateTime": "2023-01-12T11:56:55.551+0000",
            "rdmVersion": 1,
            "rdmDeleteFlag": 0,
            "rdmExtensionType": "RelationTest",
            "tenant": {
                "id": "-1",
                "creator": "xdmAdmin",
                "modifier": "xdmAdmin",
                "createTime": "2022-09-22T04:10:48.543+0000",
                "lastUpdateTime": "2022-09-22T04:10:48.543+0000",
                "rdmVersion": 1,
                "rdmDeleteFlag": 0,
                "rdmExtensionType": "Tenant",
                "tenant": null,
                "className": "Tenant",
                "name": "basicTenant",
                "description": "默认租户",
                "kiaguid": null,
                "securityLevel": "internal",
                "code": "basicTenant",
                "disableFlag": false,
                "dataSource": "DefaultDataSource"
            },
            "className": "RelationTest",
            "source": {
                "id": "454580805678901111",
                "creator": "xdm_pub_validation f9828b63ee074aa69a2b3fb30aXXXXXX",
                "modifier": "xdm_pub_validation f9828b63ee074aa69a2b3fb30aXXXXXX",
                "createTime": "2023-01-12T11:55:22.797+0000",
                "lastUpdateTime": "2023-01-12T11:55:22.797+0000",
                "rdmVersion": 1,
                "rdmDeleteFlag": 0,
                "rdmExtensionType": "RelationLeft",
                "tenant": {
                    "id": "-1",
                    "creator": "xdmAdmin",
                    "modifier": "xdmAdmin",
                    "createTime": "2022-09-22T04:10:48.543+0000",
                    "lastUpdateTime": "2022-09-22T04:10:48.543+0000",
                    "rdmVersion": 1,
                    "rdmDeleteFlag": 0,
                    "rdmExtensionType": "Tenant",
                    "tenant": null,
                    "className": "Tenant",
                    "name": "basicTenant",
                    "description": "默认租户",
                    "kiaguid": null,
                    "securityLevel": "internal",
                    "code": "basicTenant",
                    "disableFlag": false,
                    "dataSource": "DefaultDataSource"
                },
                "className": "RelationLeft",
                "name": null,
                "description": null,
                "kiaguid": null,
                "securityLevel": "internal",
                "stuId": null,
                "right": {
                    "id": "427473106174128128",
                    "clazz": "RelationRight"
                },
                "stuName": null
            },
            "target": {
                "id": "454580805678903333",
                "creator": "xdm_pub_validation f9828b63ee074aa69a2b3fb30aXXXXXX",
                "modifier": "xdm_pub_validation f9828b63ee074aa69a2b3fb30aXXXXXX",
                "createTime": "2023-01-12T11:55:43.192+0000",
                "lastUpdateTime": "2023-01-12T11:55:43.192+0000",
                "rdmVersion": 1,
                "rdmDeleteFlag": 0,
                "rdmExtensionType": "RelationRight",
                "tenant": {
                    "id": "-1",
                    "creator": "xdmAdmin",
                    "modifier": "xdmAdmin",
                    "createTime": "2022-09-22T04:10:48.543+0000",
                    "lastUpdateTime": "2022-09-22T04:10:48.543+0000",
                    "rdmVersion": 1,
                    "rdmDeleteFlag": 0,
                    "rdmExtensionType": "Tenant",
                    "tenant": null,
                    "className": "Tenant",
                    "name": "basicTenant",
                    "description": "默认租户",
                    "kiaguid": null,
                    "securityLevel": "internal",
                    "code": "basicTenant",
                    "disableFlag": false,
                    "dataSource": "DefaultDataSource"
                },
                "className": "RelationRight",
                "name": null,
                "description": null,
                "kiaguid": null,
                "securityLevel": "internal",
                "stuId": null,
                "courseId": null,
                "relationLeftList": null
            },
            "name": null,
            "description": null
        },
        {
            "id": "455098158066700288",
            "creator": "xdm_pub_validation f9828b63ee074aa69a2b3fb30aXXXXXX",
            "modifier": "xdm_pub_validation f9828b63ee074aa69a2b3fb30aXXXXXX",
            "createTime": "2023-01-12T11:57:36.198+0000",
            "lastUpdateTime": "2023-01-12T11:57:36.198+0000",
            "rdmVersion": 1,
            "rdmDeleteFlag": 0,
            "rdmExtensionType": "RelationTest",
            "tenant": {
                "id": "-1",
                "creator": "xdmAdmin",
                "modifier": "xdmAdmin",
                "createTime": "2022-09-22T04:10:48.543+0000",
                "lastUpdateTime": "2022-09-22T04:10:48.543+0000",
                "rdmVersion": 1,
                "rdmDeleteFlag": 0,
                "rdmExtensionType": "Tenant",
                "tenant": null,
                "className": "Tenant",
                "name": "basicTenant",
                "description": "默认租户",
                "kiaguid": null,
                "securityLevel": "internal",
                "code": "basicTenant",
                "disableFlag": false,
                "dataSource": "DefaultDataSource"
            },
            "className": "RelationTest",
            "source": {
                "id": "454580805678901111",
                "creator": "xdm_pub_validation f9828b63ee074aa69a2b3fb30aXXXXXX",
                "modifier": "xdm_pub_validation f9828b63ee074aa69a2b3fb30aXXXXXX",
                "createTime": "2023-01-12T11:55:22.797+0000",
                "lastUpdateTime": "2023-01-12T11:55:22.797+0000",
                "rdmVersion": 1,
                "rdmDeleteFlag": 0,
                "rdmExtensionType": "RelationLeft",
                "tenant": {
                    "id": "-1",
                    "creator": "xdmAdmin",
                    "modifier": "xdmAdmin",
                    "createTime": "2022-09-22T04:10:48.543+0000",
                    "lastUpdateTime": "2022-09-22T04:10:48.543+0000",
                    "rdmVersion": 1,
                    "rdmDeleteFlag": 0,
                    "rdmExtensionType": "Tenant",
                    "tenant": null,
                    "className": "Tenant",
                    "name": "basicTenant",
                    "description": "默认租户",
                    "kiaguid": null,
                    "securityLevel": "internal",
                    "code": "basicTenant",
                    "disableFlag": false,
                    "dataSource": "DefaultDataSource"
                },
                "className": "RelationLeft",
                "name": null,
                "description": null,
                "kiaguid": null,
                "securityLevel": "internal",
                "stuId": null,
                "right": {
                    "id": "427473106174128128",
                    "clazz": "RelationRight"
                },
                "stuName": null
            },
            "target": {
                "id": "454580805678904444",
                "creator": "xdm_pub_validation f9828b63ee074aa69a2b3fb30aXXXXXX",
                "modifier": "xdm_pub_validation f9828b63ee074aa69a2b3fb30aXXXXXX",
                "createTime": "2023-01-12T11:55:47.918+0000",
                "lastUpdateTime": "2023-01-12T11:55:47.918+0000",
                "rdmVersion": 1,
                "rdmDeleteFlag": 0,
                "rdmExtensionType": "RelationRight",
                "tenant": {
                    "id": "-1",
                    "creator": "xdmAdmin",
                    "modifier": "xdmAdmin",
                    "createTime": "2022-09-22T04:10:48.543+0000",
                    "lastUpdateTime": "2022-09-22T04:10:48.543+0000",
                    "rdmVersion": 1,
                    "rdmDeleteFlag": 0,
                    "rdmExtensionType": "Tenant",
                    "tenant": null,
                    "className": "Tenant",
                    "name": "basicTenant",
                    "description": "默认租户",
                    "kiaguid": null,
                    "securityLevel": "internal",
                    "code": "basicTenant",
                    "disableFlag": false,
                    "dataSource": "DefaultDataSource"
                },
                "className": "RelationRight",
                "name": null,
                "description": null,
                "kiaguid": null,
                "securityLevel": "internal",
                "stuId": null,
                "courseId": null,
                "relationLeftList": null
            },
            "name": null,
            "description": null
        }
    ],
    "errors": [],
    "pageInfo": {
        "curPage": 1,
        "pageSize": 20,
        "totalRows": 2,
        "totalPages": 1
    }
}

相关文档