Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
d2544b9f
提交
d2544b9f
编写于
1月 06, 2022
作者:
tony001
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update:更新数据服务和UI服务
上级
1f0f3a30
变更
5
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
88 行增加
和
32 行删除
+88
-32
{{appEntities}}-service-base.ts.hbs
...c/api/{{appEntities}}/{{appEntities}}-service-base.ts.hbs
+9
-3
{{appEntities}}-service.ts.hbs
...}}/src/api/{{appEntities}}/{{appEntities}}-service.ts.hbs
+34
-5
entity-service.ts
...{apps}}/src/core/service/entity-service/entity-service.ts
+36
-16
{{appEntities}}-ui-service-base.ts.hbs
...ce/{{appEntities}}/{{appEntities}}-ui-service-base.ts.hbs
+1
-1
{{appEntities}}-ui-service.ts.hbs
...service/{{appEntities}}/{{appEntities}}-ui-service.ts.hbs
+8
-7
未找到文件。
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/api/{{appEntities}}/{{appEntities}}-service-base.ts.hbs
浏览文件 @
d2544b9f
import { Http, EntityService } from '@core';
import { Http,
IParam,
EntityService } from '@core';
/**
*
{{
appEntity
.
logicName
}}
服务对象基类
...
...
@@ -9,8 +9,14 @@ import { Http, EntityService } from '@core';
*/
export class
{{
pascalCase
appEntity
.
codeName
}}
ServiceBase extends EntityService {
constructor(opts?: any) {
super(opts);
/**
* Creates an instance of
{{
pascalCase
appEntity
.
codeName
}}
ServiceBase.
*
* @param {*} [opts={}]
* @memberof
{{
pascalCase
appEntity
.
codeName
}}
ServiceBase
*/
constructor(opts: IParam = {}) {
super(opts,'
{{
pascalCase
appEntity
.
codeName
}}
');
// 初始化关系实体路径集合
this.deResPaths = [
{{#
each
appEntity
.
appEntityResources
as
|
appEntityResource
|
}}
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/api/{{appEntities}}/{{appEntities}}-service.ts.hbs
浏览文件 @
d2544b9f
import { IParam } from '@core';
import {
{{
pascalCase
appEntity
.
codeName
}}
ServiceBase } from './
{{
spinalCase
appEntity
.
codeName
}}
-service-base';
/**
*
${appEntity.getLogicName()
}服务
*
{{
appEntity
.
logicName
}
}
服务
*
* @export
* @class
{{
pascalCase
appEntity
.
codeName
}}
Service
* @extends
{{
pascalCase
appEntity
.
codeName
}}
ServiceBase
*/
export class
{{
pascalCase
appEntity
.
codeName
}}
Service extends
{{
pascalCase
appEntity
.
codeName
}}
ServiceBase {
/**
* 基础数据服务实例
*
* @private
* @type {
{{
pascalCase
appEntity
.
codeName
}}
Service }
* @memberof
{{
pascalCase
appEntity
.
codeName
}}
Service
*/
private static basicDataServiceInstance:
{{
pascalCase
appEntity
.
codeName
}}
Service;
/**
* 数据服务存储Map对象
*
* @private
* @type {Map
<string
,
any
>
}
* @memberof
{{
pascalCase
appEntity
.
codeName
}}
Service
*/
private static dataServiceMap: Map
<string
,
any
>
= new Map();
/**
* Creates an instance of
{{
pascalCase
appEntity
.
codeName
}}
Service.
* @memberof
{{
pascalCase
appEntity
.
codeName
}}
Service
*/
constructor(opts?: any) {
{{!-- const { context: context, tag: cacheKey } = opts; --}}
constructor(opts?: IParam) {
super(opts);
}
...
...
@@ -25,8 +44,18 @@ export class {{pascalCase appEntity.codeName}}Service extends {{pascalCase appEn
* @return {*} {
{{
pascalCase
appEntity
.
codeName
}}
Service }
* @memberof
{{
pascalCase
appEntity
.
codeName
}}
Service
*/
static getInstance(context?: any):
{{
pascalCase
appEntity
.
codeName
}}
Service {
return new
{{
pascalCase
appEntity
.
codeName
}}
Service({ context: context });
static getInstance(opts?: IParam):
{{
pascalCase
appEntity
.
codeName
}}
Service {
if (!this.basicDataServiceInstance) {
this.basicDataServiceInstance = new
{{
pascalCase
appEntity
.
codeName
}}
Service(opts);
}
if (!opts || !opts.srfdynainstid) {
return this.basicDataServiceInstance;
} else {
if (!
{{
pascalCase
appEntity
.
codeName
}}
Service.dataServiceMap.get(opts.srfdynainstid)) {
{{
pascalCase
appEntity
.
codeName
}}
Service.dataServiceMap.set(opts.srfdynainstid, new
{{
pascalCase
appEntity
.
codeName
}}
Service(opts));
}
return
{{
pascalCase
appEntity
.
codeName
}}
Service.dataServiceMap.get(opts.srfdynainstid);
}
}
}
export default
{{
pascalCase
appEntity
.
codeName
}}
Service;
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/service/entity-service/entity-service.ts
浏览文件 @
d2544b9f
import
{
Http
,
RouteUtil
}
from
'@core'
;
import
{
Http
,
IParam
,
RouteUtil
}
from
'@core'
;
/**
* 实体服务基类
* @export
* @class EntityService
*/
export
class
EntityService
{
export
class
EntityService
{
constructor
(
opts
?:
any
)
{
}
/**
* 应用上下文
*
* @protected
* @type {*}
* @memberof EntityService
*/
protected
context
:
any
;
/**
* 实体关系路径集合
* 实体关系路径集合
*
* @protected
* @type {any[]}
* @memberof EntityService
*/
protected
deResPaths
:
any
[]
=
[]
/**
* HTTP服务类
*
* @protected
* @memberof EntityService
*/
protected
http
=
Http
.
getInstance
();
/**
* 计算请求的实体关系路径
* Creates an instance of EntityService.
* @param {IParam} [opts] 应用上下文
* @param {string} [dbName] 本地存储表
* @param {(0 | 1 | 3)} [storageMode] 存储模式
* @memberof EntityService
*/
constructor
(
opts
:
IParam
=
{},
dbName
?:
string
,
storageMode
?:
0
|
1
|
3
)
{
this
.
context
=
opts
;
}
/**
* 计算请求的实体关系路径
*
* @protected
* @param context 视图上下文
* @param isSelfAppend 是否拼接实体自身的主键值。
* @param {*} context 视图上下文
* @param {boolean} isSelfAppend 是否拼接实体自身的主键值
* @return {*}
* @memberof EntityService
*/
protected
buildDeResPath
(
context
:
any
,
isSelfAppend
:
boolean
){
let
deResPath
=
RouteUtil
.
buildDeResRequestPath
(
context
,
this
.
deResPaths
);
protected
buildDeResPath
(
context
:
any
,
isSelfAppend
:
boolean
)
{
let
deResPath
=
RouteUtil
.
buildDeResRequestPath
(
context
,
this
.
deResPaths
);
// 不需要自身的主键值的删除末尾/xxxx
if
(
!
isSelfAppend
)
{
deResPath
=
deResPath
.
substring
(
0
,
deResPath
.
lastIndexOf
(
"/"
))
if
(
!
isSelfAppend
)
{
deResPath
=
deResPath
.
substring
(
0
,
deResPath
.
lastIndexOf
(
"/"
))
}
return
deResPath
;
}
// TODO 预置方法
public
GET
(){}
}
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/ui-service/{{appEntities}}/{{appEntities}}-ui-service-base.ts.hbs
浏览文件 @
d2544b9f
...
...
@@ -15,7 +15,7 @@ export class {{pascalCase appEntity.codeName}}UIServiceBase extends UIServiceBas
* @param {*} [opts={}]
* @memberof
{{
pascalCase
appEntity
.
codeName
}}
UIServiceBase
*/
constructor(opts:
any
= {}) {
constructor(opts:
IParam
= {}) {
super(opts);
}
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/ui-service/{{appEntities}}/{{appEntities}}-ui-service.ts.hbs
浏览文件 @
d2544b9f
import { IParam } from '@core';
import {
{{
pascalCase
appEntity
.
codeName
}}
UIServiceBase } from './
{{
spinalCase
appEntity
.
codeName
}}
-ui-service-base';
/**
...
...
@@ -31,7 +32,7 @@ export class {{pascalCase appEntity.codeName}}UIService extends {{pascalCase app
* Creates an instance of
{{
pascalCase
appEntity
.
codeName
}}
UIService.
* @memberof
{{
pascalCase
appEntity
.
codeName
}}
UIService
*/
constructor(opts?:
any
) {
constructor(opts?:
IParam
) {
super(opts);
}
...
...
@@ -43,17 +44,17 @@ export class {{pascalCase appEntity.codeName}}UIService extends {{pascalCase app
* @return {*} {
{{
pascalCase
appEntity
.
codeName
}}
UIService }
* @memberof
{{
pascalCase
appEntity
.
codeName
}}
UIService
*/
static getInstance(
context?: any
):
{{
pascalCase
appEntity
.
codeName
}}
UIService {
static getInstance(
opts?: IParam
):
{{
pascalCase
appEntity
.
codeName
}}
UIService {
if (!this.basicUIServiceInstance) {
this.basicUIServiceInstance = new
{{
pascalCase
appEntity
.
codeName
}}
UIService(
context
);
this.basicUIServiceInstance = new
{{
pascalCase
appEntity
.
codeName
}}
UIService(
opts
);
}
if (!
context || !context
.srfdynainstid) {
if (!
opts || !opts
.srfdynainstid) {
return this.basicUIServiceInstance;
} else {
if (!
{{
pascalCase
appEntity
.
codeName
}}
UIService.UIServiceMap.get(
context
.srfdynainstid)) {
{{
pascalCase
appEntity
.
codeName
}}
UIService.UIServiceMap.set(
context.srfdynainstid, new
{{
pascalCase
appEntity
.
codeName
}}
UIService(context
));
if (!
{{
pascalCase
appEntity
.
codeName
}}
UIService.UIServiceMap.get(
opts
.srfdynainstid)) {
{{
pascalCase
appEntity
.
codeName
}}
UIService.UIServiceMap.set(
opts.srfdynainstid, new
{{
pascalCase
appEntity
.
codeName
}}
UIService(opts
));
}
return
{{
pascalCase
appEntity
.
codeName
}}
UIService.UIServiceMap.get(
context
.srfdynainstid);
return
{{
pascalCase
appEntity
.
codeName
}}
UIService.UIServiceMap.get(
opts
.srfdynainstid);
}
}
}
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录