Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzlite
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzlite
提交
6a5c48e6
提交
6a5c48e6
编写于
6月 07, 2021
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
提交
上级
83aaef7c
变更
8
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
219 行增加
和
9 行删除
+219
-9
DataObj.java
.../java/cn/ibizlab/core/lite/extensions/domain/DataObj.java
+12
-0
EntityModel.java
...a/cn/ibizlab/core/lite/extensions/domain/EntityModel.java
+1
-1
EntityObj.java
...ava/cn/ibizlab/core/lite/extensions/domain/EntityObj.java
+16
-0
FieldModel.java
...va/cn/ibizlab/core/lite/extensions/domain/FieldModel.java
+1
-1
MetaEntityModel.java
.../ibizlab/core/lite/extensions/domain/MetaEntityModel.java
+28
-0
ModelObj.java
...java/cn/ibizlab/core/lite/extensions/domain/ModelObj.java
+143
-4
LiteDataService.java
...ibizlab/core/lite/extensions/service/LiteDataService.java
+6
-0
LiteModelService.java
...bizlab/core/lite/extensions/service/LiteModelService.java
+12
-3
未找到文件。
ibzlite-core/src/main/java/cn/ibizlab/core/lite/extensions/domain/DataObj.java
浏览文件 @
6a5c48e6
...
@@ -3,6 +3,7 @@ package cn.ibizlab.core.lite.extensions.domain;
...
@@ -3,6 +3,7 @@ package cn.ibizlab.core.lite.extensions.domain;
import
cn.ibizlab.util.domain.DTOBase
;
import
cn.ibizlab.util.domain.DTOBase
;
import
cn.ibizlab.util.domain.EntityBase
;
import
cn.ibizlab.util.domain.EntityBase
;
import
cn.ibizlab.util.helper.DataObject
;
import
cn.ibizlab.util.helper.DataObject
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
...
@@ -61,6 +62,17 @@ public class DataObj<K,V> extends HashMap<K,V> {
...
@@ -61,6 +62,17 @@ public class DataObj<K,V> extends HashMap<K,V> {
return
DataObject
.
getJSONObjectValue
(
this
.
get
(
strParamName
),
jDefault
);
return
DataObject
.
getJSONObjectValue
(
this
.
get
(
strParamName
),
jDefault
);
}
}
public
<
T
>
List
<
T
>
getListValue
(
String
strParamName
,
Class
<
T
>
clazz
)
{
List
<
T
>
list
=
new
ArrayList
<>();
Object
val
=
this
.
get
(
strParamName
);
if
(
val
!=
null
&&
val
instanceof
List
)
{
list
=
JSONArray
.
parseArray
(
JSON
.
toJSONString
(
val
),
clazz
);
}
return
list
;
}
public
List
<
String
>
getListValue
(
String
strParamName
)
{
public
List
<
String
>
getListValue
(
String
strParamName
)
{
return
DataObject
.
getListValue
(
strParamName
);
return
DataObject
.
getListValue
(
strParamName
);
}
}
...
...
ibzlite-core/src/main/java/cn/ibizlab/core/lite/extensions/domain/EntityModel.java
浏览文件 @
6a5c48e6
...
@@ -58,7 +58,7 @@ public class EntityModel {
...
@@ -58,7 +58,7 @@ public class EntityModel {
return
getEntity
().
getSystemId
();
return
getEntity
().
getSystemId
();
}
}
private
MetaEntity
entity
;
private
MetaEntity
Model
entity
;
private
List
<
MetaDataSet
>
dataSets
;
private
List
<
MetaDataSet
>
dataSets
;
...
...
ibzlite-core/src/main/java/cn/ibizlab/core/lite/extensions/domain/EntityObj.java
浏览文件 @
6a5c48e6
...
@@ -179,8 +179,24 @@ public class EntityObj extends DataObj<String,Object> {
...
@@ -179,8 +179,24 @@ public class EntityObj extends DataObj<String,Object> {
}
}
}
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
boolean
isEmpty
()
{
int
cnt
=
0
;
for
(
String
key:
keySet
())
{
if
(!
key
.
startsWith
(
"_"
))
cnt
++;
}
return
cnt
==
0
;
}
public
boolean
isDelete
()
public
boolean
isDelete
()
{
{
if
(
this
.
getEntityModel
()==
null
)
return
false
;
if
(!
this
.
getEntityModel
().
isLogicValid
())
if
(!
this
.
getEntityModel
().
isLogicValid
())
return
false
;
return
false
;
if
(
this
.
getEntityModel
().
getLogicValidField
()==
null
)
if
(
this
.
getEntityModel
().
getLogicValidField
()==
null
)
...
...
ibzlite-core/src/main/java/cn/ibizlab/core/lite/extensions/domain/FieldModel.java
浏览文件 @
6a5c48e6
...
@@ -25,7 +25,7 @@ public class FieldModel {
...
@@ -25,7 +25,7 @@ public class FieldModel {
private
String
comment
;
private
String
comment
;
private
MetaField
field
;
private
MetaField
Model
field
;
private
RelationshipModel
reference
;
private
RelationshipModel
reference
;
...
...
ibzlite-core/src/main/java/cn/ibizlab/core/lite/extensions/domain/MetaEntityModel.java
浏览文件 @
6a5c48e6
package
cn
.
ibizlab
.
core
.
lite
.
extensions
.
domain
;
package
cn
.
ibizlab
.
core
.
lite
.
extensions
.
domain
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.Setter
;
import
java.sql.Timestamp
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -85,6 +87,32 @@ public class MetaEntityModel{
...
@@ -85,6 +87,32 @@ public class MetaEntityModel{
@JSONField
(
name
=
"module_name"
)
@JSONField
(
name
=
"module_name"
)
@JsonProperty
(
"module_name"
)
@JsonProperty
(
"module_name"
)
private
String
moduleName
;
private
String
moduleName
;
/**
* 扩展参数
*/
@JSONField
(
name
=
"ext_params"
)
@JsonProperty
(
"ext_params"
)
private
String
extParams
;
/**
* 排序
*/
@JSONField
(
name
=
"show_order"
)
@JsonProperty
(
"show_order"
)
private
Integer
showOrder
;
/**
* 创建时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
locale
=
"zh"
,
timezone
=
"GMT+8"
)
@JSONField
(
name
=
"createdate"
,
format
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonProperty
(
"createdate"
)
private
Timestamp
createdate
;
/**
* 最后修改时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
locale
=
"zh"
,
timezone
=
"GMT+8"
)
@JSONField
(
name
=
"updatedate"
,
format
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonProperty
(
"updatedate"
)
private
Timestamp
updatedate
;
/**
/**
* 数据集
* 数据集
...
...
ibzlite-core/src/main/java/cn/ibizlab/core/lite/extensions/domain/ModelObj.java
浏览文件 @
6a5c48e6
...
@@ -4,6 +4,7 @@ import cn.ibizlab.core.lite.extensions.model.DataModel;
...
@@ -4,6 +4,7 @@ import cn.ibizlab.core.lite.extensions.model.DataModel;
import
cn.ibizlab.core.lite.extensions.model.Property
;
import
cn.ibizlab.core.lite.extensions.model.Property
;
import
cn.ibizlab.util.helper.DataObject
;
import
cn.ibizlab.util.helper.DataObject
;
import
cn.ibizlab.util.helper.RuleUtils
;
import
cn.ibizlab.util.helper.RuleUtils
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
...
@@ -11,13 +12,97 @@ import org.springframework.util.StringUtils;
...
@@ -11,13 +12,97 @@ import org.springframework.util.StringUtils;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
import
java.math.BigInteger
;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.Calendar
;
import
java.util.HashMap
;
import
java.util.List
;
public
class
ModelObj
extends
DataObj
<
String
,
Object
>
{
public
class
ModelObj
extends
DataObj
<
String
,
Object
>
{
public
ModelObj
(
ModelObj
modelObj
)
{
if
(
modelObj
.
dataModel
!=
null
)
this
.
setDataModel
(
modelObj
.
dataModel
);
if
(
this
.
getDataModel
()!=
null
)
{
this
.
getDataModel
().
getObjectProperties
().
forEach
(
property
->
{
Object
obj
=
modelObj
.
get
(
property
.
getPropertyName
());
if
(
obj
!=
null
&&
obj
instanceof
EntityObj
)
{
this
.
setEntity
(
property
.
getPropertyName
(),((
EntityObj
)
obj
).
copy
());
}
});
this
.
getDataModel
().
getNestedDataModels
().
forEach
(
dm
->
{
Object
list
=
modelObj
.
get
(
dm
.
getDataModelName
());
if
(
list
!=
null
&&
list
instanceof
NestedArray
)
{
NestedArray
nestedArray
=(
NestedArray
)
list
;
nestedArray
.
forEach
(
sub
->{
sub
.
copy
().
setParent
(
this
);
});
}
});
}
if
(!
StringUtils
.
isEmpty
(
modelObj
.
getRowKey
()))
this
.
setRowKey
(
modelObj
.
getRowKey
());
}
public
ModelObj
()
{
}
public
ModelObj
build
(
DataModel
dataModel
)
{
this
.
setDataModel
(
dataModel
);
if
(
this
.
getDataModel
()!=
null
)
{
this
.
getDataModel
().
getObjectProperties
().
forEach
(
property
->
{
Object
obj
=
this
.
get
(
property
.
getPropertyName
());
if
(
obj
!=
null
&&
obj
instanceof
EntityObj
)
{
}
else
if
(
obj
!=
null
&&
obj
instanceof
Map
)
{
this
.
setEntity
(
property
.
getPropertyName
(),
JSON
.
parseObject
(
JSON
.
toJSONString
(
obj
),
EntityObj
.
class
));
}
});
this
.
getDataModel
().
getNestedDataModels
().
forEach
(
dm
->
{
Object
list
=
this
.
get
(
dm
.
getDataModelName
());
if
(
list
!=
null
&&
list
instanceof
NestedArray
)
{
}
else
if
(
list
!=
null
&&
list
instanceof
List
)
{
NestedArray
nestedArray
=
new
NestedArray
().
setParent
(
this
);
this
.
set
(
dm
.
getDataModelName
(),
nestedArray
);
((
List
)
list
).
forEach
(
sub
->{
if
(
sub
instanceof
ModelObj
)
{
nestedArray
.
add
((
ModelObj
)
sub
);
}
else
if
(
sub
instanceof
Map
)
{
ModelObj
subObj
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
sub
),
ModelObj
.
class
);
subObj
.
build
(
dm
).
setParent
(
this
);
}
});
}
});
}
return
this
;
}
@JsonIgnore
@JsonIgnore
@JSONField
(
serialize
=
false
)
@JSONField
(
serialize
=
false
)
...
@@ -155,6 +240,40 @@ public class ModelObj extends DataObj<String,Object> {
...
@@ -155,6 +240,40 @@ public class ModelObj extends DataObj<String,Object> {
return
this
;
return
this
;
}
}
public
ModelObj
setEntityValue
(
String
name
,
Object
value
)
{
if
(
name
.
indexOf
(
"."
)>
0
)
{
String
[]
epair
=
name
.
split
(
"[.]"
);
if
(
epair
.
length
>=
2
)
{
String
propertyName
=
epair
[
0
];
String
columnName
=
epair
[
1
];
return
this
.
setEntityValue
(
propertyName
,
columnName
,
value
);
}
}
return
this
;
}
public
ModelObj
setEntityValue
(
String
propertyName
,
String
columnName
,
Object
value
)
{
EntityObj
entityObj
=
null
;
Object
obj
=
this
.
get
(
propertyName
);
if
(
obj
!=
null
&&
obj
instanceof
EntityObj
)
entityObj
=
(
EntityObj
)
obj
;
else
{
Property
property
=
this
.
getDataModel
().
getObjectProperty
(
propertyName
);
if
(
property
!=
null
)
{
entityObj
=
new
EntityObj
().
setProperty
(
property
).
setRowKey
(
this
.
getRowKey
());
this
.
setEntity
(
property
.
getPropertyName
(),
entityObj
);
}
else
return
this
;
}
entityObj
.
put
(
columnName
,
value
);
return
this
;
}
public
ModelObj
setFactEntity
(
EntityObj
entityObj
)
public
ModelObj
setFactEntity
(
EntityObj
entityObj
)
{
{
this
.
setEntity
(
this
.
getDataModel
().
getFactPorperty
().
getPropertyName
(),
entityObj
);
this
.
setEntity
(
this
.
getDataModel
().
getFactPorperty
().
getPropertyName
(),
entityObj
);
...
@@ -474,6 +593,26 @@ public class ModelObj extends DataObj<String,Object> {
...
@@ -474,6 +593,26 @@ public class ModelObj extends DataObj<String,Object> {
return
null
;
return
null
;
}
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
boolean
isEmpty
()
{
int
cnt
=
0
;
for
(
String
key:
keySet
())
{
if
(
key
.
startsWith
(
"_"
))
continue
;
Object
obj
=
this
.
get
(
key
);
if
(
obj
!=
null
&&
obj
instanceof
EntityObj
&&((
EntityObj
)
obj
).
isEmpty
())
continue
;
cnt
++;
}
if
(
this
.
get
(
"_IGNO"
)!=
null
)
return
true
;
return
cnt
==
0
;
}
@JsonIgnore
@JsonIgnore
@JSONField
(
serialize
=
false
)
@JSONField
(
serialize
=
false
)
public
Boolean
isDelete
()
public
Boolean
isDelete
()
...
...
ibzlite-core/src/main/java/cn/ibizlab/core/lite/extensions/service/LiteDataService.java
浏览文件 @
6a5c48e6
...
@@ -56,6 +56,12 @@ public class LiteDataService {
...
@@ -56,6 +56,12 @@ public class LiteDataService {
return
dbEntityService
;
return
dbEntityService
;
}
}
public
boolean
saveBatch
(
EntityModel
entityModel
,
String
dsName
,
List
<
EntityObj
>
list
)
{
splitList
(
list
,
500
).
forEach
(
objs
->{
getEntityService
(
StringUtils
.
isEmpty
(
dsName
)?
entityModel
.
getDsName
():
dsName
).
saveBatch
(
dsName
,
entityModel
,
objs
);
});
return
true
;
}
public
boolean
saveBatch
(
String
systemId
,
String
entityName
,
String
dsName
,
List
<
EntityObj
>
list
)
{
public
boolean
saveBatch
(
String
systemId
,
String
entityName
,
String
dsName
,
List
<
EntityObj
>
list
)
{
EntityModel
entityModel
=
liteModelService
.
getEntityModel
(
systemId
,
entityName
);
EntityModel
entityModel
=
liteModelService
.
getEntityModel
(
systemId
,
entityName
);
...
...
ibzlite-core/src/main/java/cn/ibizlab/core/lite/extensions/service/LiteModelService.java
浏览文件 @
6a5c48e6
...
@@ -7,6 +7,8 @@ import cn.ibizlab.core.lite.domain.MetaModel;
...
@@ -7,6 +7,8 @@ import cn.ibizlab.core.lite.domain.MetaModel;
import
cn.ibizlab.core.lite.extensions.domain.EntityModel
;
import
cn.ibizlab.core.lite.extensions.domain.EntityModel
;
import
cn.ibizlab.core.lite.extensions.domain.FieldModel
;
import
cn.ibizlab.core.lite.extensions.domain.FieldModel
;
import
cn.ibizlab.core.lite.extensions.domain.RelationshipModel
;
import
cn.ibizlab.core.lite.extensions.domain.RelationshipModel
;
import
cn.ibizlab.core.lite.extensions.mapping.MetaEntityMapping
;
import
cn.ibizlab.core.lite.extensions.mapping.MetaFieldMapping
;
import
cn.ibizlab.core.lite.extensions.model.DataModel
;
import
cn.ibizlab.core.lite.extensions.model.DataModel
;
import
cn.ibizlab.core.lite.extensions.model.Property
;
import
cn.ibizlab.core.lite.extensions.model.Property
;
import
cn.ibizlab.core.lite.extensions.model.PropertyMapping
;
import
cn.ibizlab.core.lite.extensions.model.PropertyMapping
;
...
@@ -48,6 +50,13 @@ public class LiteModelService {
...
@@ -48,6 +50,13 @@ public class LiteModelService {
public
void
init
(){
public
void
init
(){
LiteStorage
.
setLiteModelService
(
this
);
LiteStorage
.
setLiteModelService
(
this
);
}
}
@Autowired
@Lazy
MetaEntityMapping
entityMapping
;
@Autowired
@Lazy
MetaFieldMapping
fieldMapping
;
@Autowired
@Autowired
@Lazy
@Lazy
...
@@ -79,7 +88,7 @@ public class LiteModelService {
...
@@ -79,7 +88,7 @@ public class LiteModelService {
List
<
EntityModel
>
list
=
new
ArrayList
<>();
List
<
EntityModel
>
list
=
new
ArrayList
<>();
metaEntityService
.
list
(
Wrappers
.<
MetaEntity
>
lambdaQuery
().
eq
(
MetaEntity:
:
getSystemId
,
systemId
).
orderByAsc
(
MetaEntity:
:
getEntityName
)).
forEach
(
entity
->
{
metaEntityService
.
list
(
Wrappers
.<
MetaEntity
>
lambdaQuery
().
eq
(
MetaEntity:
:
getSystemId
,
systemId
).
orderByAsc
(
MetaEntity:
:
getEntityName
)).
forEach
(
entity
->
{
EntityModel
entityModel
=
new
EntityModel
();
EntityModel
entityModel
=
new
EntityModel
();
entityModel
.
setEntity
(
entity
);
entityModel
.
setEntity
(
entity
Mapping
.
toDto
(
entity
)
);
list
.
add
(
entityModel
);
list
.
add
(
entityModel
);
});
});
return
list
;
return
list
;
...
@@ -96,7 +105,7 @@ public class LiteModelService {
...
@@ -96,7 +105,7 @@ public class LiteModelService {
MetaEntity
entity
=
LiteStorage
.
getMetaEntity
(
String
.
format
(
"%1$s.%2$s"
,
systemId
,
name
));
MetaEntity
entity
=
LiteStorage
.
getMetaEntity
(
String
.
format
(
"%1$s.%2$s"
,
systemId
,
name
));
EntityModel
entityModel
=
new
EntityModel
();
EntityModel
entityModel
=
new
EntityModel
();
entityModel
.
setEntity
(
entity
);
entityModel
.
setEntity
(
entity
Mapping
.
toDto
(
entity
)
);
Map
<
String
,
RelationshipModel
>
parentSet
=
new
LinkedHashMap
();
Map
<
String
,
RelationshipModel
>
parentSet
=
new
LinkedHashMap
();
List
<
RelationshipModel
>
references
=
new
ArrayList
<>();
List
<
RelationshipModel
>
references
=
new
ArrayList
<>();
...
@@ -151,7 +160,7 @@ public class LiteModelService {
...
@@ -151,7 +160,7 @@ public class LiteModelService {
metaFieldService
.
searchDefault
(
searchContext
).
getContent
().
forEach
(
item
->
metaFieldService
.
searchDefault
(
searchContext
).
getContent
().
forEach
(
item
->
{
{
FieldModel
model
=
new
FieldModel
();
FieldModel
model
=
new
FieldModel
();
model
.
setField
(
item
);
model
.
setField
(
fieldMapping
.
toDto
(
item
)
);
model
.
setCodeName
(
item
.
getCodeName
());
model
.
setCodeName
(
item
.
getCodeName
());
model
.
setColumnName
(
item
.
getFieldName
());
model
.
setColumnName
(
item
.
getFieldName
());
model
.
setComment
(
item
.
getFieldLogicName
());
model
.
setComment
(
item
.
getFieldLogicName
());
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录