模板名称:
EL_Math_Ceil_PageSize_PageNumber.xml
EL表达式示例:
${total:toDecimal():divide(${pageSize},4):math("ceil"):toNumber()}
由上面衍生出QueryRecord
组件的排序和分页语句:
select * from flowfile order by createDate desc limit ${pageSize} offset ${pageSize:multiply(${pageNo:minus(1)})}
衍生出计算页数的语句:
"pages": ${merge.count:replaceEmpty(${executesql.row.count}):toDecimal():divide(${pageSize},4):math("ceil"):toNumber()}
MergeContent
组件在QueryRecord
组件之前,最后补充总页数和当前页码等信息:
,
"total": ${merge.count},
"size": 3,
"current": ${pageNo},
"searchCount": true,
"pages": ${merge.count:replaceEmpty(${executesql.row.count}):toDecimal():divide(${pageSize},4):math("ceil"):toNumber()}
}
}
网友评论