Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
bad4af19
提交
bad4af19
编写于
8月 03, 2022
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
模板切分
上级
b9c29466
变更
1
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
0 行增加
和
127 行删除
+0
-127
{{apiEntities}}SubSysServiceAPIDERuntime.java.hbs
...aentity/{{apiEntities}}SubSysServiceAPIDERuntime.java.hbs
+0
-127
未找到文件。
modules/ibizlab-template/ibizlab-template-apiclient/src/main/resources/templ/apiclient/{{projectName}}-apiclient-{{apis}}/src/main/java/{{packageName}}/client/{{apis}}/runtime/service/dataentity/{{apiEntities}}SubSysServiceAPIDERuntime.java.hbs
已删除
100644 → 0
浏览文件 @
b9c29466
package
{{
packageName
}}
.client.
{{
lowerCase
apiEntity
.
api
.
codeName
}}
.runtime.service.dataentity;
import net.ibizsys.central.r8.util.SpringContextHolder;
import net.ibizsys.central.util.ISearchContextDTO;
import
{{
packageName
}}
.client.
{{
lowerCase
apiEntity
.
api
.
codeName
}}
.feign.dto.
{{
apiEntity
.
codeName
}}
DTO;
import
{{
packageName
}}
.client.
{{
lowerCase
apiEntity
.
api
.
codeName
}}
.feign.
{{
apiEntity
.
codeName
}}
FeignClient;
import net.ibizsys.central.dataentity.IDataEntityRuntime;
import net.ibizsys.central.util.IEntityDTO;
import net.ibizsys.central.util.SearchContextDTO;
import net.ibizsys.model.dataentity.action.IPSDEAction;
import net.ibizsys.model.dataentity.ds.IPSDEDataSet;
import net.ibizsys.model.service.IPSSubSysServiceAPIDEMethod;
import net.ibizsys.runtime.util.DataTypeUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Sort;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/**
* 实体[
{{
apiEntity
.
codeName
}}
] 对象
*
*/
public class
{{
apiEntity
.
codeName
}}
SubSysServiceAPIDERuntime extends
{{
packageName
}}
.client.
{{
lowerCase
apiEntity
.
api
.
codeName
}}
.runtime.service.
{{
apiEntity
.
api
.
codeName
}}
R8SubSysServiceAPIDERuntime{
private
{{
apiEntity
.
codeName
}}
FeignClient getClient() {
return SpringContextHolder.getBean(
{{
apiEntity
.
codeName
}}
FeignClient.class);
}
@Override
public IEntityDTO createClientEntity() {
return new
{{
apiEntity
.
codeName
}}
DTO();
}
@Override
public Object onInvokeMethod(IPSSubSysServiceAPIDEMethod iPSSubSysServiceAPIDEMethod, Map
<String
,
Object
>
context, IDataEntityRuntime iDataEntityRuntime, IPSDEAction iPSDEAction, Object[] args) throws Throwable {
Object key;
if (args[0] instanceof IEntityDTO) {
key = ((IEntityDTO) args[0]).get(iDataEntityRuntime.getKeyPSDEField().getName().toLowerCase());
} else {
key = args[0];
}
Object obj = null;
String strActionName = iPSDEAction.getName().toLowerCase();
switch (strActionName) {
{{#
each
apiEntity
.
pSDataEntity
.
allPSDEActions
as
|
deAction
|
}}
case "
{{
lowerCase
deAction
.
name
}}
":
{{#
each
apiEntity
.
methods
as
|
method
|
}}
{{#if
(
and
(
eq
methodType
"DEACTION"
)
(
eq
method
.
pSDEServiceAPIMethod
.
pSDEAction
.
name
deAction
.
name
))
}}
{{#
each
method
.
parentApiEntities
as
|
parent
|
}}
{{#if
(
and
(
eq
@index
0
)
@last
)
}}
if (context != null
&&
context.containsKey("
{{
parent
.
majorPSDEServiceAPI
.
name
}}
")) {
{{#
eq
return
.
type
"DTO"
}}
obj =
{{/
eq
}}{{#
eq
return
.
type
"SIMPLE"
}}
obj =
{{/
eq
}}{{#
eq
return
.
type
"USER"
}}
obj =
{{/
eq
}}
getClient().
{{
camelCase
method
.
name
}}{{#
each
pathVariables
as
|
pathVariable
|
}}{{#if
@first
}}
By
{{else}}
And
{{/if}}{{
pascalCase
pathVariable
.
name
}}{{/
each
}}
(
{{#
each
pathVariables
as
|
pathVariable
|
}}{{#
unless
@first
}}
,
{{/
unless
}}
(
{{
type
.
java
}}
)
{{#
unless
(
and
@last
method
.
pSDEServiceAPIMethod
.
isNeedResourceKey
)
}}
context.get("
{{
parent
.
majorPSDEServiceAPI
.
name
}}
")
{{/
unless
}}{{#if
(
and
@last
method
.
pSDEServiceAPIMethod
.
isNeedResourceKey
)
}}
key
{{/if}}{{/
each
}}{{#if
body
}}{{#if
pathVariables
}}
,
{{/if}}{{#
eq
input
.
type
"DTO"
}}
(
{{
body
}}
)
{{/
eq
}}{{#
eq
input
.
type
"KEYFIELD"
}}{{#
eq
pSDEAction
.
actionType
"USERCUSTOM"
}}
(
{{
body
}}
)
{{/
eq
}}{{/
eq
}}{{#
eq
input
.
type
"DTOS"
}}
(List
<
{{
body
}}
>
)
{{/
eq
}}
convert2ClientEntity(args[0])
{{/if}}
);
break;
}
{{/if}}
{{/
each
}}
{{/if}}
{{/
each
}}
{{#
each
apiEntity
.
methods
as
|
method
|
}}
{{#if
(
and
(
eq
methodType
"DEACTION"
)
(
eq
method
.
pSDEServiceAPIMethod
.
pSDEAction
.
name
deAction
.
name
))
}}
{{#
unless
method
.
parentApiEntities
}}
{{#
eq
return
.
type
"DTO"
}}
obj =
{{/
eq
}}{{#
eq
return
.
type
"SIMPLE"
}}
obj =
{{/
eq
}}{{#
eq
return
.
type
"USER"
}}
obj =
{{/
eq
}}
getClient().
{{
camelCase
method
.
name
}}{{#
each
pathVariables
as
|
pathVariables
|
}}{{#if
@first
}}
By
{{else}}
And
{{/if}}{{
pascalCase
pathVariables
.
name
}}{{/
each
}}
(
{{#
each
pathVariables
as
|
pathVariable
|
}}{{#
unless
@first
}}
,
{{/
unless
}}
(
{{
type
.
java
}}
) key
{{/
each
}}{{#if
body
}}{{#if
pathVariables
}}
,
{{/if}}{{#
eq
input
.
type
"DTO"
}}
(
{{
body
}}
)
{{/
eq
}}{{#
eq
input
.
type
"KEYFIELD"
}}{{#
eq
pSDEAction
.
actionType
"USERCUSTOM"
}}
(
{{
body
}}
)
{{/
eq
}}{{/
eq
}}{{#
eq
input
.
type
"DTOS"
}}
(List
<
{{
body
}}
>
)
{{/
eq
}}
convert2ClientEntity(args[0])
{{/if}}
);
break;
{{/
unless
}}
{{/if}}
{{/
each
}}
{{/
each
}}
{{#
each
apiEntity
.
methods
}}
{{/
each
}}
}
IEntityDTO entityDTO = iDataEntityRuntime.createEntity();
entityDTO.reload(obj, true, false);
return entityDTO;
}
@Override
public Object onInvokeMethod(IPSSubSysServiceAPIDEMethod iPSSubSysServiceAPIDEMethod, Map
<String
,
Object
>
context, IDataEntityRuntime iDataEntityRuntime, IPSDEDataSet iPSDEDataSet, Object[] args) throws Throwable {
Object obj = null;
convertCondition((SearchContextDTO)args[0]);
String strActionName = iPSDEDataSet.getName().toLowerCase();
switch (strActionName) {
{{#
each
apiEntity
.
pSDataEntity
.
allPSDEDataSets
as
|
dataSet
|
}}
case "
{{
lowerCase
dataSet
.
name
}}
":
{{#
each
apiEntity
.
methods
as
|
method
|
}}
{{#if
(
and
(
eq
methodType
"FETCH"
)
(
eq
method
.
pSDEServiceAPIMethod
.
pSDEDataSet
.
name
dataSet
.
name
))
}}
{{#
each
method
.
parentApiEntities
as
|
parent
|
}}
{{#if
(
and
(
eq
@index
0
)
@last
)
}}
if (context != null
&&
context.containsKey("
{{
parent
.
majorPSDEServiceAPI
.
name
}}
")) {
obj = getClient().
{{
camelCase
method
.
name
}}{{#
each
method
.
pathVariables
as
|
pathVariaable
|
}}{{#if
@first
}}
By
{{else}}
And
{{/if}}{{
pascalCase
pathVariaable
.
name
}}{{/
each
}}
(
{{#
each
method
.
pathVariables
}}{{#
unless
@first
}}
,
{{/
unless
}}
(
{{
type
.
java
}}
) context.get("
{{
parent
.
majorPSDEServiceAPI
.
name
}}
")
{{/
each
}}{{#if
body
}}{{#if
method
.
pathVariables
}}
,
{{/if}}
(SearchContextDTO)args[0]
{{/if}}
);
break;
}
{{/if}}
{{/
each
}}
{{/if}}
{{/
each
}}
{{#
each
apiEntity
.
methods
as
|
method
|
}}
{{#if
(
and
(
eq
methodType
"FETCH"
)
(
eq
method
.
pSDEServiceAPIMethod
.
pSDEDataSet
.
name
dataSet
.
name
))
}}
{{#
unless
method
.
parentApiEntities
}}
obj = getClient().
{{
camelCase
method
.
name
}}{{#
each
method
.
pathVariables
}}{{#if
@first
}}
By
{{else}}
And
{{/if}}{{
pascalCase
method
.
name
}}{{/
each
}}
(
{{#
each
method
.
pathVariables
}}{{#
unless
@first
}}
,
{{/
unless
}}
(
{{
type
.
java
}}
)key
{{/
each
}}{{#if
body
}}{{#if
method
.
pathVariables
}}
,
{{/if}}
(SearchContextDTO)args[0]
{{/if}}
);
break;
{{/
unless
}}
{{/if}}
{{/
each
}}
{{/
each
}}
{{#
each
apiEntity
.
methods
}}
{{/
each
}}
}
List recodes = new ArrayList();
SearchContextDTO dto = (SearchContextDTO) args[0];
if (obj != null
&&
obj instanceof Page) {
Page ret = (Page) obj;
for (Object item : ret.getContent()) {
recodes.add(convert2Entity(item));
}
return new PageImpl(recodes, dto.getPageable(), ret.getTotalElements());
}
return new PageImpl(recodes, dto.getPageable(), 0);
}
}
\ No newline at end of file
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录