Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzlite
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzlite
提交
da055f93
提交
da055f93
编写于
11月 22, 2020
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
model
上级
b8d21011
变更
2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
104 行增加
和
33 行删除
+104
-33
ModelObj.java
...java/cn/ibizlab/core/lite/extensions/domain/ModelObj.java
+94
-30
DbEntityService.java
...ibizlab/core/lite/extensions/service/DbEntityService.java
+10
-3
未找到文件。
ibzlite-core/src/main/java/cn/ibizlab/core/lite/extensions/domain/ModelObj.java
浏览文件 @
da055f93
package
cn
.
ibizlab
.
core
.
lite
.
extensions
.
domain
;
package
cn
.
ibizlab
.
core
.
lite
.
extensions
.
domain
;
import
cn.ibizlab.core.lite.extensions.model.DataModel
;
import
cn.ibizlab.core.lite.extensions.model.DataModel
;
import
cn.ibizlab.core.lite.extensions.model.LayerMapping
;
import
cn.ibizlab.core.lite.extensions.model.Property
;
import
cn.ibizlab.core.lite.extensions.model.Property
;
import
cn.ibizlab.core.lite.extensions.util.LiteStorage
;
import
cn.ibizlab.core.lite.extensions.util.LiteStorage
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.alibaba.fastjson.annotation.JSONField
;
...
@@ -9,6 +9,8 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
...
@@ -9,6 +9,8 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
public
class
ModelObj
extends
DataObj
<
String
,
Object
>
{
public
class
ModelObj
extends
DataObj
<
String
,
Object
>
{
...
@@ -49,6 +51,11 @@ public class ModelObj extends DataObj<String,Object> {
...
@@ -49,6 +51,11 @@ public class ModelObj extends DataObj<String,Object> {
}
}
public
EntityObj
getEntity
(
String
name
)
public
EntityObj
getEntity
(
String
name
)
{
return
getEntity
(
name
,
true
);
}
public
EntityObj
getEntity
(
String
name
,
boolean
recursion
)
{
{
Object
obj
=
this
.
get
(
name
);
Object
obj
=
this
.
get
(
name
);
if
(
obj
!=
null
&&
obj
instanceof
EntityObj
)
if
(
obj
!=
null
&&
obj
instanceof
EntityObj
)
...
@@ -58,19 +65,47 @@ public class ModelObj extends DataObj<String,Object> {
...
@@ -58,19 +65,47 @@ public class ModelObj extends DataObj<String,Object> {
if
(
property
!=
null
)
{
if
(
property
!=
null
)
{
return
new
EntityObj
().
setDataModel
(
this
.
getDataModel
()).
setProperty
(
property
).
setRowKey
(
this
.
getRowKey
());
return
new
EntityObj
().
setDataModel
(
this
.
getDataModel
()).
setProperty
(
property
).
setRowKey
(
this
.
getRowKey
());
}
}
property
=
this
.
getDataModel
().
findObjectProperty
(
name
,
"UP"
);
if
(
property
!=
null
){
int
layerDiff
=
this
.
getDataModel
().
getLayerNo
()-
property
.
getLayerNo
();
ModelObj
parentObj
=
this
;
for
(
int
i
=
0
;
i
<
layerDiff
;
i
++)
parentObj
=
parentObj
.
getParent
();
return
parentObj
.
getEntity
(
name
);
}
if
(
recursion
)
{
property
=
this
.
getDataModel
().
findObjectProperty
(
name
,
"UP"
);
if
(
property
!=
null
){
int
layerDiff
=
this
.
getDataModel
().
getLayerNo
()-
property
.
getLayerNo
();
ModelObj
parentObj
=
this
;
for
(
int
i
=
0
;
i
<
layerDiff
;
i
++)
parentObj
=
parentObj
.
getParent
();
return
parentObj
.
getEntity
(
name
,
false
);
}
}
return
new
EntityObj
().
setDataModel
(
this
.
getDataModel
()).
setDstSystemId
(
this
.
getDataModel
().
getFactPorperty
().
getSystem
()).
setMetaEntityName
(
name
).
setRowKey
(
this
.
getRowKey
());
return
new
EntityObj
().
setDataModel
(
this
.
getDataModel
()).
setDstSystemId
(
this
.
getDataModel
().
getFactPorperty
().
getSystem
()).
setMetaEntityName
(
name
).
setRowKey
(
this
.
getRowKey
());
}
}
public
ModelObj
setEntity
(
String
name
,
EntityObj
entityObj
)
{
this
.
set
(
name
,
entityObj
);
return
this
;
}
public
ModelObj
setFactEntity
(
EntityObj
entityObj
)
{
this
.
set
(
this
.
getDataModel
().
getFactPorperty
().
getPropertyName
(),
entityObj
);
return
this
;
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
EntityObj
getFactEntity
()
{
return
this
.
getEntity
(
this
.
getDataModel
().
getFactPorperty
().
getPropertyName
(),
false
);
}
public
NestedArray
getNested
(
String
name
)
public
NestedArray
getNested
(
String
name
)
{
return
getNested
(
name
,
true
);
}
public
NestedArray
getNested
(
String
name
,
boolean
recursion
)
{
{
Object
list
=
this
.
get
(
name
);
Object
list
=
this
.
get
(
name
);
if
(
list
!=
null
&&
list
instanceof
NestedArray
)
if
(
list
!=
null
&&
list
instanceof
NestedArray
)
...
@@ -80,34 +115,36 @@ public class ModelObj extends DataObj<String,Object> {
...
@@ -80,34 +115,36 @@ public class ModelObj extends DataObj<String,Object> {
if
(
model
!=
null
)
if
(
model
!=
null
)
return
new
NestedArray
().
setDataModel
(
this
.
getDataModel
()).
setParent
(
this
);
return
new
NestedArray
().
setDataModel
(
this
.
getDataModel
()).
setParent
(
this
);
model
=
this
.
getDataModel
().
findDataModel
(
name
,
"DOWN"
);
if
(
recursion
)
if
(
model
!=
null
)
{
{
List
<
String
>
steps
=
new
ArrayList
<>();
model
=
this
.
getDataModel
().
findDataModel
(
name
,
"DOWN"
);
DataModel
tmpModel
=
model
;
if
(
model
!=
null
)
while
(
tmpModel
.
getParentDataModel
()!=
null
&&!
tmpModel
.
getParentDataModel
().
getDataModelName
().
equalsIgnoreCase
(
this
.
getDataModel
().
getDataModelName
()))
{
{
tmpModel
=
model
.
getParentDataModel
();
List
<
String
>
steps
=
new
ArrayList
<>();
steps
.
add
(
0
,
tmpModel
.
getDataModelName
());
DataModel
tmpModel
=
model
;
}
while
(
tmpModel
.
getParentDataModel
()!=
null
&&!
tmpModel
.
getParentDataModel
().
getDataModelName
().
equalsIgnoreCase
(
this
.
getDataModel
().
getDataModelName
()))
{
if
(
steps
.
size
()>
1
)
tmpModel
=
model
.
getParentDataModel
();
{
steps
.
add
(
0
,
tmpModel
.
getDataModelName
());
NestedArray
subarry
=
this
.
getNested
(
steps
.
get
(
0
));
}
if
(
subarry
.
size
()>
0
)
if
(
steps
.
size
()>
1
)
{
{
for
(
int
i
=
1
;
i
<
steps
.
size
();
i
++)
NestedArray
subarry
=
this
.
getNested
(
steps
.
get
(
0
),
false
);
if
(
subarry
.
size
()>
0
)
{
{
subarry
=
subarry
.
getSubNested
(
steps
.
get
(
i
));
for
(
int
i
=
1
;
i
<
steps
.
size
();
i
++)
if
(
subarry
.
size
()==
0
)
{
return
new
NestedArray
().
setDataModel
(
this
.
getDataModel
()).
setParent
(
this
);
subarry
=
subarry
.
getSubNested
(
steps
.
get
(
i
));
if
(
subarry
.
size
()==
0
)
return
new
NestedArray
().
setDataModel
(
this
.
getDataModel
()).
setParent
(
this
);
}
return
subarry
;
}
}
return
subarry
;
}
}
}
}
}
}
return
new
NestedArray
().
setDataModel
(
this
.
getDataModel
()).
setParent
(
this
);
return
new
NestedArray
().
setDataModel
(
this
.
getDataModel
()).
setParent
(
this
);
}
}
...
@@ -130,5 +167,32 @@ public class ModelObj extends DataObj<String,Object> {
...
@@ -130,5 +167,32 @@ public class ModelObj extends DataObj<String,Object> {
return
super
.
get
(
key
);
return
super
.
get
(
key
);
}
}
public
ModelObj
findParent
(
Collection
<
ModelObj
>
uplayerObjs
)
{
if
(
uplayerObjs
.
size
()==
1
)
{
ModelObj
parent
=
uplayerObjs
.
iterator
().
next
();
this
.
setParent
(
parent
);
parent
.
getNested
(
this
.
getDataModel
().
getDataModelName
(),
false
).
add
(
this
);
return
this
;
}
HashMap
<
String
,
ModelObj
>
tmps
=
new
HashMap
<
String
,
ModelObj
>();
uplayerObjs
.
forEach
(
obj
->
tmps
.
put
(
obj
.
getRowKey
(),
obj
));
this
.
getDataModel
().
getLayerMappings
().
forEach
(
layerMapping
->{
String
selfVal
=
this
.
getFactEntity
().
getStringValue
(
layerMapping
.
getSelfPropertyColumn
());
uplayerObjs
.
forEach
(
parent
->{
String
parentVal
=
parent
.
getFactEntity
().
getStringValue
(
layerMapping
.
getParentPropertyColumn
());
if
((
StringUtils
.
isEmpty
(
parentVal
))||(!
parentVal
.
equals
(
selfVal
)))
tmps
.
remove
(
parent
.
getRowKey
());
});
});
if
(
tmps
.
size
()==
1
)
{
ModelObj
parent
=
tmps
.
values
().
iterator
().
next
();
this
.
setParent
(
parent
);
parent
.
getNested
(
this
.
getDataModel
().
getDataModelName
(),
false
).
add
(
this
);
}
return
this
;
}
}
}
ibzlite-core/src/main/java/cn/ibizlab/core/lite/extensions/service/DbEntityService.java
浏览文件 @
da055f93
...
@@ -95,13 +95,20 @@ public class DbEntityService extends ServiceImpl<DbEntityMapper, EntityObj> impl
...
@@ -95,13 +95,20 @@ public class DbEntityService extends ServiceImpl<DbEntityMapper, EntityObj> impl
LinkedHashMap
<
String
,
ModelObj
>
rt
=
new
LinkedHashMap
<>();
LinkedHashMap
<
String
,
ModelObj
>
rt
=
new
LinkedHashMap
<>();
List
<
EntityObj
>
factEntityList
=
this
.
selectBase
(
entityModel
,
QueryFilter
.
createQuery
().
cust
(
dataModel
.
lookup
(
kEntityObjs
)));
List
<
EntityObj
>
factEntityList
=
this
.
selectBase
(
entityModel
,
QueryFilter
.
createQuery
().
cust
(
dataModel
.
lookup
(
kEntityObjs
)));
factEntityList
.
forEach
(
entityObj
->{
factEntityList
.
forEach
(
entityObj
->{
entityObj
.
setProperty
(
dataModel
.
getFactPorperty
()).
setDataModel
(
dataModel
);
String
rowKey
=
entityObj
.
getStringValue
(
entityModel
.
getKeyField
().
getColumnName
());
String
rowKey
=
entityObj
.
getStringValue
(
entityModel
.
getKeyField
().
getColumnName
());
ModelObj
modelObj
=
new
ModelObj
().
setDataModel
(
dataModel
).
setRowKey
(
rowKey
);
ModelObj
modelObj
=
new
ModelObj
().
setDataModel
(
dataModel
).
set
FactEntity
(
entityObj
).
set
RowKey
(
rowKey
);
modelObj
.
set
(
dataModel
.
getFactPorperty
().
getPropertyName
(),
entity
Obj
);
entityObj
.
setProperty
(
dataModel
.
getFactPorperty
()).
setDataModel
(
dataModel
).
setModelObj
(
model
Obj
);
rt
.
put
(
rowKey
,
modelObj
);
rt
.
put
(
rowKey
,
modelObj
);
});
});
for
(
DataModel
subModel:
dataModel
.
getNestedDataModels
())
{
List
<
ModelObj
>
subObjs
=
this
.
getModelObjs
(
subModel
,
factEntityList
);
subObjs
.
forEach
(
subObj
->{
subObj
.
findParent
(
rt
.
values
());
});
}
return
null
;
return
null
;
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录