Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzlite
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzlite
提交
d10011f6
提交
d10011f6
编写于
12月 23, 2020
作者:
tangyaologin
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
http://demo.ibizlab.cn/ibiz4jteam/ibzlite
上级
365c1d15
4d6ddda6
变更
6
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
155 行增加
和
1 行删除
+155
-1
meta-entitys.ts
app_web/src/mock/entity/meta-entitys/meta-entitys.ts
+65
-0
meta-entity-service-base.ts
app_web/src/service/meta-entity/meta-entity-service-base.ts
+39
-0
IMetaEntityService.java
...java/cn/ibizlab/core/lite/service/IMetaEntityService.java
+2
-0
MetaEntityServiceImpl.java
...ibizlab/core/lite/service/impl/MetaEntityServiceImpl.java
+16
-0
systemResource.json
...te-core/src/main/resources/permission/systemResource.json
+1
-1
MetaEntityResource.java
...src/main/java/cn/ibizlab/api/rest/MetaEntityResource.java
+32
-0
未找到文件。
app_web/src/mock/entity/meta-entitys/meta-entitys.ts
浏览文件 @
d10011f6
...
...
@@ -364,6 +364,71 @@ mock.onPost(new RegExp(/^\/metaentities\/?([a-zA-Z0-9\-\;]{0,35})\/checkkey$/)).
// InitModels
mock
.
onPost
(
new
RegExp
(
/^
\/
dstsystems
\/([
a-zA-Z0-9
\-\;]{1,35})\/
metaentities
\/([
a-zA-Z0-9
\-\;]{1,35})\/
initmodels$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:metaentity 方法: InitModels"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'pssystemid'
,
'entity_id'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
dstsystems
\/([
a-zA-Z0-9
\-\;]{1,35})\/
metaentities
\/([
a-zA-Z0-9
\-\;]{1,35})\/
initmodels$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
({});
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
{}];
});
// InitModels
mock
.
onPost
(
new
RegExp
(
/^
\/
metaentities
\/?([
a-zA-Z0-9
\-\;]{0,35})\/
initmodels$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:metaentity 方法: InitModels"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'entity_id'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
metaentities
\/([
a-zA-Z0-9
\-\;]{1,35})\/
initmodels$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
//let items = mockDatas ? mockDatas : [];
//let _items = items.find((item: any) => Object.is(item.entity_id, tempValue.entity_id));
let
data
=
JSON
.
parse
(
config
.
data
);
mockDatas
.
forEach
((
item
)
=>
{
if
(
item
[
'entity_id'
]
==
tempValue
[
'entity_id'
]
){
for
(
let
value
in
data
){
if
(
item
.
hasOwnProperty
(
value
)){
item
[
value
]
=
data
[
value
];
}
}
}
})
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
data
);
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
data
];
});
// Save
mock
.
onPost
(
new
RegExp
(
/^
\/
dstsystems
\/([
a-zA-Z0-9
\-\;]{1,35})\/
metaentities
\/([
a-zA-Z0-9
\-\;]{1,35})\/
save$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:metaentity 方法: Save"
);
...
...
app_web/src/service/meta-entity/meta-entity-service-base.ts
浏览文件 @
d10011f6
...
...
@@ -245,6 +245,45 @@ export default class MetaEntityServiceBase extends EntityService {
return
await
Http
.
getInstance
().
post
(
`/metaentity/getdefaultmodelbatch`
,
tempData
,
isloading
);
}
/**
* InitModels接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MetaEntityServiceBase
*/
public
async
InitModels
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
dstsystem
&&
context
.
metaentity
){
let
masterData
:
any
=
{};
Object
.
assign
(
data
,
masterData
);
let
res
:
any
=
await
Http
.
getInstance
().
post
(
`/dstsystems/
${
context
.
dstsystem
}
/metaentities/
${
context
.
metaentity
}
/initmodels`
,
data
,
isloading
);
return
res
;
}
let
res
:
any
=
Http
.
getInstance
().
post
(
`/metaentities/
${
context
.
metaentity
}
/initmodels`
,
data
,
isloading
);
return
res
;
}
/**
* InitModelsBatch接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MetaEntityServiceBase
*/
public
async
InitModelsBatch
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
if
(
context
.
dstsystem
&&
true
){
let
tempData
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
return
await
Http
.
getInstance
().
post
(
`/dstsystems/
${
context
.
dstsystem
}
/metaentity/initmodelsbatch`
,
tempData
,
isloading
);
}
let
tempData
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
return
await
Http
.
getInstance
().
post
(
`/metaentity/initmodelsbatch`
,
tempData
,
isloading
);
}
/**
* Save接口方法
*
...
...
ibzlite-core/src/main/java/cn/ibizlab/core/lite/service/IMetaEntityService.java
浏览文件 @
d10011f6
...
...
@@ -36,6 +36,8 @@ public interface IMetaEntityService extends IService<MetaEntity> {
boolean
checkKey
(
MetaEntity
et
);
MetaEntity
getDefaultModel
(
MetaEntity
et
);
boolean
getDefaultModelBatch
(
List
<
MetaEntity
>
etList
);
MetaEntity
initModels
(
MetaEntity
et
);
boolean
initModelsBatch
(
List
<
MetaEntity
>
etList
);
boolean
save
(
MetaEntity
et
);
void
saveBatch
(
List
<
MetaEntity
>
list
);
Page
<
MetaEntity
>
searchDefault
(
MetaEntitySearchContext
context
);
...
...
ibzlite-core/src/main/java/cn/ibizlab/core/lite/service/impl/MetaEntityServiceImpl.java
浏览文件 @
d10011f6
...
...
@@ -182,6 +182,22 @@ public class MetaEntityServiceImpl extends ServiceImpl<MetaEntityMapper, MetaEnt
return
true
;
}
@Override
@Transactional
public
MetaEntity
initModels
(
MetaEntity
et
)
{
//自定义代码
return
et
;
}
@Override
@Transactional
public
boolean
initModelsBatch
(
List
<
MetaEntity
>
etList
)
{
for
(
MetaEntity
et
:
etList
)
{
initModels
(
et
);
}
return
true
;
}
@Override
@Transactional
public
boolean
save
(
MetaEntity
et
)
{
...
...
ibzlite-core/src/main/resources/permission/systemResource.json
浏览文件 @
d10011f6
...
...
@@ -120,7 +120,7 @@
"delogicname"
:
"实体"
,
"sysmoudle"
:{
"id"
:
"LITE"
,
"name"
:
"lite"
},
"dedataset"
:[{
"id"
:
"Default"
,
"name"
:
"数据集"
}],
"deaction"
:[{
"id"
:
"Create"
,
"name"
:
"Create"
,
"type"
:
"BUILTIN"
},{
"id"
:
"Update"
,
"name"
:
"Update"
,
"type"
:
"BUILTIN"
},{
"id"
:
"Remove"
,
"name"
:
"Remove"
,
"type"
:
"BUILTIN"
},{
"id"
:
"Get"
,
"name"
:
"Get"
,
"type"
:
"BUILTIN"
},{
"id"
:
"GetDraft"
,
"name"
:
"GetDraft"
,
"type"
:
"BUILTIN"
},{
"id"
:
"CheckKey"
,
"name"
:
"CheckKey"
,
"type"
:
"BUILTIN"
},{
"id"
:
"GetDefaultModel"
,
"name"
:
"GetDefaultModel"
,
"type"
:
"USERCUSTOM"
},{
"id"
:
"Save"
,
"name"
:
"Save"
,
"type"
:
"BUILTIN"
}],
"deaction"
:[{
"id"
:
"Create"
,
"name"
:
"Create"
,
"type"
:
"BUILTIN"
},{
"id"
:
"Update"
,
"name"
:
"Update"
,
"type"
:
"BUILTIN"
},{
"id"
:
"Remove"
,
"name"
:
"Remove"
,
"type"
:
"BUILTIN"
},{
"id"
:
"Get"
,
"name"
:
"Get"
,
"type"
:
"BUILTIN"
},{
"id"
:
"GetDraft"
,
"name"
:
"GetDraft"
,
"type"
:
"BUILTIN"
},{
"id"
:
"CheckKey"
,
"name"
:
"CheckKey"
,
"type"
:
"BUILTIN"
},{
"id"
:
"GetDefaultModel"
,
"name"
:
"GetDefaultModel"
,
"type"
:
"USERCUSTOM"
},{
"id"
:
"
InitModels"
,
"name"
:
"行为"
,
"type"
:
"USERCUSTOM"
},{
"id"
:
"
Save"
,
"name"
:
"Save"
,
"type"
:
"BUILTIN"
}],
"datascope"
:[{
"id"
:
"all"
,
"name"
:
"全部数据"
}]
}
,
{
...
...
ibzlite-provider/ibzlite-provider-api/src/main/java/cn/ibizlab/api/rest/MetaEntityResource.java
浏览文件 @
d10011f6
...
...
@@ -138,6 +138,23 @@ public class MetaEntityResource {
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
metaentityService
.
getDefaultModelBatch
(
metaentityMapping
.
toDomain
(
metaentitydtos
)));
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzlite-MetaEntity-InitModels-all')"
)
@ApiOperation
(
value
=
"行为"
,
tags
=
{
"实体"
},
notes
=
"行为"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/metaentities/{metaentity_id}/initmodels"
)
public
ResponseEntity
<
MetaEntityDTO
>
initModels
(
@PathVariable
(
"metaentity_id"
)
String
metaentity_id
,
@RequestBody
MetaEntityDTO
metaentitydto
)
{
MetaEntity
domain
=
metaentityMapping
.
toDomain
(
metaentitydto
);
domain
.
setEntityId
(
metaentity_id
);
domain
=
metaentityService
.
initModels
(
domain
);
metaentitydto
=
metaentityMapping
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
metaentitydto
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzlite-MetaEntity-InitModels-all')"
)
@ApiOperation
(
value
=
"批量处理[行为]"
,
tags
=
{
"实体"
},
notes
=
"批量处理[行为]"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/metaentities/{metaentity_id}/initmodelsbatch"
)
public
ResponseEntity
<
Boolean
>
initModelsBatch
(
@RequestBody
List
<
MetaEntityDTO
>
metaentitydtos
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
metaentityService
.
initModelsBatch
(
metaentityMapping
.
toDomain
(
metaentitydtos
)));
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzlite-MetaEntity-Save-all')"
)
@ApiOperation
(
value
=
"保存实体"
,
tags
=
{
"实体"
},
notes
=
"保存实体"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/metaentities/save"
)
...
...
@@ -277,6 +294,21 @@ public class MetaEntityResource {
public
ResponseEntity
<
Boolean
>
getDefaultModelByDstSystem
(
@PathVariable
(
"dstsystem_id"
)
String
dstsystem_id
,
@RequestBody
List
<
MetaEntityDTO
>
metaentitydtos
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
metaentityService
.
getDefaultModelBatch
(
metaentityMapping
.
toDomain
(
metaentitydtos
)));
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzlite-MetaEntity-InitModels-all')"
)
@ApiOperation
(
value
=
"根据系统实体"
,
tags
=
{
"实体"
},
notes
=
"根据系统实体"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/dstsystems/{dstsystem_id}/metaentities/{metaentity_id}/initmodels"
)
public
ResponseEntity
<
MetaEntityDTO
>
initModelsByDstSystem
(
@PathVariable
(
"dstsystem_id"
)
String
dstsystem_id
,
@PathVariable
(
"metaentity_id"
)
String
metaentity_id
,
@RequestBody
MetaEntityDTO
metaentitydto
)
{
MetaEntity
domain
=
metaentityMapping
.
toDomain
(
metaentitydto
);
domain
.
setSystemId
(
dstsystem_id
);
domain
=
metaentityService
.
initModels
(
domain
)
;
metaentitydto
=
metaentityMapping
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
metaentitydto
);
}
@ApiOperation
(
value
=
"批量处理[根据系统实体]"
,
tags
=
{
"实体"
},
notes
=
"批量处理[根据系统实体]"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/dstsystems/{dstsystem_id}/metaentities/{metaentity_id}/initmodelsbatch"
)
public
ResponseEntity
<
Boolean
>
initModelsByDstSystem
(
@PathVariable
(
"dstsystem_id"
)
String
dstsystem_id
,
@RequestBody
List
<
MetaEntityDTO
>
metaentitydtos
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
metaentityService
.
initModelsBatch
(
metaentityMapping
.
toDomain
(
metaentitydtos
)));
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzlite-MetaEntity-Save-all')"
)
@ApiOperation
(
value
=
"根据系统保存实体"
,
tags
=
{
"实体"
},
notes
=
"根据系统保存实体"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/dstsystems/{dstsystem_id}/metaentities/save"
)
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录