mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-14 20:22:07 +08:00
68 lines
1.9 KiB
XML
68 lines
1.9 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
||
<flow>
|
||
<nodes>
|
||
<node id="s1" name="普通脚本1" type="script" language="groovy">
|
||
<![CDATA[
|
||
import cn.hutool.core.date.DateUtil
|
||
|
||
def date = DateUtil.parse("2022-10-17 13:31:43")
|
||
println(date)
|
||
defaultContext.setData("demoDate", date)
|
||
|
||
class Student {
|
||
int studentID
|
||
String studentName
|
||
}
|
||
|
||
Student student = new Student()
|
||
student.studentID = 100301
|
||
student.studentName = "张三"
|
||
defaultContext.setData("student",student)
|
||
|
||
def a=3
|
||
def b=2
|
||
defaultContext.setData("s1",a*b)
|
||
]]>
|
||
</node>
|
||
|
||
<node id="s2" name="选择脚本" type="switch_script" language="groovy">
|
||
<![CDATA[
|
||
count = defaultContext.getData("count")
|
||
if(count > 100){
|
||
return "a"
|
||
}else{
|
||
return "b"
|
||
}
|
||
]]>
|
||
</node>
|
||
|
||
<!-- 定义s3的目的是验证在多个脚本节点同时存在情况下的运行情况是否正确,本身s3不会被引用到 -->
|
||
<node id="s3" name="普通脚本2" type="script">
|
||
<![CDATA[
|
||
def a=30;
|
||
def b=2;
|
||
defaultContext.setData("s1",a*b);
|
||
]]>
|
||
</node>
|
||
|
||
<node id="s4" name="普通脚本3" type="script">
|
||
<![CDATA[
|
||
def a=30;
|
||
def b=2;
|
||
defaultContext.setData("s4","s4:" + _meta.requestData);
|
||
]]>
|
||
</node>
|
||
</nodes>
|
||
|
||
<chain name="chain1">
|
||
THEN(a, b, c, s1);
|
||
</chain>
|
||
|
||
<chain name="chain2">
|
||
THEN(d, SWITCH(s2).to(a,b));
|
||
</chain>
|
||
|
||
<chain name="chain4">
|
||
THEN(a, s4);
|
||
</chain>
|
||
</flow> |