Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzlite
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzlite
提交
6372da78
提交
6372da78
编写于
9月 17, 2020
作者:
zhouweidong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
实体、属性、关系注册
上级
1518c818
变更
3
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
29 行增加
和
86 行删除
+29
-86
DstSystemExService.java
...n/ibizlab/core/extensions/service/DstSystemExService.java
+13
-4
MetaEntity.java
...src/main/java/cn/ibizlab/core/lite/domain/MetaEntity.java
+5
-6
SysModel.java
...java/cn/ibizlab/core/lite/extensions/domain/SysModel.java
+11
-76
未找到文件。
ibzlite-core/src/main/java/cn/ibizlab/core/extensions/service/DstSystemExService.java
浏览文件 @
6372da78
...
...
@@ -14,6 +14,7 @@ import lombok.extern.slf4j.Slf4j;
import
cn.ibizlab.core.lite.domain.DstSystem
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.context.annotation.Primary
;
...
...
@@ -41,6 +42,10 @@ public class DstSystemExService extends DstSystemServiceImpl {
@Lazy
IMetaRelationshipService
relationService
;
@Autowired
@Lazy
DstSystemExService
proxyService
;
@Override
protected
Class
currentModelClass
()
{
return
com
.
baomidou
.
mybatisplus
.
core
.
toolkit
.
ReflectionKit
.
getSuperClassGenericType
(
this
.
getClass
().
getSuperclass
(),
1
);
...
...
@@ -52,8 +57,7 @@ public class DstSystemExService extends DstSystemServiceImpl {
if
(!
super
.
create
(
et
))
return
false
;
et
.
setSysstructure
(
structure
);
syncSysModel
(
et
);
proxyService
.
syncSysModel
(
et
);
return
true
;
}
...
...
@@ -65,7 +69,7 @@ public class DstSystemExService extends DstSystemServiceImpl {
return
false
;
if
(
ignoreSyncSysModel
==
null
||
ignoreSyncSysModel
.
equals
(
false
)){
et
.
setSysstructure
(
structure
);
syncSysModel
(
et
);
proxyService
.
syncSysModel
(
et
);
}
return
true
;
}
...
...
@@ -77,6 +81,7 @@ public class DstSystemExService extends DstSystemServiceImpl {
*/
@Override
@Transactional
@Async
(
"asyncExecutor"
)
public
DstSystem
syncSysModel
(
DstSystem
system
)
{
if
(
StringUtils
.
isEmpty
(
system
.
getPssystemid
())||
system
.
getSysstructure
()==
null
)
return
system
;
...
...
@@ -84,9 +89,13 @@ public class DstSystemExService extends DstSystemServiceImpl {
if
(
ignoreSyncSysModel
!=
null
&&
ignoreSyncSysModel
.
equals
(
true
))
return
system
;
long
start
=
System
.
currentTimeMillis
();
log
.
info
(
"开始同步[{}]系统模型"
,
system
.
getPssystemid
());
syncDE
(
system
);
syncDEField
(
system
);
syncDERelation
(
system
);
long
end
=
System
.
currentTimeMillis
();
log
.
info
(
"完成[{}]系统同步模型任务,总耗时[{}]秒"
,
system
.
getPssystemid
(),(
end
-
start
)/
1000
);
return
super
.
syncSysModel
(
system
);
}
...
...
@@ -145,7 +154,7 @@ public class DstSystemExService extends DstSystemServiceImpl {
for
(
JSONObject
relation:
oldRelation
){
delRelation
.
put
(
relation
.
getString
(
"RELATIONID"
),
1
);
}
Set
<
MetaRelationship
>
list
=
system
.
getSysstructure
().
getRelation
();
Collection
<
MetaRelationship
>
list
=
system
.
getSysstructure
().
getRelation
();
list
.
forEach
(
relation
->
{
delRelation
.
remove
(
relation
.
getId
());
});
...
...
ibzlite-core/src/main/java/cn/ibizlab/core/lite/domain/MetaEntity.java
浏览文件 @
6372da78
...
...
@@ -134,24 +134,23 @@ public class MetaEntity extends EntityMP implements Serializable {
/**
* 属性
*/
@JsonIgnore
@JSONField
(
serialize
=
false
)
// @JsonIgnore
@TableField
(
exist
=
false
)
private
List
<
cn
.
ibizlab
.
core
.
lite
.
domain
.
MetaField
>
fields
;
/**
* 实体关系
*/
@JsonIgnore
@JSONField
(
serialize
=
false
)
//
@JsonIgnore
//
@JSONField(serialize = false)
@TableField
(
exist
=
false
)
private
List
<
cn
.
ibizlab
.
core
.
lite
.
domain
.
MetaRelationship
>
parentEntitys
;
/**
* 实体关系
*/
@JsonIgnore
@JSONField
(
serialize
=
false
)
//
@JsonIgnore
//
@JSONField(serialize = false)
@TableField
(
exist
=
false
)
private
List
<
cn
.
ibizlab
.
core
.
lite
.
domain
.
MetaRelationship
>
subEntitys
;
...
...
ibzlite-core/src/main/java/cn/ibizlab/core/lite/extensions/domain/SysModel.java
浏览文件 @
6372da78
...
...
@@ -7,9 +7,9 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import
lombok.Data
;
import
org.springframework.util.DigestUtils
;
import
org.springframework.util.ObjectUtils
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.
Set
;
import
org.springframework.util.StringUtils
;
import
java.util.
*
;
@Data
public
class
SysModel
{
...
...
@@ -54,8 +54,8 @@ public class SysModel {
* 获取实体关系
* @return
*/
public
Set
<
MetaRelationship
>
getRelation
(){
Set
<
MetaRelationship
>
relations
=
new
HashSet
<>();
public
Collection
<
MetaRelationship
>
getRelation
(){
Map
<
String
,
MetaRelationship
>
relations
=
new
HashMap
<>();
this
.
entities
.
forEach
(
entityNode
->{
List
<
MetaRelationship
>
parentRelation
=
entityNode
.
getParentEntitys
();
List
<
MetaRelationship
>
subRelation
=
entityNode
.
getSubEntitys
();
...
...
@@ -66,82 +66,17 @@ public class SysModel {
addToRelations
(
relations
,
subRelation
);
}
});
return
relations
;
return
relations
.
values
()
;
}
private
void
addToRelations
(
Set
<
MetaRelationship
>
relations
,
List
<
MetaRelationship
>
entityRelations
){
private
void
addToRelations
(
Map
<
String
,
MetaRelationship
>
relations
,
List
<
MetaRelationship
>
entityRelations
){
entityRelations
.
forEach
(
entityRelation
->{
entityRelation
.
setEntityId
(
DigestUtils
.
md5DigestAsHex
(
String
.
format
(
"%s||%s"
,
systemid
,
entityRelation
.
getEntityName
()).
getBytes
()));
entityRelation
.
setRefEntityId
(
DigestUtils
.
md5DigestAsHex
(
String
.
format
(
"%s||%s"
,
systemid
,
entityRelation
.
getRefEntityName
()).
getBytes
()));
String
relationId
=
entityRelation
.
getId
();
if
(
!
StringUtils
.
isEmpty
(
relationId
)
&&
!
relations
.
containsKey
(
relationId
)){
relations
.
put
(
relationId
,
entityRelation
);
}
});
relations
.
addAll
(
entityRelations
);
}
// private List<EntityModel> entities;
//
// /**
// * 获取实体
// * @return
// */
// public Set<MetaEntity> getEntity(){
// Set<MetaEntity> entities=new HashSet<>();
// this.entities.forEach(entity->{
// MetaEntity metaEntity=new MetaEntity();
// metaEntity.setEntityName(entity.getEntityName());
// metaEntity.setCodeName(entity.getCodeName());
// metaEntity.setLogicName(entity.getLogicName());
// metaEntity.setSystemId(entity.getSystemId());
// metaEntity.setSystemName(entity.getSystemId());
// metaEntity.setTableName(entity.getTableName());
// entities.add(metaEntity);
// }
// );
// return entities;
// }
//
// /**
// * 获取实体属性
// * @return
// */
// public Set<MetaField> getField(){
// Set<MetaField> fields=new HashSet<>();
// this.entities.forEach(entity->{
// entity.getFields().forEach(fieldModel->{
// MetaField metaField=new MetaField();
// metaField.setCodeName(fieldModel.getCodeName());
// metaField.setFieldName(fieldModel.getColumnName());
// metaField.setFieldLogicName(fieldModel.getComment());
// metaField.setFieldShowName(fieldModel.getShowName());
// metaField.setEntityId(DigestUtils.md5DigestAsHex(String.format("%s||%s" ,systemid,entity.getEntityName()).getBytes()));
// fields.add(metaField);
// }
// );
// }
// );
// return fields;
// }
//
// /**
// * 获取实体关系
// * @return
// */
// public Set<MetaRelationship> getRelation(){
// Set<MetaRelationship> relations=new HashSet<>();
// this.entities.forEach(entity->{
// entity.getNesteds().forEach(relation->{
// MetaRelationship metaRelationship=new MetaRelationship();
//// metaRelationship.setName();
// metaRelationship.setCodeName(relation.getCodeName());
// metaRelationship.setEntityId(DigestUtils.md5DigestAsHex(String.format("%s||%s" ,systemid,relation.getEntityName()).getBytes()));
// metaRelationship.setEntityName(relation.getEntityName());
//// metaRelationship.setRefEntityName();
// metaRelationship.setRefEntityId(DigestUtils.md5DigestAsHex(String.format("%s||%s" ,systemid,relation.getEntityName()).getBytes()));
// }
// );
// }
// );
// return relations;
// }
}
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录