Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
b49a9f53
提交
b49a9f53
编写于
11月 04, 2022
作者:
chenxiang@lab.ibiz5.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加LogicNodeModel
上级
b4644091
变更
5
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
64 行增加
和
21 行删除
+64
-21
LogicModel.java
...re/src/main/java/cn/ibizlab/codegen/model/LogicModel.java
+13
-6
LogicNodeModel.java
...rc/main/java/cn/ibizlab/codegen/model/LogicNodeModel.java
+36
-0
DEAction.hbs
...ge/src/main/resources/templ/@macro/logic/drl/DEAction.hbs
+5
-5
PrepareParam.hbs
...rc/main/resources/templ/@macro/logic/drl/PrepareParam.hbs
+1
-1
{{entityLogics}}Rule.drl.hbs
...resources/rules/{{entities}}/{{entityLogics}}Rule.drl.hbs
+9
-9
未找到文件。
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/LogicModel.java
浏览文件 @
b49a9f53
...
...
@@ -19,11 +19,9 @@ public class LogicModel extends BaseModel {
private
boolean
hasStartWF
=
false
;
private
List
<
String
>
ruleGlobalParams
=
new
ArrayList
<>();
public
List
<
String
>
getRuleGlobalParams
()
{
return
ruleGlobalParams
;
}
private
List
<
LogicNodeModel
>
logicNodeModels
=
new
ArrayList
<>();
public
LogicModel
(
EntityModel
entityModel
,
IPSDELogic
iPSDELogic
)
{
public
LogicModel
(
EntityModel
entityModel
,
IPSDELogic
iPSDELogic
)
{
this
.
opt
=
iPSDELogic
;
this
.
entity
=
entityModel
;
this
.
setCodeName
(
iPSDELogic
.
getCodeName
());
...
...
@@ -48,6 +46,8 @@ public class LogicModel extends BaseModel {
if
(!
CollectionUtils
.
isEmpty
(
iPSDELogic
.
getPSDELogicNodes
()))
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
for
(
IPSDELogicNode
iPSDELogicNode
:
iPSDELogic
.
getPSDELogicNodes
())
{
LogicNodeModel
logicNodeModel
=
new
LogicNodeModel
(
this
,
iPSDELogicNode
);
logicNodeModels
.
add
(
logicNodeModel
);
if
(
iPSDELogicNode
.
getLogicNodeType
().
equals
(
"STARTWF"
))
{
hasStartWF
=
true
;
}
...
...
@@ -60,7 +60,7 @@ public class LogicModel extends BaseModel {
dstPSDataEntity
.
getPSSystemModule
().
getCodeName
().
toLowerCase
(),
dstPSDataEntity
.
getCodeName
()
);
ruleGlobalParams
.
add
(
String
.
format
(
"global %s %s;"
,
strDataType
,
String
.
format
(
"%sservice
;
"
,
dstPSDataEntity
.
getCodeName
().
toLowerCase
())));
ruleGlobalParams
.
add
(
String
.
format
(
"global %s %s;"
,
strDataType
,
String
.
format
(
"%sservice"
,
dstPSDataEntity
.
getCodeName
().
toLowerCase
())));
map
.
put
(
dstPSDataEntity
.
getName
(),
dstPSDataEntity
.
getName
());
}
}
catch
(
Exception
e
)
{
...
...
@@ -78,7 +78,7 @@ public class LogicModel extends BaseModel {
entityModel
.
getDataEntity
().
getPSSystemModule
().
getCodeName
().
toLowerCase
(),
entityModel
.
getDataEntity
().
getCodeName
()
);
ruleGlobalParams
.
add
(
String
.
format
(
"global %s %s;"
,
strDataType
,
String
.
format
(
"iBzSys%sDefaultService
;
"
,
entityModel
.
getCodeName
())));
ruleGlobalParams
.
add
(
String
.
format
(
"global %s %s;"
,
strDataType
,
String
.
format
(
"iBzSys%sDefaultService"
,
entityModel
.
getCodeName
())));
}
ruleGlobalParams
.
add
(
String
.
format
(
"global %s %s;"
,
"cn.ibizlab.util.security.AuthenticationUser"
,
"curuser"
));
}
...
...
@@ -87,4 +87,11 @@ public class LogicModel extends BaseModel {
return
(
IPSDELogic
)
opt
;
}
public
List
<
String
>
getRuleGlobalParams
()
{
return
ruleGlobalParams
;
}
public
List
<
LogicNodeModel
>
getLogicNodeModels
()
{
return
logicNodeModels
;
}
}
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/LogicNodeModel.java
0 → 100644
浏览文件 @
b49a9f53
package
cn
.
ibizlab
.
codegen
.
model
;
import
net.ibizsys.model.dataentity.logic.IPSDELogicNode
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
LogicNodeModel
extends
BaseModel
{
private
LogicModel
logicModel
;
private
List
<
String
>
ruleGlobalParams
=
new
ArrayList
<>();
public
LogicNodeModel
(
LogicModel
logicModel
,
IPSDELogicNode
iPSDELogicNode
)
{
this
.
opt
=
iPSDELogicNode
;
this
.
logicModel
=
logicModel
;
this
.
setCodeName
(
iPSDELogicNode
.
getCodeName
());
this
.
setName
(
iPSDELogicNode
.
getName
());
this
.
setId
(
String
.
format
(
"%1$s-%2$s"
,
logicModel
.
getCodeName
(),
iPSDELogicNode
.
getCodeName
()));
}
public
String
getLogicNodeType
(){
return
this
.
getPSDELogicNode
().
getLogicNodeType
();
}
public
LogicModel
getLogicModel
()
{
return
logicModel
;
}
public
IPSDELogicNode
getPSDELogicNode
()
{
return
(
IPSDELogicNode
)
opt
;
}
}
modules/ibizlab-template/ibizlab-template-ibizedge/src/main/resources/templ/@macro/logic/drl/DEAction.hbs
浏览文件 @
b49a9f53
{{#if
(
eq
de
LogicNode
.
dstPSDEAction
.
codeName
'Get'
)
}}
cn.ibizlab.util.helper.CachedBeanCopier.copy(
{{
lowerCase
deLogicNode
.
dstPSDataEntity
.
codeName
}}
service.get(
{{
lowerCase
deLogicNode
.
dstPSDELogicParam
.
codeName
}}
.get
{{
deLogicNode
.
dstPSDataEntity
.
keyPSDEField
.
codeName
}}
()),
{{
lowerCase
de
LogicNode
.
dstPSDELogicParam
.
codeName
}}
);
{{#if
(
eq
logicNodeModel
.
pSDE
LogicNode
.
dstPSDEAction
.
codeName
'Get'
)
}}
cn.ibizlab.util.helper.CachedBeanCopier.copy(
{{
lowerCase
logicNodeModel
.
pSDELogicNode
.
dstPSDataEntity
.
codeName
}}
service.get(
{{
lowerCase
logicNodeModel
.
pSDELogicNode
.
dstPSDELogicParam
.
codeName
}}
.get
{{
logicNodeModel
.
pSDELogicNode
.
dstPSDataEntity
.
keyPSDEField
.
codeName
}}
()),
{{
lowerCase
logicNodeModel
.
pSDE
LogicNode
.
dstPSDELogicParam
.
codeName
}}
);
{{else}}
{{#if
(
eq
de
LogicNode
.
dstPSDEAction
.
codeName
'Remove'
)
}}
{{
lowerCase
deLogicNode
.
dstPSDataEntity
.
codeName
}}
service.remove(
{{
lowerCase
deLogicNode
.
dstPSDELogicParam
.
codeName
}}
.get
{{
de
LogicNode
.
dstPSDataEntity
.
keyPSDEField
.
codeName
}}
());
{{#if
(
eq
logicNodeModel
.
pSDE
LogicNode
.
dstPSDEAction
.
codeName
'Remove'
)
}}
{{
lowerCase
logicNodeModel
.
pSDELogicNode
.
dstPSDataEntity
.
codeName
}}
service.remove(
{{
lowerCase
logicNodeModel
.
pSDELogicNode
.
dstPSDELogicParam
.
codeName
}}
.get
{{
logicNodeModel
.
pSDE
LogicNode
.
dstPSDataEntity
.
keyPSDEField
.
codeName
}}
());
{{else}}
{{
lowerCase
deLogicNode
.
dstPSDataEntity
.
codeName
}}
service.
{{
camelCase
deLogicNode
.
dstPSDEAction
.
codeName
}}
(
{{
lowerCase
de
LogicNode
.
dstPSDELogicParam
.
codeName
}}
);
{{
lowerCase
logicNodeModel
.
pSDELogicNode
.
dstPSDataEntity
.
codeName
}}
service.
{{
camelCase
logicNodeModel
.
pSDELogicNode
.
dstPSDEAction
.
codeName
}}
(
{{
lowerCase
logicNodeModel
.
pSDE
LogicNode
.
dstPSDELogicParam
.
codeName
}}
);
{{/if}}
{{/if}}
modules/ibizlab-template/ibizlab-template-ibizedge/src/main/resources/templ/@macro/logic/drl/PrepareParam.hbs
浏览文件 @
b49a9f53
{{#
each
de
LogicNode
.
pSDELogicNodeParams
as
|
nodeParam
|
}}
{{#
each
logicNodeModel
.
pSDE
LogicNode
.
pSDELogicNodeParams
as
|
nodeParam
|
}}
{{#if
(
eq
nodeParam
.
srcValueType
"SRCVALUE"
)
}}{{
lowerCase
nodeParam
.
dstPSDELogicParam
.
codeName
}}
.set("
{{
lowerCase
nodeParam
.
dstFieldName
}}
","
{{
nodeParam
.
srcValue
}}
");
{{/if}}
{{#if
(
eq
nodeParam
.
srcValueType
"SRCDLPARAM"
)
}}{{
lowerCase
nodeParam
.
dstPSDELogicParam
.
codeName
}}
.set("
{{
lowerCase
nodeParam
.
dstFieldName
}}
",
{{
lowerCase
nodeParam
.
srcPSDELogicParam
.
codeName
}}
.get("
{{
lowerCase
nodeParam
.
srcFieldName
}}
"));
{{/if}}
{{#if
(
eq
nodeParam
.
srcValueType
"CURTIME"
)
}}{{
lowerCase
nodeParam
.
dstPSDELogicParam
.
codeName
}}
.set("
{{
lowerCase
nodeParam
.
dstFieldName
}}
",(new java.sql.Timestamp(new java.util.Date().getTime()))));
{{/if}}
...
...
modules/ibizlab-template/ibizlab-template-ibizedge/src/main/resources/templ/{{projectName}}-core/src/main/resources/rules/{{entities}}/{{entityLogics}}Rule.drl.hbs
浏览文件 @
b49a9f53
...
...
@@ -9,18 +9,18 @@ import cn.ibizlab.util.errors.BadRequestAlertException;
{{
ruleGlobalParam
}}
{{/
each
}}
{{#
each
entityLogic
.
pSDELogicNodes
as
|
deLogicNode
|
}}
{{#
each
entityLogic
.
logicNodeModels
as
|
logicNodeModel
|
}}
//逻辑处理节点[
{{
deLogicNode
.
name
}}
]
rule "
{{
lowerCase
deLogicNode
.
codeName
}}
"
ruleflow-group "
{{
lowerCase
deLogicNode
.
codeName
}}
"
//逻辑处理节点[
{{
logicNodeModel
.
name
}}
]
rule "
{{
lowerCase
logicNodeModel
.
codeName
}}
"
ruleflow-group "
{{
lowerCase
logicNodeModel
.
codeName
}}
"
when
then
{{#
eq
deLogicNode
.
logicNodeType
"PREPAREPARAM"
}}{{>
@macro
/
logic
/
drl
/
PrepareParam
.
hbs
deLogicNode
=
deLogicNode
}}{{/
eq
}}
{{#
eq
deLogicNode
.
logicNodeType
"DEACTION"
}}{{>
@macro
/
logic
/
drl
/
DEAction
.
hbs
deLogicNode
=
deLogicNode
}}{{/
eq
}}
{{#
eq
deLogicNode
.
logicNodeType
"RAWSQLCALL"
}}{{>
@macro
/
logic
/
drl
/
RawSQLCall
.
hbs
deLogicNode
=
deLogicNode
}}{{/
eq
}}
{{#
eq
deLogicNode
.
logicNodeType
"RAWSQLANDLOOPCALL"
}}{{>
@macro
/
logic
/
drl
/
RawSQLAndLoopCall
.
hbs
deLogicNode
=
deLogicNode
}}{{/
eq
}}
{{#
eq
deLogicNode
.
logicNodeType
"STARTWF"
}}{{>
@macro
/
logic
/
drl
/
StartWF
.
hbs
deLogicNode
=
deLogicNode
}}{{/
eq
}}
{{#
eq
logicNodeModel
.
logicNodeType
"PREPAREPARAM"
}}{{>
@macro
/
logic
/
drl
/
PrepareParam
.
hbs
logicNodeModel
=
logicNodeModel
}}{{/
eq
}}
{{#
eq
logicNodeModel
.
logicNodeType
"DEACTION"
}}{{>
@macro
/
logic
/
drl
/
DEAction
.
hbs
logicNodeModel
=
logicNodeModel
}}{{/
eq
}}
{{#
eq
logicNodeModel
.
logicNodeType
"RAWSQLCALL"
}}{{>
@macro
/
logic
/
drl
/
RawSQLCall
.
hbs
logicNodeModel
=
logicNodeModel
}}{{/
eq
}}
{{#
eq
logicNodeModel
.
logicNodeType
"RAWSQLANDLOOPCALL"
}}{{>
@macro
/
logic
/
drl
/
RawSQLAndLoopCall
.
hbs
logicNodeModel
=
logicNodeModel
}}{{/
eq
}}
{{#
eq
logicNodeModel
.
logicNodeType
"STARTWF"
}}{{>
@macro
/
logic
/
drl
/
StartWF
.
hbs
logicNodeModel
=
logicNodeModel
}}{{/
eq
}}
{{#
each
entityLogic
.
pSDELogicParams
as
|
logicParam
|
}}
update(
{{
lowerCase
logicParam
.
codeName
}}
);//更新fact中变量值
{{/
each
}}
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录