QueryJoinExpression 查询 Join 子句
1. 结构声明
- TS Declaration
- JSON Schema
class QueryJoinExpression extends LogicItem {
entityNamespace: string;
entityName: string;
asName?: string;
joinType: 'INNER' | 'LEFT' | 'RIGHT' | 'FULL';
onExpressions: Array<BinaryExpression>;
joinParts: Array<QueryJoinExpression>;
}
{
"type": "object",
"properties": {
"composedBy": {
"type": "array",
"items": {
"type": "string"
}
},
"changedTime": {
"$ref": "#/definitions/long"
},
"label": {
"type": "string"
},
"description": {
"type": "string"
},
"folded": {
"type": "boolean"
},
"offsetX": {
"type": "number"
},
"offsetY": {
"type": "number"
},
"typeAnnotation": {
"$ref": "#/definitions/TypeAnnotation"
},
"breakpoint": {
"type": "string",
"enum": [
"ENABLED",
"DISABLED"
]
},
"entityNamespace": {
"type": "string"
},
"entityName": {
"type": "string"
},
"asName": {
"type": "string"
},
"joinType": {
"type": "string",
"enum": [
"INNER",
"LEFT",
"RIGHT",
"FULL"
]
},
"onExpressions": {
"type": "array",
"items": {
"$ref": "#/definitions/BinaryExpression"
}
},
"joinParts": {
"type": "array",
"items": {
"$ref": "#/definitions/QueryJoinExpression"
}
}
},
"required": [
"entityNamespace",
"entityName",
"joinType",
"onExpressions",
"joinParts"
],
"additionalProperties": false
}
2. 节点示例
(1) 示例
AST 如下:
- JSON
- YAML
{
"concept": "QueryJoinExpression",
"entityNamespace": "app.dataSources.defaultDS.entities",
"entityName": "OrderForm",
"joinType": "INNER",
"onExpressions": [
{
"concept": "BinaryExpression",
"left": {
"concept": "QueryFieldExpression",
"isDotStar": false,
"entityAsName": "OrderProduct",
"propertyName": "orderId",
"asName": ""
},
"right": {
"concept": "QueryFieldExpression",
"isDotStar": false,
"entityAsName": "OrderForm",
"propertyName": "id",
"asName": ""
},
"operator": "=="
}
],
"joinParts": [],
"asName": ""
}
concept: QueryJoinExpression
entityNamespace: app.dataSources.defaultDS.entities
entityName: OrderForm
joinType: INNER
onExpressions:
- concept: BinaryExpression
left:
concept: QueryFieldExpression
isDotStar: false
entityAsName: OrderProduct
propertyName: orderId
asName: ""
right:
concept: QueryFieldExpression
isDotStar: false
entityAsName: OrderForm
propertyName: id
asName: ""
operator: ==
joinParts: []
asName: ""
对应的代码如下:
- 文本化 NASL
- Natural TS
inner join OrderForm in OrderForm
on OrderProduct.orderId == OrderForm.id
.INNER_JOIN(app.dataSources.defaultDS.entities.OrderFormEntity, OrderForm => ON(() => OrderProduct.orderId == OrderForm.id)