Paginate 分页
1. 结构声明
- TS Declaration
- JSON Schema
class Paginate extends LogicItem {
list: LogicItem;
page: LogicItem;
size: LogicItem;
typeAnnotation?: TypeAnnotation;
}
{
"type": "object",
"properties": {
"composedBy": {
"type": "array",
"items": {
"type": "string"
}
},
"label": {
"type": "string"
},
"description": {
"type": "string"
},
"folded": {
"type": "boolean"
},
"offsetX": {
"type": "number"
},
"offsetY": {
"type": "number"
},
"list": {
"$ref": "#/definitions/LogicItem"
},
"page": {
"$ref": "#/definitions/LogicItem"
},
"size": {
"$ref": "#/definitions/LogicItem"
},
"typeAnnotation": {
"$ref": "#/definitions/TypeAnnotation"
}
},
"required": [
"list",
"page",
"size"
],
"additionalProperties": false
}
2. 节点示例
(1) 示例
AST 如下:
- JSON
- YAML
{
"concept": "Paginate",
"list": {
"concept": "CallQueryComponent",
"select": {
"concept": "QuerySelectExpression",
"distinct": false,
"star": true,
"selectElements": [
{
"concept": "QueryFieldExpression",
"isDotStar": true,
"entityAsName": "OrderProduct",
"propertyName": "",
"asName": ""
}
]
},
"from": {
"concept": "QueryFromExpression",
"entityNamespace": "app.dataSources.defaultDS.entities",
"entityName": "OrderProduct",
"joinParts": [],
"asName": ""
},
"where": {
"concept": "BinaryExpression",
"left": {
"concept": "BinaryExpression",
"left": {
"concept": "QueryFieldExpression",
"isDotStar": false,
"entityAsName": "OrderProduct",
"propertyName": "createdBy",
"asName": "createdBy"
},
"right": {
"concept": "StringLiteral",
"value": "张三"
},
"operator": "=="
},
"right": {
"concept": "BinaryExpression",
"left": {
"concept": "QueryFieldExpression",
"isDotStar": false,
"entityAsName": "OrderProduct",
"propertyName": "createdTime",
"asName": ""
},
"right": {
"concept": "Identifier",
"namespace": "",
"name": "startDateTime"
},
"operator": ">"
},
"operator": "&&"
},
"ideVersion": "2.22"
},
"page": {
"concept": "NumericLiteral",
"value": "1",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Long",
"inferred": false,
"ruleMap": {}
}
},
"size": {
"concept": "NumericLiteral",
"value": "1000",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Long",
"inferred": false,
"ruleMap": {}
}
}
}
concept: Paginate
list:
concept: CallQueryComponent
select:
concept: QuerySelectExpression
distinct: false
star: true
selectElements:
- concept: QueryFieldExpression
isDotStar: true
entityAsName: OrderProduct
propertyName: ""
asName: ""
from:
concept: QueryFromExpression
entityNamespace: app.dataSources.defaultDS.entities
entityName: OrderProduct
joinParts: []
asName: ""
where:
concept: BinaryExpression
left:
concept: BinaryExpression
left:
concept: QueryFieldExpression
isDotStar: false
entityAsName: OrderProduct
propertyName: createdBy
asName: createdBy
right:
concept: StringLiteral
value: 张三
operator: ==
right:
concept: BinaryExpression
left:
concept: QueryFieldExpression
isDotStar: false
entityAsName: OrderProduct
propertyName: createdTime
asName: ""
right:
concept: Identifier
namespace: ""
name: startDateTime
operator: ">"
operator: "&&"
ideVersion: "2.22"
page:
concept: NumericLiteral
value: "1"
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: Long
inferred: false
ruleMap: {}
size:
concept: NumericLiteral
value: "1000"
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: Long
inferred: false
ruleMap: {}
对应的代码如下:
- 文本化 NASL
for OrderProduct in OrderProductEntity
where OrderProduct.createdBy == '张三' && OrderProduct.createdTime > startDateTime
select {
orderProduct: OrderProduct,
} paginate 1, 1000
(2) 示例
AST 如下:
- JSON
- YAML
{
"concept": "Paginate",
"list": {
"concept": "OqlQueryComponent",
"dataSource": "app.dataSources.defaultDS",
"code": "SELECT * FROM Product WHERE createdTime > \\$\\{createdTime}"
},
"page": {
"concept": "Identifier",
"namespace": "",
"name": "page"
},
"size": {
"concept": "Identifier",
"namespace": "",
"name": "size"
}
}
concept: Paginate
list:
concept: OqlQueryComponent
dataSource: app.dataSources.defaultDS
code: SELECT * FROM Product WHERE createdTime > \\$\\{createdTime}
page:
concept: Identifier
namespace: ""
name: page
size:
concept: Identifier
namespace: ""
name: size
对应的代码如下:
- 文本化 NASL
sql"SELECT * FROM Product WHERE createdTime > \$\{createdTime}" paginate page, size
(3) 示例
AST 如下:
- JSON
- YAML
{
"concept": "Paginate",
"list": {
"concept": "Identifier",
"namespace": "",
"name": "productList"
},
"page": {
"concept": "Identifier",
"namespace": "",
"name": "page"
},
"size": {
"concept": "Identifier",
"namespace": "",
"name": "size"
}
}
concept: Paginate
list:
concept: Identifier
namespace: ""
name: productList
page:
concept: Identifier
namespace: ""
name: page
size:
concept: Identifier
namespace: ""
name: size
对应的代码如下:
- 文本化 NASL
productList paginate page, size