Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
ffd33184
提交
ffd33184
编写于
11月 04, 2022
作者:
chenxiang@lab.ibiz5.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
处理逻辑DEAction\PrepareParam
上级
ecf57fee
变更
9
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
131 行增加
和
8 行删除
+131
-8
EntityModel.java
...e/src/main/java/cn/ibizlab/codegen/model/EntityModel.java
+9
-6
LogicModel.java
...re/src/main/java/cn/ibizlab/codegen/model/LogicModel.java
+69
-1
ModelStorage.java
.../src/main/java/cn/ibizlab/codegen/model/ModelStorage.java
+1
-1
DEAction.hbs
...ge/src/main/resources/templ/@macro/logic/drl/DEAction.hbs
+9
-0
PrepareParam.hbs
...rc/main/resources/templ/@macro/logic/drl/PrepareParam.hbs
+10
-0
RawSQLAndLoopCall.hbs
...in/resources/templ/@macro/logic/drl/RawSQLAndLoopCall.hbs
+1
-0
RawSQLCall.hbs
.../src/main/resources/templ/@macro/logic/drl/RawSQLCall.hbs
+1
-0
StartWF.hbs
...dge/src/main/resources/templ/@macro/logic/drl/StartWF.hbs
+1
-0
{{entityLogics}}Rule.drl.hbs
...resources/rules/{{entities}}/{{entityLogics}}Rule.drl.hbs
+30
-0
未找到文件。
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/EntityModel.java
浏览文件 @
ffd33184
...
@@ -16,6 +16,7 @@ import net.ibizsys.model.dataentity.ds.IPSDEDataSetGroupParam;
...
@@ -16,6 +16,7 @@ import net.ibizsys.model.dataentity.ds.IPSDEDataSetGroupParam;
import
net.ibizsys.model.dataentity.ds.PSDEDataSetGroupParamImpl
;
import
net.ibizsys.model.dataentity.ds.PSDEDataSetGroupParamImpl
;
import
net.ibizsys.model.dataentity.logic.IPSDELogic
;
import
net.ibizsys.model.dataentity.logic.IPSDELogic
;
import
org.springframework.util.Assert
;
import
org.springframework.util.Assert
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
...
@@ -111,11 +112,9 @@ public class EntityModel extends BaseModel {
...
@@ -111,11 +112,9 @@ public class EntityModel extends BaseModel {
return
this
;
return
this
;
}
}
private
List
<
LogicModel
>
logics
;
private
List
<
LogicModel
>
logics
=
new
ArrayList
<>()
;
public
EntityModel
addLogic
(
LogicModel
logicModel
)
{
public
EntityModel
addLogic
(
LogicModel
logicModel
)
{
if
(
fields
==
null
)
fields
=
new
ArrayList
<>();
logics
.
add
(
logicModel
);
logics
.
add
(
logicModel
);
return
this
;
return
this
;
}
}
...
@@ -754,9 +753,13 @@ public class EntityModel extends BaseModel {
...
@@ -754,9 +753,13 @@ public class EntityModel extends BaseModel {
}
}
//处理逻辑
//处理逻辑
for
(
IPSDELogic
logic
:
dataEntity
.
getAllPSDELogics
())
{
if
(!
CollectionUtils
.
isEmpty
(
dataEntity
.
getAllPSDELogics
()))
{
LogicModel
logicModel
=
new
LogicModel
(
this
,
logic
);
for
(
IPSDELogic
logic
:
dataEntity
.
getAllPSDELogics
())
{
this
.
addLogic
(
logicModel
);
if
(!
logic
.
isEnableBackend
())
continue
;
LogicModel
logicModel
=
new
LogicModel
(
this
,
logic
);
this
.
addLogic
(
logicModel
);
}
}
}
if
(
dataEntity
.
getAllPSDEDataQueries
()
!=
null
)
{
if
(
dataEntity
.
getAllPSDEDataQueries
()
!=
null
)
{
...
...
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/LogicModel.java
浏览文件 @
ffd33184
package
cn
.
ibizlab
.
codegen
.
model
;
package
cn
.
ibizlab
.
codegen
.
model
;
import
net.ibizsys.model.dataentity.IPSDataEntity
;
import
net.ibizsys.model.dataentity.logic.IPSDELogic
;
import
net.ibizsys.model.dataentity.logic.IPSDELogic
;
import
net.ibizsys.model.dataentity.service.IPSDEServiceAPIMethod
;
import
net.ibizsys.model.dataentity.logic.IPSDELogicNode
;
import
net.ibizsys.model.dataentity.logic.IPSDELogicParam
;
import
org.springframework.util.CollectionUtils
;
import
java.lang.reflect.Method
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
LogicModel
extends
BaseModel
{
public
class
LogicModel
extends
BaseModel
{
private
EntityModel
entity
;
private
EntityModel
entity
;
private
boolean
hasStartWF
=
false
;
private
List
<
String
>
ruleGlobalParams
=
new
ArrayList
<>();
public
List
<
String
>
getRuleGlobalParams
()
{
return
ruleGlobalParams
;
}
public
LogicModel
(
EntityModel
entityModel
,
IPSDELogic
iPSDELogic
)
{
public
LogicModel
(
EntityModel
entityModel
,
IPSDELogic
iPSDELogic
)
{
this
.
opt
=
iPSDELogic
;
this
.
opt
=
iPSDELogic
;
this
.
entity
=
entityModel
;
this
.
entity
=
entityModel
;
this
.
setCodeName
(
iPSDELogic
.
getCodeName
());
this
.
setCodeName
(
iPSDELogic
.
getCodeName
());
this
.
setName
(
iPSDELogic
.
getName
());
this
.
setName
(
iPSDELogic
.
getName
());
this
.
setId
(
String
.
format
(
"%1$s-%2$s"
,
entity
.
getCodeName
(),
iPSDELogic
.
getCodeName
()));
this
.
setId
(
String
.
format
(
"%1$s-%2$s"
,
entity
.
getCodeName
(),
iPSDELogic
.
getCodeName
()));
if
(!
CollectionUtils
.
isEmpty
(
iPSDELogic
.
getPSDELogicParams
()))
{
for
(
IPSDELogicParam
iPSDELogicParam
:
iPSDELogic
.
getPSDELogicParams
())
{
String
strParamName
=
iPSDELogicParam
.
getCodeName
().
toLowerCase
();
if
(
iPSDELogicParam
.
getParamPSDataEntity
()
!=
null
)
{
String
strDataType
=
String
.
format
(
"%s.core.%s.domain.%s"
,
entityModel
.
getSystem
().
getPackageName
(),
iPSDELogicParam
.
getParamPSDataEntity
().
getPSSystemModule
().
getCodeName
().
toLowerCase
(),
iPSDELogicParam
.
getParamPSDataEntity
().
getCodeName
()
);
ruleGlobalParams
.
add
(
String
.
format
(
"global %s %s;"
,
strDataType
,
strParamName
));
}
else
{
String
strDataType
=
"java.util.Map"
;
ruleGlobalParams
.
add
(
String
.
format
(
"global %s %s;"
,
strDataType
,
strParamName
));
}
}
}
if
(!
CollectionUtils
.
isEmpty
(
iPSDELogic
.
getPSDELogicNodes
()))
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
for
(
IPSDELogicNode
iPSDELogicNode
:
iPSDELogic
.
getPSDELogicNodes
())
{
if
(
iPSDELogicNode
.
getLogicNodeType
().
equals
(
"STARTWF"
))
{
hasStartWF
=
true
;
}
try
{
Method
method
=
iPSDELogicNode
.
getClass
().
getDeclaredMethod
(
"getDstPSDataEntity"
);
IPSDataEntity
dstPSDataEntity
=
(
IPSDataEntity
)
method
.
invoke
(
iPSDELogicNode
);
if
(!
map
.
containsKey
(
dstPSDataEntity
.
getName
()))
{
String
strDataType
=
String
.
format
(
"%s.core.%s.service.I%sService"
,
entityModel
.
getSystem
().
getPackageName
(),
dstPSDataEntity
.
getPSSystemModule
().
getCodeName
().
toLowerCase
(),
dstPSDataEntity
.
getCodeName
()
);
ruleGlobalParams
.
add
(
String
.
format
(
"global %s %s;"
,
strDataType
,
String
.
format
(
"%sservice;"
,
dstPSDataEntity
.
getCodeName
().
toLowerCase
())));
map
.
put
(
dstPSDataEntity
.
getName
(),
dstPSDataEntity
.
getName
());
}
}
catch
(
Exception
e
)
{
}
}
}
if
(
hasStartWF
)
{
String
strDataType
=
"cn.ibizlab.util.client"
;
ruleGlobalParams
.
add
(
String
.
format
(
"global %s %s;"
,
strDataType
,
"wfClient"
));
}
if
(
true
)
{
String
strDataType
=
String
.
format
(
"%s.core.%s.service.I%sService"
,
entityModel
.
getSystem
().
getPackageName
(),
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;"
,
"cn.ibizlab.util.security.AuthenticationUser"
,
"curuser"
));
}
}
public
IPSDELogic
getPSDELogic
()
{
public
IPSDELogic
getPSDELogic
()
{
...
...
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/model/ModelStorage.java
浏览文件 @
ffd33184
...
@@ -175,7 +175,7 @@ public class ModelStorage {
...
@@ -175,7 +175,7 @@ public class ModelStorage {
}
}
else
if
(
type
.
equals
(
TemplateFileType
.
entityLogic
))
{
else
if
(
type
.
equals
(
TemplateFileType
.
entityLogic
))
{
getSystemModel
().
getEntities
().
forEach
(
item
->
item
.
getLogics
().
forEach
(
logicModel
->
{
getSystemModel
().
getEntities
().
forEach
(
item
->
item
.
getLogics
().
forEach
(
logicModel
->
{
CliOption
opt
=
newCliOption
(
TemplateFileType
.
entityLogic
).
baseData
(
item
,
item
.
getCodeName
())
CliOption
opt
=
newCliOption
(
TemplateFileType
.
entityLogic
).
baseData
(
logicModel
,
logicModel
.
getCodeName
())
.
set
(
"entities"
,
item
.
getCodeName
());
.
set
(
"entities"
,
item
.
getCodeName
());
rt
.
addOption
(
opt
);
rt
.
addOption
(
opt
);
}));
}));
...
...
modules/ibizlab-template/ibizlab-template-ibizedge/src/main/resources/templ/@macro/logic/drl/DEAction.hbs
0 → 100644
浏览文件 @
ffd33184
{{#if
(
eq
deLogicNode
.
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
deLogicNode
.
dstPSDELogicParam
.
codeName
}}
);
{{else}}
{{#if
(
eq
deLogicNode
.
dstPSDEAction
.
codeName
'Remove'
)
}}
{{
lowerCase
deLogicNode
.
dstPSDataEntity
.
codeName
}}
service.remove(
{{
lowerCase
deLogicNode
.
dstPSDELogicParam
.
codeName
}}
.get
{{
deLogicNode
.
dstPSDataEntity
.
keyPSDEField
.
codeName
}}
());
{{else}}
{{
lowerCase
deLogicNode
.
dstPSDataEntity
.
codeName
}}
service.
{{
camelCase
deLogicNode
.
dstPSDEAction
.
codeName
}}
(
{{
lowerCase
deLogicNode
.
dstPSDELogicParam
.
codeName
}}
);
{{/if}}
{{/if}}
modules/ibizlab-template/ibizlab-template-ibizedge/src/main/resources/templ/@macro/logic/drl/PrepareParam.hbs
0 → 100644
浏览文件 @
ffd33184
{{#
each
deLogicNode
.
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}}
{{#if
(
eq
nodeParam
.
srcValueType
"OPERATOR"
)
}}{{
lowerCase
nodeParam
.
dstPSDELogicParam
.
codeName
}}
.set("
{{
lowerCase
nodeParam
.
dstFieldName
}}
",curuser.getUserid());
{{/if}}
{{#if
(
eq
nodeParam
.
srcValueType
"OPERATORNAME"
)
}}{{
lowerCase
nodeParam
.
dstPSDELogicParam
.
codeName
}}
.set("
{{
lowerCase
nodeParam
.
dstFieldName
}}
",curuser.getPersonname());
{{/if}}
{{#if
(
eq
nodeParam
.
srcValueType
"CONTEXT"
)
}}{{
lowerCase
nodeParam
.
dstPSDELogicParam
.
codeName
}}
.set("
{{
lowerCase
nodeParam
.
dstFieldName
}}
",default.get("
{{
lowerCase
nodeParam
.
srcFieldName
}}
"));
{{/if}}
{{#if
(
eq
nodeParam
.
srcValueType
"SESSION"
)
}}{{
lowerCase
nodeParam
.
dstPSDELogicParam
.
codeName
}}
.set("
{{
lowerCase
nodeParam
.
dstFieldName
}}
",curuser.getSessionParams().get("
{{
lowerCase
nodeParam
.
srcFieldName
}}
"));
{{/if}}
{{#if
(
eq
nodeParam
.
srcValueType
"NULLVALUE"
)
}}{{
lowerCase
nodeParam
.
dstPSDELogicParam
.
codeName
}}
.set("
{{
lowerCase
nodeParam
.
dstFieldName
}}
",null);
{{/if}}
{{/
each
}}
\ No newline at end of file
modules/ibizlab-template/ibizlab-template-ibizedge/src/main/resources/templ/@macro/logic/drl/RawSQLAndLoopCall.hbs
0 → 100644
浏览文件 @
ffd33184
//RawSQLAndLoopCall
\ No newline at end of file
modules/ibizlab-template/ibizlab-template-ibizedge/src/main/resources/templ/@macro/logic/drl/RawSQLCall.hbs
0 → 100644
浏览文件 @
ffd33184
//RawSQLCall
\ No newline at end of file
modules/ibizlab-template/ibizlab-template-ibizedge/src/main/resources/templ/@macro/logic/drl/StartWF.hbs
0 → 100644
浏览文件 @
ffd33184
//StartWF
\ No newline at end of file
modules/ibizlab-template/ibizlab-template-ibizedge/src/main/resources/templ/{{projectName}}-core/src/main/resources/rules/{{entities}}/{{entityLogics}}Rule.drl.hbs
0 → 100644
浏览文件 @
ffd33184
{{
entityLogic
.
codeName
}}
import java.util.Map;
import java.util.HashMap;
import com.alibaba.fastjson.JSONObject;
import org.springframework.util.StringUtils;
import org.springframework.util.ObjectUtils;
import cn.ibizlab.util.errors.BadRequestAlertException;
{{#
each
entityLogic
.
ruleGlobalParams
as
|
ruleGlobalParam
|
}}
{{
ruleGlobalParam
}}
{{/
each
}}
{{#
each
entityLogic
.
pSDELogicNodes
as
|
deLogicNode
|
}}
//逻辑处理节点[
{{
deLogicNode
.
name
}}
]
rule "
{{
lowerCase
deLogicNode
.
codeName
}}
"
ruleflow-group "
{{
lowerCase
deLogicNode
.
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
}}
{{#
each
entityLogic
.
pSDELogicParams
as
|
logicParam
|
}}
update(
{{
lowerCase
logicParam
.
codeName
}}
);//更新fact中变量值
{{/
each
}}
end
{{/
each
}}
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录