Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzdata
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzdata
提交
e94fd7f2
提交
e94fd7f2
编写于
3年前
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
提交
上级
39476b17
master
无相关合并请求
变更
15
展开全部
显示空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
638 行增加
和
92 行删除
+638
-92
pom.xml
ibzdata-core/pom.xml
+1
-1
DstSystemModel.java
...c/main/java/cn/ibizlab/core/data/lite/DstSystemModel.java
+30
-0
DynamicModelService.java
...n/java/cn/ibizlab/core/data/lite/DynamicModelService.java
+265
-0
EntityModel.java
.../src/main/java/cn/ibizlab/core/data/lite/EntityModel.java
+25
-1
FieldModel.java
...e/src/main/java/cn/ibizlab/core/data/lite/FieldModel.java
+3
-1
LiteModelFallback.java
...ain/java/cn/ibizlab/core/data/lite/LiteModelFallback.java
+10
-0
LiteModelFeignClient.java
.../java/cn/ibizlab/core/data/lite/LiteModelFeignClient.java
+11
-0
LiteStorage.java
.../src/main/java/cn/ibizlab/core/data/lite/LiteStorage.java
+36
-84
MetaFieldModel.java
...c/main/java/cn/ibizlab/core/data/lite/MetaFieldModel.java
+2
-0
MetaLookupModel.java
.../main/java/cn/ibizlab/core/data/lite/MetaLookupModel.java
+60
-0
MetaRelationshipModel.java
...java/cn/ibizlab/core/data/lite/MetaRelationshipModel.java
+137
-0
RelationshipModel.java
...ain/java/cn/ibizlab/core/data/lite/RelationshipModel.java
+3
-1
TransUtils.java
.../src/main/java/cn/ibizlab/core/data/model/TransUtils.java
+53
-2
DOModelServiceImpl.java
...cn/ibizlab/core/data/service/impl/DOModelServiceImpl.java
+1
-1
DTOModelServiceImpl.java
...n/ibizlab/core/data/service/impl/DTOModelServiceImpl.java
+1
-1
未找到文件。
ibzdata-core/pom.xml
浏览文件 @
e94fd7f2
...
...
@@ -100,7 +100,7 @@
<dependency>
<groupId>
net.ibizsys.model
</groupId>
<artifactId>
ibizlab-model
</artifactId>
<version>
1.
1.60
</version>
<version>
1.
2.2
</version>
</dependency>
</dependencies>
...
...
This diff is collapsed.
Click to expand it.
ibzdata-core/src/main/java/cn/ibizlab/core/data/lite/DstSystemModel.java
0 → 100644
浏览文件 @
e94fd7f2
package
cn
.
ibizlab
.
core
.
data
.
lite
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
@Getter
@Setter
@NoArgsConstructor
@Accessors
(
chain
=
true
)
@JsonIgnoreProperties
(
value
=
"handler"
)
public
class
DstSystemModel
{
/**
* 系统标识
*/
@JSONField
(
name
=
"pssystemid"
)
@JsonProperty
(
"pssystemid"
)
private
String
pssystemid
;
/**
* 系统名称
*/
@JSONField
(
name
=
"pssystemname"
)
@JsonProperty
(
"pssystemname"
)
private
String
pssystemname
;
}
This diff is collapsed.
Click to expand it.
ibzdata-core/src/main/java/cn/ibizlab/core/data/lite/DynamicModelService.java
0 → 100644
浏览文件 @
e94fd7f2
此差异已折叠。
点击以展开。
ibzdata-core/src/main/java/cn/ibizlab/core/data/lite/EntityModel.java
浏览文件 @
e94fd7f2
...
...
@@ -62,8 +62,24 @@ public class EntityModel {
private
List
<
FieldModel
>
fields
;
public
EntityModel
addField
(
FieldModel
fieldModel
)
{
if
(
fields
==
null
)
fields
=
new
ArrayList
<>();
fields
.
add
(
fieldModel
);
return
this
;
}
private
List
<
RelationshipModel
>
references
;
public
EntityModel
addReference
(
RelationshipModel
relationshipModel
)
{
if
(
references
==
null
)
references
=
new
ArrayList
<>();
references
.
add
(
relationshipModel
);
return
this
;
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
private
Map
<
String
,
RelationshipModel
>
refMaps
;
...
...
@@ -79,7 +95,7 @@ public class EntityModel {
if
(!
StringUtils
.
isEmpty
(
ship
.
getCodeName
()))
refMaps
.
put
(
ship
.
getCodeName
(),
ship
);
if
(!
StringUtils
.
isEmpty
(
ship
.
getRelation
()))
{
String
fkname
=
DataObject
.
getStringValue
(
ship
.
getRelation
().
get
(
"name"
),
""
);
String
fkname
=
DataObject
.
getStringValue
(
ship
.
getRelation
().
get
Name
(
),
""
);
if
(!
StringUtils
.
isEmpty
(
fkname
))
refMaps
.
put
(
fkname
,
ship
);
}
...
...
@@ -90,6 +106,14 @@ public class EntityModel {
private
List
<
RelationshipModel
>
nesteds
;
public
EntityModel
addNested
(
RelationshipModel
relationshipModel
)
{
if
(
nesteds
==
null
)
nesteds
=
new
ArrayList
<>();
nesteds
.
add
(
relationshipModel
);
return
this
;
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
private
Map
<
String
,
FieldModel
>
fieldMap
=
null
;
...
...
This diff is collapsed.
Click to expand it.
ibzdata-core/src/main/java/cn/ibizlab/core/data/lite/FieldModel.java
浏览文件 @
e94fd7f2
...
...
@@ -6,11 +6,13 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
org.springframework.util.StringUtils
;
@Getter
@Setter
@NoArgsConstructor
@Accessors
(
chain
=
true
)
@JsonIgnoreProperties
(
value
=
"handler"
)
public
class
FieldModel
{
...
...
@@ -91,7 +93,7 @@ public class FieldModel {
if
(
dataType
.
indexOf
(
"TEXT"
)>=
0
||
dataType
.
indexOf
(
"CHAR"
)>=
0
||
dataType
.
indexOf
(
"LOB"
)>=
0
)
return
"string"
;
else
if
(
dataType
.
indexOf
(
"TIME"
)>=
0
)
return
"dat
a
-time"
;
return
"dat
e
-time"
;
else
if
(
dataType
.
indexOf
(
"DATE"
)>=
0
)
return
"date"
;
else
if
(
dataType
.
indexOf
(
"NUM"
)>=
0
||
dataType
.
indexOf
(
"FLOAT"
)>=
0
||
dataType
.
indexOf
(
"DOUBLE"
)>=
0
||
dataType
.
indexOf
(
"DECIMAL"
)>=
0
)
...
...
This diff is collapsed.
Click to expand it.
ibzdata-core/src/main/java/cn/ibizlab/core/data/lite/LiteModelFallback.java
浏览文件 @
e94fd7f2
...
...
@@ -18,5 +18,15 @@ public class LiteModelFallback implements LiteModelFeignClient {
return
null
;
}
@Override
public
List
<
EntityModel
>
getEntityModel
(
String
system
)
{
return
null
;
}
@Override
public
List
<
DstSystemModel
>
getSysApps
()
{
return
null
;
}
}
This diff is collapsed.
Click to expand it.
ibzdata-core/src/main/java/cn/ibizlab/core/data/lite/LiteModelFeignClient.java
浏览文件 @
e94fd7f2
...
...
@@ -2,8 +2,12 @@ package cn.ibizlab.core.data.lite;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* 实体[MetaModel] 服务对象接口
...
...
@@ -19,5 +23,12 @@ public interface LiteModelFeignClient {
@Cacheable
(
value
=
"entitymodel"
,
key
=
"'row:'+#p0+'.'+#p1"
)
EntityModel
getProxyEntityModel
(
@PathVariable
(
"system"
)
String
system
,
@PathVariable
(
"entity"
)
String
entity
);
@GetMapping
(
"/lite/{system}/entitys"
)
List
<
EntityModel
>
getEntityModel
(
@PathVariable
(
"system"
)
String
system
);
@GetMapping
(
"/lite/sysapps"
)
@Cacheable
(
value
=
"syspssystem"
,
key
=
"'row:sys-dst-sys-apps'"
)
List
<
DstSystemModel
>
getSysApps
();
}
This diff is collapsed.
Click to expand it.
ibzdata-core/src/main/java/cn/ibizlab/core/data/lite/LiteStorage.java
浏览文件 @
e94fd7f2
package
cn
.
ibizlab
.
core
.
data
.
lite
;
import
com.alibaba.fastjson.JSON
;
import
net.ibizsys.model.IPSSystem
;
import
net.ibizsys.model.PSModelServiceImpl
;
import
net.ibizsys.model.dataentity.IPSDataEntity
;
import
net.ibizsys.model.dataentity.defield.IPSDEField
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.
beans.factory.annotation.Value
;
import
org.springframework.
context.annotation.Lazy
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.StringUtils
;
import
javax.annotation.PostConstruct
;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Component
public
class
LiteStorage
{
private
static
LiteModelFeignClient
service
;
private
static
LiteModelFeignClient
liteModelFeignClient
;
private
static
DynamicModelService
dynamicModelService
;
public
static
void
setLiteModelService
(
LiteModelFeignClient
service
)
public
static
void
setDynamicModelService
(
DynamicModelService
service
)
{
if
(
LiteStorage
.
s
ervice
==
null
)
LiteStorage
.
s
ervice
=
service
;
if
(
LiteStorage
.
dynamicModelS
ervice
==
null
)
LiteStorage
.
dynamicModelS
ervice
=
service
;
}
public
static
LiteModelFeignClient
getLiteModelService
(
)
public
static
void
setLiteModelService
(
LiteModelFeignClient
service
)
{
return
service
;
if
(
LiteStorage
.
liteModelFeignClient
==
null
)
LiteStorage
.
liteModelFeignClient
=
service
;
}
public
static
EntityModel
getEntityModel
(
String
system
,
String
entity
)
public
static
LiteModelFeignClient
getLiteModelService
(
)
{
return
service
.
getProxyEntityModel
(
system
,
entity
);
return
liteModelFeignClient
;
}
@Autowired
private
LiteModelFeignClient
client
;
@PostConstruct
public
void
init
(){
LiteStorage
.
setLiteModelService
(
client
);
public
static
DynamicModelService
getDynamicModelService
()
{
return
dynamicModelService
;
}
public
static
EntityModel
getEntityModel
(
String
system
,
String
entity
)
{
EntityModel
entityModel
=
null
;
@Value
(
"${ibiz.model.path:/app/file/model/}"
)
private
String
modelPath
;
try
{
entityModel
=
getDynamicModelService
().
getDynamicEntity
(
system
,
entity
);
}
catch
(
Exception
exception
)
{
private
Map
<
String
,
IPSSystem
>
dynamicSystems
;
public
synchronized
IPSSystem
getDynamicSystem
(
String
system
)
{
if
(
dynamicSystems
==
null
)
dynamicSystems
=
new
HashMap
<>();
if
(
dynamicSystems
.
containsKey
(
system
))
return
dynamicSystems
.
get
(
system
);
}
if
(
entityModel
==
null
)
entityModel
=
getLiteModelService
().
getProxyEntityModel
(
system
,
entity
);
return
initDynamicSystem
(
system
)
;
return
entityModel
;
}
public
synchronized
IPSSystem
initDynamicSystem
(
String
system
)
{
if
(
dynamicSystems
==
null
)
dynamicSystems
=
new
HashMap
<>();
PSModelServiceImpl
psModelService
=
new
PSModelServiceImpl
();
psModelService
.
setPSModelFolderPath
(
modelPath
+
File
.
separator
+
system
+
File
.
separator
+
"model"
);
IPSSystem
iPSSystem
=
null
;
try
{
iPSSystem
=
psModelService
.
getPSSystem
();
dynamicSystems
.
put
(
system
,
iPSSystem
);
@Autowired
private
LiteModelFeignClient
liteService
;
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
String
.
format
(
"加载系统模型错误:%s"
,
e
.
getMessage
()));
}
return
iPSSystem
;
}
@Autowired
@Lazy
private
DynamicModelService
dynamicService
;
public
synchronized
EntityModel
getDynamicEntity
(
String
system
,
String
entity
)
throws
Exception
{
IPSSystem
iPSSystem
=
getDynamicSystem
(
system
);
if
(
iPSSystem
==
null
)
return
null
;
IPSDataEntity
dataEntity
=
iPSSystem
.
getPSDataEntity
(
entity
,
true
);
if
(
dataEntity
==
null
)
return
null
;
EntityModel
entityModel
=
new
EntityModel
();
MetaEntityModel
metaEntityModel
=
new
MetaEntityModel
();
metaEntityModel
.
setEntityId
(
dataEntity
.
getId
()).
setEntityName
(
dataEntity
.
getName
())
.
setLogicName
(
dataEntity
.
getLogicName
()).
setCodeName
(
dataEntity
.
getCodeName
()).
setTableName
(
dataEntity
.
getTableName
())
.
setSystemId
(
system
).
setSystemName
(
iPSSystem
.
getLogicName
()).
setShowOrder
(
0
);
if
(
dataEntity
.
isLogicValid
())
{
List
<
Setting
>
settingList
=
new
ArrayList
<>();
String
val
=
dataEntity
.
getValidLogicValue
();
if
(
StringUtils
.
isEmpty
(
val
))
val
=
"1"
;
String
deVal
=
dataEntity
.
getInvalidLogicValue
();
if
(
StringUtils
.
isEmpty
(
deVal
))
deVal
=
"0"
;
settingList
.
add
(
new
Setting
().
setProperty
(
"logicval"
).
setValue
(
val
));
settingList
.
add
(
new
Setting
().
setProperty
(
"logicdelval"
).
setValue
(
deVal
));
metaEntityModel
.
setExtParams
(
JSON
.
toJSONString
(
settingList
));
}
entityModel
.
setEntity
(
metaEntityModel
);
for
(
IPSDEField
defield:
dataEntity
.
getAllPSDEFields
())
{
@PostConstruct
public
void
init
(){
LiteStorage
.
setLiteModelService
(
liteService
);
LiteStorage
.
setDynamicModelService
(
dynamicService
);
}
return
entityModel
;
}
}
This diff is collapsed.
Click to expand it.
ibzdata-core/src/main/java/cn/ibizlab/core/data/lite/MetaFieldModel.java
浏览文件 @
e94fd7f2
...
...
@@ -9,6 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
java.sql.Timestamp
;
...
...
@@ -18,6 +19,7 @@ import java.sql.Timestamp;
@Getter
@Setter
@NoArgsConstructor
@Accessors
(
chain
=
true
)
@JsonIgnoreProperties
(
value
=
"handler"
)
@ApiModel
(
"属性"
)
public
class
MetaFieldModel
{
...
...
This diff is collapsed.
Click to expand it.
ibzdata-core/src/main/java/cn/ibizlab/core/data/lite/MetaLookupModel.java
0 → 100644
浏览文件 @
e94fd7f2
package
cn
.
ibizlab
.
core
.
data
.
lite
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.*
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
/**
* [lookup] 对象
*/
@Getter
@Setter
@NoArgsConstructor
@Accessors
(
chain
=
true
)
@ApiModel
(
"lookup"
)
public
class
MetaLookupModel
implements
Serializable
{
/**
* 标识
*/
@JSONField
(
name
=
"id"
)
@JsonProperty
(
"id"
)
@ApiModelProperty
(
"标识"
)
private
String
id
;
/**
* 关系标识
*/
@JSONField
(
name
=
"relationId"
)
@JsonProperty
(
"relationId"
)
@ApiModelProperty
(
"关系标识"
)
private
String
relationid
;
/**
* 属性名称
*/
@JSONField
(
name
=
"fieldName"
)
@JsonProperty
(
"fieldName"
)
@ApiModelProperty
(
"属性名称"
)
private
String
fieldname
;
/**
* 引用属性名称
*/
@JSONField
(
name
=
"refFieldName"
)
@JsonProperty
(
"refFieldName"
)
@ApiModelProperty
(
"引用属性名称"
)
private
String
reffieldname
;
}
This diff is collapsed.
Click to expand it.
ibzdata-core/src/main/java/cn/ibizlab/core/data/lite/MetaRelationshipModel.java
0 → 100644
浏览文件 @
e94fd7f2
package
cn
.
ibizlab
.
core
.
data
.
lite
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* 实体[实体关系]
*/
@Getter
@Setter
@NoArgsConstructor
@Accessors
(
chain
=
true
)
@JsonIgnoreProperties
(
value
=
"handler"
)
@ApiModel
(
"实体关系"
)
public
class
MetaRelationshipModel
implements
Serializable
{
/**
* 关系标识
*/
@JSONField
(
name
=
"id"
)
@JsonProperty
(
"id"
)
@ApiModelProperty
(
"关系标识"
)
private
String
id
;
/**
* 关系名称
*/
@JSONField
(
name
=
"name"
)
@JsonProperty
(
"name"
)
@ApiModelProperty
(
"关系名称"
)
private
String
name
;
/**
* 类型
*/
@JSONField
(
name
=
"relation_type"
)
@JsonProperty
(
"relation_type"
)
@ApiModelProperty
(
"类型"
)
private
String
relationType
;
/**
* 代码名称
*/
@JSONField
(
name
=
"code_name"
)
@JsonProperty
(
"code_name"
)
@ApiModelProperty
(
"代码名称"
)
private
String
codeName
;
/**
* 实体标识
*/
@JSONField
(
name
=
"entity_id"
)
@JsonProperty
(
"entity_id"
)
@ApiModelProperty
(
"实体标识"
)
private
String
entityId
;
/**
* 实体名称
*/
@JSONField
(
name
=
"entity_name"
)
@JsonProperty
(
"entity_name"
)
@ApiModelProperty
(
"实体名称"
)
private
String
entityName
;
/**
* 引用实体标识
*/
@JSONField
(
name
=
"ref_entity_id"
)
@JsonProperty
(
"ref_entity_id"
)
@ApiModelProperty
(
"引用实体标识"
)
private
String
refEntityId
;
/**
* 引用实体名称
*/
@JSONField
(
name
=
"ref_entity_name"
)
@JsonProperty
(
"ref_entity_name"
)
@ApiModelProperty
(
"引用实体名称"
)
private
String
refEntityName
;
/**
* 嵌套代码名称
*/
@JSONField
(
name
=
"nested_name"
)
@JsonProperty
(
"nested_name"
)
@ApiModelProperty
(
"嵌套代码名称"
)
private
String
nestedName
;
/**
* 系统
*/
@JSONField
(
name
=
"system_id"
)
@JsonProperty
(
"system_id"
)
@ApiModelProperty
(
"系统"
)
private
String
systemId
;
/**
* 创建时间
*/
@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"
)
@ApiModelProperty
(
"创建时间"
)
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"
)
@ApiModelProperty
(
"最后修改时间"
)
private
Timestamp
updatedate
;
/**
* lookup
*/
@JSONField
(
name
=
"lookups"
)
@JsonProperty
(
"lookups"
)
private
List
<
MetaLookupModel
>
lookup
;
public
MetaRelationshipModel
addLookup
(
MetaLookupModel
obj
)
{
if
(
lookup
==
null
)
lookup
=
new
ArrayList
<>();
lookup
.
add
(
obj
);
return
this
;
}
}
This diff is collapsed.
Click to expand it.
ibzdata-core/src/main/java/cn/ibizlab/core/data/lite/RelationshipModel.java
浏览文件 @
e94fd7f2
...
...
@@ -4,12 +4,14 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
java.util.Map
;
@Getter
@Setter
@NoArgsConstructor
@Accessors
(
chain
=
true
)
@JsonIgnoreProperties
(
value
=
"handler"
)
public
class
RelationshipModel
{
...
...
@@ -29,6 +31,6 @@ public class RelationshipModel {
private
String
entityId
;
private
M
ap
relation
;
private
M
etaRelationshipModel
relation
;
}
This diff is collapsed.
Click to expand it.
ibzdata-core/src/main/java/cn/ibizlab/core/data/model/TransUtils.java
浏览文件 @
e94fd7f2
...
...
@@ -2,6 +2,7 @@ package cn.ibizlab.core.data.model;
import
cn.ibizlab.core.data.lite.EntityModel
;
import
cn.ibizlab.core.data.lite.FieldModel
;
import
cn.ibizlab.core.data.lite.MetaRelationshipModel
;
import
cn.ibizlab.core.data.lite.RelationshipModel
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
...
...
@@ -122,11 +123,11 @@ public class TransUtils {
pojoSchema
.
getOptions
().
setAll
(
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
entityModel
.
getEntity
())));
int
order
=
1
;
PojoSchema
sub
=
null
;
for
(
FieldModel
fieldModel:
entityModel
.
getFields
())
{
String
propType
=
fieldModel
.
getPropType
();
PojoSchema
sub
=
null
;
if
(
"date"
.
equals
(
propType
))
sub
=
new
PojoSchema
().
setType
(
PojoSchema
.
Type
.
string
.
getCode
()).
setFormat
(
"date"
);
else
if
(
"date-time"
.
equals
(
propType
))
...
...
@@ -145,9 +146,59 @@ public class TransUtils {
}
pojoSchema
.
addProperty
(
sub
.
getName
(),
sub
);
order
++;
}
if
(
entityModel
.
getReferences
()!=
null
)
{
for
(
RelationshipModel
rel:
entityModel
.
getReferences
())
{
PojoSchema
sub
=
new
PojoSchema
().
setType
(
PojoSchema
.
Type
.
object
.
getCode
()).
setName
(
rel
.
getCodeName
()).
setTitle
(
rel
.
getCodeName
()+
rel
.
getEntityLogicName
())
.
setPropertyOrder
(
order
).
setOptions
(
new
PojoOption
()
.
set
(
"logic_name"
,
rel
.
getEntityLogicName
())
.
set
(
"entity_name"
,
rel
.
getEntityName
())
.
set
(
"system_id"
,(
StringUtils
.
isEmpty
(
rel
.
getSystemId
())?
entityModel
.
getSystemId
():
rel
.
getSystemId
()))
.
set
(
"entity_id"
,
rel
.
getEntityId
()).
set
(
"code_name"
,
rel
.
getEntityCodeName
())
.
set
(
"table_name"
,
rel
.
getTableName
()).
set
(
"ds_name"
,
rel
.
getDataSourceName
()).
set
(
"relation"
,
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
rel
.
getRelation
()),
MetaRelationshipModel
.
class
))
)
.
setRef
((
StringUtils
.
isEmpty
(
rel
.
getSystemId
())?
entityModel
.
getSystemId
():
rel
.
getSystemId
())+
".domain."
+
rel
.
getEntityName
());
pojoSchema
.
addProperty
(
sub
.
getName
(),
sub
);
order
++;
}
}
if
(
entityModel
.
getNesteds
()!=
null
)
{
for
(
RelationshipModel
nest:
entityModel
.
getNesteds
())
{
PojoSchema
sub
=
new
PojoSchema
().
setType
(
PojoSchema
.
Type
.
array
.
getCode
()).
setName
(
nest
.
getCodeName
()).
setTitle
(
nest
.
getCodeName
()+
nest
.
getEntityLogicName
())
.
setPropertyOrder
(
order
).
setOptions
(
new
PojoOption
()
.
set
(
"logic_name"
,
nest
.
getEntityLogicName
())
.
set
(
"entity_name"
,
nest
.
getEntityName
())
.
set
(
"system_id"
,(
StringUtils
.
isEmpty
(
nest
.
getSystemId
())?
entityModel
.
getSystemId
():
nest
.
getSystemId
()))
.
set
(
"entity_id"
,
nest
.
getEntityId
()).
set
(
"code_name"
,
nest
.
getEntityCodeName
())
.
set
(
"table_name"
,
nest
.
getTableName
()).
set
(
"ds_name"
,
nest
.
getDataSourceName
()).
set
(
"relation"
,
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
nest
.
getRelation
()),
MetaRelationshipModel
.
class
))
)
.
setItems
(
new
PojoSchema
().
setType
(
PojoSchema
.
Type
.
object
.
getCode
()).
setName
(
nest
.
getEntityName
()).
setTitle
(
nest
.
getEntityLogicName
())
.
setRef
((
StringUtils
.
isEmpty
(
nest
.
getSystemId
())?
entityModel
.
getSystemId
():
nest
.
getSystemId
())+
".domain."
+
nest
.
getEntityName
())
.
setOptions
(
new
PojoOption
()
.
set
(
"logic_name"
,
nest
.
getEntityLogicName
())
.
set
(
"entity_name"
,
nest
.
getEntityName
())
.
set
(
"system_id"
,(
StringUtils
.
isEmpty
(
nest
.
getSystemId
())?
entityModel
.
getSystemId
():
nest
.
getSystemId
()))
.
set
(
"entity_id"
,
nest
.
getEntityId
()).
set
(
"code_name"
,
nest
.
getEntityCodeName
())
.
set
(
"table_name"
,
nest
.
getTableName
()).
set
(
"ds_name"
,
nest
.
getDataSourceName
())
)
);
pojoSchema
.
addProperty
(
sub
.
getName
(),
sub
);
order
++;
}
}
return
pojoSchema
;
}
...
...
This diff is collapsed.
Click to expand it.
ibzdata-core/src/main/java/cn/ibizlab/core/data/service/impl/DOModelServiceImpl.java
浏览文件 @
e94fd7f2
...
...
@@ -94,7 +94,7 @@ public class DOModelServiceImpl implements IDOModelService {
File
schemaJson
=
new
File
(
domainDir
,
entity
+
".json"
);
if
(!
schemaJson
.
exists
())
{
EntityModel
entityModel
=
LiteStorage
.
get
LiteModelService
().
getProxy
EntityModel
(
system
,
entity
);
EntityModel
entityModel
=
LiteStorage
.
getEntityModel
(
system
,
entity
);
if
(
entityModel
!=
null
)
{
schema
=
TransUtils
.
LiteEntityModelModel2Schema
(
entityModel
);
}
...
...
This diff is collapsed.
Click to expand it.
ibzdata-core/src/main/java/cn/ibizlab/core/data/service/impl/DTOModelServiceImpl.java
浏览文件 @
e94fd7f2
...
...
@@ -99,7 +99,7 @@ public class DTOModelServiceImpl implements IDTOModelService {
String
entity
=
dto
;
if
(
entity
.
endsWith
(
"DTO"
))
entity
=
entity
.
substring
(
0
,
entity
.
length
()-
3
);
EntityModel
entityModel
=
LiteStorage
.
get
LiteModelService
().
getProxy
EntityModel
(
system
,
entity
);
EntityModel
entityModel
=
LiteStorage
.
getEntityModel
(
system
,
entity
);
if
(
entityModel
!=
null
)
{
schema
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
TransUtils
.
LiteEntityModelModel2Schema
(
entityModel
)),
PojoSchema
.
class
);
schema
.
setName
(
dto
);
...
...
This diff is collapsed.
Click to expand it.
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录