Skip to main content
Version: 3.7

Paginate 分页

1. 结构声明

class Paginate extends LogicItem {
list: LogicItem;
page: LogicItem;
size: LogicItem;
typeAnnotation?: TypeAnnotation;
}

2. 节点示例

(1) 示例

AST 如下:

{
"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": {}
}
}
}

对应的代码如下:

for OrderProduct in OrderProductEntity
where OrderProduct.createdBy == '张三' && OrderProduct.createdTime > startDateTime
select {
orderProduct: OrderProduct,
} paginate 1, 1000

(2) 示例

AST 如下:

{
"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"
}
}

对应的代码如下:

sql"SELECT * FROM Product WHERE createdTime > \$\{createdTime}" paginate page, size

(3) 示例

AST 如下:

{
"concept": "Paginate",
"list": {
"concept": "Identifier",
"namespace": "",
"name": "productList"
},
"page": {
"concept": "Identifier",
"namespace": "",
"name": "page"
},
"size": {
"concept": "Identifier",
"namespace": "",
"name": "size"
}
}

对应的代码如下:

productList paginate page, size