Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzdata
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzdata
提交
5ad47856
提交
5ad47856
编写于
9月 02, 2021
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tableschema
上级
7e478f0b
变更
7
展开全部
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
415 行增加
和
128 行删除
+415
-128
DynamicModelService.java
...n/java/cn/ibizlab/core/data/lite/DynamicModelService.java
+59
-4
POSchema.java
...re/src/main/java/cn/ibizlab/core/data/model/POSchema.java
+26
-1
PojoOption.java
.../src/main/java/cn/ibizlab/core/data/model/PojoOption.java
+5
-1
IPersistentService.java
...java/cn/ibizlab/core/data/service/IPersistentService.java
+51
-51
ModelService.java
.../main/java/cn/ibizlab/core/data/service/ModelService.java
+272
-69
DbPersistentServiceImpl.java
...izlab/core/data/service/impl/DbPersistentServiceImpl.java
+1
-1
MongoPersistentServiceImpl.java
...ab/core/data/service/impl/MongoPersistentServiceImpl.java
+1
-1
未找到文件。
ibzdata-core/src/main/java/cn/ibizlab/core/data/lite/DynamicModelService.java
浏览文件 @
5ad47856
...
...
@@ -18,7 +18,9 @@ import net.ibizsys.model.dataentity.ds.IPSDEDataSetGroupParam;
import
net.ibizsys.model.dataentity.ds.PSDEDataSetGroupParamImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.cache.annotation.Caching
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
...
...
@@ -58,12 +60,9 @@ public class DynamicModelService {
return
initDynamicSystem
(
system
);
}
private
IPSSystem
initDynamicSystem
(
String
system
)
{
if
(
dynamicSystems
==
null
)
dynamicSystems
=
new
HashMap
<>();
IPSSystem
iPSSystem
=
null
;
String
strPSModelFolderPath
=
null
;
if
(
Files
.
exists
(
Paths
.
get
(
getModelPath
(),
system
,
"model"
,
"PSSYSTEM.json"
)))
{
strPSModelFolderPath
=
Paths
.
get
(
getModelPath
(),
system
,
"model"
).
toString
();
...
...
@@ -74,6 +73,14 @@ public class DynamicModelService {
if
(
allDynamicModel
.
containsKey
(
system
))
strPSModelFolderPath
=
allDynamicModel
.
get
(
system
).
getDynamicModelPath
();
}
return
initDynamicSystem
(
system
,
strPSModelFolderPath
);
}
private
IPSSystem
initDynamicSystem
(
String
system
,
String
strPSModelFolderPath
)
{
if
(
dynamicSystems
==
null
)
dynamicSystems
=
new
HashMap
<>();
IPSSystem
iPSSystem
=
null
;
if
(
StringUtils
.
isEmpty
(
strPSModelFolderPath
))
throw
new
BadRequestAlertException
(
"加载系统模型错误,未找到对应模型目录"
,
"DynamicSystem"
,
system
);
...
...
@@ -647,4 +654,52 @@ public class DynamicModelService {
}
private
Map
<
String
,
Long
>
systemModifyMap
=
new
HashMap
<>();
@Caching
(
evict
=
{
@CacheEvict
(
value
=
"syspssystem"
,
allEntries
=
true
),
@CacheEvict
(
value
=
"meta-entities"
,
key
=
"'system:'+#p0"
),
@CacheEvict
(
value
=
"meta-entities"
,
key
=
"'system:keymap-'+#p0"
)
})
public
void
resetSystem
(
String
system
)
{
}
private
IPSSystem
reloadDynamicSystem
(
DstSystemModel
system
)
{
return
initDynamicSystem
(
system
.
getPssystemid
(),
system
.
getDynamicModelPath
());
}
public
Map
<
String
,
Map
<
String
,
Long
>>
getAllDynamicModelVersion
()
{
Map
<
String
,
Map
<
String
,
Long
>>
ret
=
new
LinkedHashMap
<>();
this
.
findAllDynamicModel
().
values
().
forEach
(
dstSystemModel
->
{
if
(
ret
.
containsKey
(
dstSystemModel
.
getPssystemid
()))
return
;
if
((!
systemModifyMap
.
containsKey
(
dstSystemModel
.
getPssystemid
()))||
systemModifyMap
.
get
(
dstSystemModel
.
getPssystemid
())<
dstSystemModel
.
getLastModify
())
{
reloadDynamicSystem
(
dstSystemModel
);
this
.
getProxy
().
resetSystem
(
dstSystemModel
.
getPssystemid
());
if
(!
dstSystemModel
.
getPssystemid
().
equals
(
dstSystemModel
.
getPssystemid
().
toLowerCase
()))
this
.
getProxy
().
resetSystem
(
dstSystemModel
.
getPssystemid
().
toLowerCase
());
}
systemModifyMap
.
put
(
dstSystemModel
.
getPssystemid
(),
dstSystemModel
.
getLastModify
());
Map
<
String
,
Long
>
entities
=
new
LinkedHashMap
<>();
ret
.
put
(
dstSystemModel
.
getPssystemid
(),
entities
);
try
{
this
.
getEntities
(
dstSystemModel
.
getPssystemid
()).
values
().
forEach
(
metaEntityModel
->
{
if
(
entities
.
containsKey
(
metaEntityModel
.
getEntityName
()))
return
;
entities
.
put
(
metaEntityModel
.
getEntityName
(),
dstSystemModel
.
getLastModify
());
});
}
catch
(
Exception
exception
)
{
}
});
return
ret
;
}
}
ibzdata-core/src/main/java/cn/ibizlab/core/data/model/POSchema.java
浏览文件 @
5ad47856
...
...
@@ -113,6 +113,19 @@ public class POSchema {
return
this
;
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
Set
<
String
>
getForeignKey
()
{
Set
<
String
>
fks
=
new
HashSet
<>();
if
(
foreignKeyConstraints
!=
null
)
{
foreignKeyConstraints
.
forEach
(
fk
->
fks
.
add
(
fk
.
getConstraintName
()));
}
return
fks
;
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
private
Map
<
String
,
Column
>
columnMaps
;
...
...
@@ -633,7 +646,19 @@ public class POSchema {
put
(
"h2"
,
"mysql"
);
}};
public
Segment
getSegment
(
String
tag
)
{
if
(
segments
!=
null
)
{
for
(
Segment
script:
segments
)
{
String
key
=
DataObject
.
getStringValue
(
script
.
getName
(),
""
).
concat
(
"."
).
concat
(
DataObject
.
getStringValue
(
script
.
getVendorProvider
(),
""
));
if
(
key
.
equals
(
tag
))
return
script
;
}
}
return
null
;
}
public
Segment
getSegment
(
String
name
,
String
type
)
{
...
...
ibzdata-core/src/main/java/cn/ibizlab/core/data/model/PojoOption.java
浏览文件 @
5ad47856
...
...
@@ -41,7 +41,11 @@ public class PojoOption extends DataObj
}
public
String
getSystem
(){
return
this
.
getStringValue
(
"system_id"
,
this
.
getStringValue
(
"system_name"
,
this
.
getStringValue
(
"system"
)));
return
this
.
getStringValue
(
"system_id"
,
this
.
getStringValue
(
"system"
,
this
.
getStringValue
(
"system_name"
)));
}
public
String
getSystemName
(){
return
this
.
getStringValue
(
"system_name"
,
this
.
getStringValue
(
"system"
,
this
.
getStringValue
(
"system_id"
)));
}
public
String
getPackage
(){
...
...
ibzdata-core/src/main/java/cn/ibizlab/core/data/service/IPersistentService.java
浏览文件 @
5ad47856
...
...
@@ -55,126 +55,126 @@ public interface IPersistentService {
default
BaseData
create
(
String
datasource
,
String
tabl
e
,
BaseData
et
,
boolean
bGet
)
default
BaseData
create
(
String
system
,
String
table
,
String
datasourc
e
,
BaseData
et
,
boolean
bGet
)
{
DSLink
link
=
getDSLink
(
datasource
);
return
create
(
link
,
getSchema
(
link
,
table
),
et
,
bGet
);
return
create
(
link
,
getSchema
(
link
,
system
,
table
),
et
,
bGet
);
}
default
List
<
BaseData
>
createBatch
(
String
datasource
,
String
tabl
e
,
List
<
BaseData
>
list
,
boolean
bGet
)
default
List
<
BaseData
>
createBatch
(
String
system
,
String
table
,
String
datasourc
e
,
List
<
BaseData
>
list
,
boolean
bGet
)
{
DSLink
link
=
getDSLink
(
datasource
);
return
createBatch
(
link
,
getSchema
(
link
,
table
),
list
,
bGet
);
return
createBatch
(
link
,
getSchema
(
link
,
system
,
table
),
list
,
bGet
);
}
default
BaseData
update
(
String
datasource
,
String
tabl
e
,
BaseData
et
,
boolean
bGet
)
default
BaseData
update
(
String
system
,
String
table
,
String
datasourc
e
,
BaseData
et
,
boolean
bGet
)
{
DSLink
link
=
getDSLink
(
datasource
);
return
update
(
link
,
getSchema
(
link
,
table
),
et
,
bGet
);
return
update
(
link
,
getSchema
(
link
,
system
,
table
),
et
,
bGet
);
}
default
List
<
BaseData
>
updateBatch
(
String
datasource
,
String
tabl
e
,
List
<
BaseData
>
list
,
boolean
bGet
)
default
List
<
BaseData
>
updateBatch
(
String
system
,
String
table
,
String
datasourc
e
,
List
<
BaseData
>
list
,
boolean
bGet
)
{
DSLink
link
=
getDSLink
(
datasource
);
return
updateBatch
(
link
,
getSchema
(
link
,
table
),
list
,
bGet
);
return
updateBatch
(
link
,
getSchema
(
link
,
system
,
table
),
list
,
bGet
);
}
default
boolean
remove
(
String
datasource
,
String
tabl
e
,
Serializable
key
)
default
boolean
remove
(
String
system
,
String
table
,
String
datasourc
e
,
Serializable
key
)
{
DSLink
link
=
getDSLink
(
datasource
);
return
remove
(
link
,
getSchema
(
link
,
table
),
key
);
return
remove
(
link
,
getSchema
(
link
,
system
,
table
),
key
);
}
default
boolean
removeBatch
(
String
datasource
,
String
tabl
e
,
List
<
Serializable
>
idList
)
default
boolean
removeBatch
(
String
system
,
String
table
,
String
datasourc
e
,
List
<
Serializable
>
idList
)
{
DSLink
link
=
getDSLink
(
datasource
);
return
removeBatch
(
link
,
getSchema
(
link
,
table
),
idList
);
return
removeBatch
(
link
,
getSchema
(
link
,
system
,
table
),
idList
);
}
default
boolean
removeByMap
(
String
datasource
,
String
tabl
e
,
BaseData
et
)
default
boolean
removeByMap
(
String
system
,
String
table
,
String
datasourc
e
,
BaseData
et
)
{
DSLink
link
=
getDSLink
(
datasource
);
return
removeByMap
(
link
,
getSchema
(
link
,
table
),
et
);
return
removeByMap
(
link
,
getSchema
(
link
,
system
,
table
),
et
);
}
default
boolean
removeByMapBatch
(
String
datasource
,
String
tabl
e
,
List
<
BaseData
>
list
)
default
boolean
removeByMapBatch
(
String
system
,
String
table
,
String
datasourc
e
,
List
<
BaseData
>
list
)
{
DSLink
link
=
getDSLink
(
datasource
);
return
removeByMapBatch
(
link
,
getSchema
(
link
,
table
),
list
);
return
removeByMapBatch
(
link
,
getSchema
(
link
,
system
,
table
),
list
);
}
default
BaseData
get
(
String
datasource
,
String
tabl
e
,
Serializable
key
)
default
BaseData
get
(
String
system
,
String
table
,
String
datasourc
e
,
Serializable
key
)
{
DSLink
link
=
getDSLink
(
datasource
);
return
get
(
link
,
getSchema
(
link
,
table
),
key
);
return
get
(
link
,
getSchema
(
link
,
system
,
table
),
key
);
}
default
List
<
BaseData
>
getBatch
(
String
datasource
,
String
tabl
e
,
List
<
Serializable
>
idList
)
default
List
<
BaseData
>
getBatch
(
String
system
,
String
table
,
String
datasourc
e
,
List
<
Serializable
>
idList
)
{
DSLink
link
=
getDSLink
(
datasource
);
return
getBatch
(
link
,
getSchema
(
link
,
table
),
idList
);
return
getBatch
(
link
,
getSchema
(
link
,
system
,
table
),
idList
);
}
default
BaseData
getByMap
(
String
datasource
,
String
tabl
e
,
BaseData
et
)
default
BaseData
getByMap
(
String
system
,
String
table
,
String
datasourc
e
,
BaseData
et
)
{
DSLink
link
=
getDSLink
(
datasource
);
return
getByMap
(
link
,
getSchema
(
link
,
table
),
et
);
return
getByMap
(
link
,
getSchema
(
link
,
system
,
table
),
et
);
}
default
List
<
BaseData
>
getByMapBatch
(
String
datasource
,
String
tabl
e
,
List
<
BaseData
>
list
)
default
List
<
BaseData
>
getByMapBatch
(
String
system
,
String
table
,
String
datasourc
e
,
List
<
BaseData
>
list
)
{
DSLink
link
=
getDSLink
(
datasource
);
return
getByMapBatch
(
link
,
getSchema
(
link
,
table
),
list
);
return
getByMapBatch
(
link
,
getSchema
(
link
,
system
,
table
),
list
);
}
default
List
<
BaseData
>
getBatchKey
(
String
datasource
,
String
tabl
e
,
List
<
BaseData
>
list
)
default
List
<
BaseData
>
getBatchKey
(
String
system
,
String
table
,
String
datasourc
e
,
List
<
BaseData
>
list
)
{
DSLink
link
=
getDSLink
(
datasource
);
return
getBatchKey
(
link
,
getSchema
(
link
,
table
),
list
);
return
getBatchKey
(
link
,
getSchema
(
link
,
system
,
table
),
list
);
}
default
Long
count
(
String
datasource
,
String
tabl
e
,
BaseData
et
)
default
Long
count
(
String
system
,
String
table
,
String
datasourc
e
,
BaseData
et
)
{
DSLink
link
=
getDSLink
(
datasource
);
return
count
(
link
,
getSchema
(
link
,
table
),
et
);
return
count
(
link
,
getSchema
(
link
,
system
,
table
),
et
);
}
default
boolean
checkKey
(
String
datasource
,
String
tabl
e
,
BaseData
et
)
default
boolean
checkKey
(
String
system
,
String
table
,
String
datasourc
e
,
BaseData
et
)
{
DSLink
link
=
getDSLink
(
datasource
);
return
checkKey
(
link
,
getSchema
(
link
,
table
),
et
);
return
checkKey
(
link
,
getSchema
(
link
,
system
,
table
),
et
);
}
default
BaseData
save
(
String
datasource
,
String
tabl
e
,
BaseData
et
,
boolean
bGet
)
default
BaseData
save
(
String
system
,
String
table
,
String
datasourc
e
,
BaseData
et
,
boolean
bGet
)
{
DSLink
link
=
getDSLink
(
datasource
);
return
save
(
link
,
getSchema
(
link
,
table
),
et
,
bGet
);
return
save
(
link
,
getSchema
(
link
,
system
,
table
),
et
,
bGet
);
}
default
List
<
BaseData
>
saveBatch
(
String
datasource
,
String
tabl
e
,
List
<
BaseData
>
list
,
boolean
bGet
)
default
List
<
BaseData
>
saveBatch
(
String
system
,
String
table
,
String
datasourc
e
,
List
<
BaseData
>
list
,
boolean
bGet
)
{
DSLink
link
=
getDSLink
(
datasource
);
return
saveBatch
(
link
,
getSchema
(
link
,
table
),
list
,
bGet
);
return
saveBatch
(
link
,
getSchema
(
link
,
system
,
table
),
list
,
bGet
);
}
default
List
<
BaseData
>
select
(
String
datasource
,
String
tabl
e
,
BaseData
et
){
default
List
<
BaseData
>
select
(
String
system
,
String
table
,
String
datasourc
e
,
BaseData
et
){
DSLink
link
=
getDSLink
(
datasource
);
return
select
(
link
,
getSchema
(
link
,
table
),
et
);
return
select
(
link
,
getSchema
(
link
,
system
,
table
),
et
);
}
default
Page
<
BaseData
>
select
(
String
datasource
,
String
tabl
e
,
BaseData
et
,
Pageable
pageable
){
default
Page
<
BaseData
>
select
(
String
system
,
String
table
,
String
datasourc
e
,
BaseData
et
,
Pageable
pageable
){
DSLink
link
=
getDSLink
(
datasource
);
return
select
(
link
,
getSchema
(
link
,
table
),
et
,
pageable
);
return
select
(
link
,
getSchema
(
link
,
system
,
table
),
et
,
pageable
);
}
default
List
<
BaseData
>
query
(
String
datasource
,
String
tabl
e
,
String
dataQuery
,
FilterData
context
){
default
List
<
BaseData
>
query
(
String
system
,
String
table
,
String
datasourc
e
,
String
dataQuery
,
FilterData
context
){
DSLink
link
=
getDSLink
(
datasource
);
return
query
(
link
,
getSchema
(
link
,
table
),
dataQuery
,
context
);
return
query
(
link
,
getSchema
(
link
,
system
,
table
),
dataQuery
,
context
);
}
default
Page
<
BaseData
>
query
(
String
datasource
,
String
tabl
e
,
String
dataQuery
,
FilterData
context
,
Pageable
pageable
){
default
Page
<
BaseData
>
query
(
String
system
,
String
table
,
String
datasourc
e
,
String
dataQuery
,
FilterData
context
,
Pageable
pageable
){
DSLink
link
=
getDSLink
(
datasource
);
return
query
(
link
,
getSchema
(
link
,
table
),
dataQuery
,
context
,
pageable
);
return
query
(
link
,
getSchema
(
link
,
system
,
table
),
dataQuery
,
context
,
pageable
);
}
default
List
<
BaseData
>
selectRaw
(
String
datasource
,
String
tabl
e
,
String
sql
,
FilterData
context
){
default
List
<
BaseData
>
selectRaw
(
String
system
,
String
table
,
String
datasourc
e
,
String
sql
,
FilterData
context
){
DSLink
link
=
getDSLink
(
datasource
);
return
selectRaw
(
link
,
getSchema
(
link
,
table
),
sql
,
context
);
return
selectRaw
(
link
,
getSchema
(
link
,
system
,
table
),
sql
,
context
);
}
default
boolean
execRaw
(
String
datasource
,
String
tabl
e
,
String
sql
,
BaseData
param
){
default
boolean
execRaw
(
String
system
,
String
table
,
String
datasourc
e
,
String
sql
,
BaseData
param
){
DSLink
link
=
getDSLink
(
datasource
);
return
execRaw
(
link
,
getSchema
(
link
,
table
),
sql
,
param
);
return
execRaw
(
link
,
getSchema
(
link
,
system
,
table
),
sql
,
param
);
}
default
List
<
BaseData
>
fetch
(
String
datasource
,
String
tabl
e
,
String
dataSet
,
FilterData
context
){
default
List
<
BaseData
>
fetch
(
String
system
,
String
table
,
String
datasourc
e
,
String
dataSet
,
FilterData
context
){
DSLink
link
=
getDSLink
(
datasource
);
return
fetch
(
link
,
getSchema
(
link
,
table
),
dataSet
,
context
);
return
fetch
(
link
,
getSchema
(
link
,
system
,
table
),
dataSet
,
context
);
}
default
Page
<
BaseData
>
fetch
(
String
datasource
,
String
tabl
e
,
String
dataSet
,
FilterData
context
,
Pageable
pageable
){
default
Page
<
BaseData
>
fetch
(
String
system
,
String
table
,
String
datasourc
e
,
String
dataSet
,
FilterData
context
,
Pageable
pageable
){
DSLink
link
=
getDSLink
(
datasource
);
return
fetch
(
link
,
getSchema
(
link
,
table
),
dataSet
,
context
,
pageable
);
return
fetch
(
link
,
getSchema
(
link
,
system
,
table
),
dataSet
,
context
,
pageable
);
}
DSLink
getDSLink
(
String
datasource
);
POSchema
getSchema
(
DSLink
link
,
String
table
);
POSchema
getSchema
(
DSLink
link
,
String
system
,
String
table
);
}
ibzdata-core/src/main/java/cn/ibizlab/core/data/service/ModelService.java
浏览文件 @
5ad47856
此差异已折叠。
点击以展开。
ibzdata-core/src/main/java/cn/ibizlab/core/data/service/impl/DbPersistentServiceImpl.java
浏览文件 @
5ad47856
...
...
@@ -344,7 +344,7 @@ public class DbPersistentServiceImpl implements IPersistentService {
}
@Override
public
POSchema
getSchema
(
DSLink
link
,
String
table
)
{
public
POSchema
getSchema
(
DSLink
link
,
String
system
,
String
table
)
{
return
null
;
}
}
ibzdata-core/src/main/java/cn/ibizlab/core/data/service/impl/MongoPersistentServiceImpl.java
浏览文件 @
5ad47856
...
...
@@ -250,7 +250,7 @@ public class MongoPersistentServiceImpl implements IPersistentService {
}
@Override
public
POSchema
getSchema
(
DSLink
link
,
String
table
)
{
public
POSchema
getSchema
(
DSLink
link
,
String
system
,
String
table
)
{
return
null
;
}
}
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录