Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzlite
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzlite
提交
3a12d7aa
提交
3a12d7aa
编写于
11月 21, 2020
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
model
上级
40e9896a
变更
2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
149 行增加
和
30 行删除
+149
-30
EntityModel.java
...a/cn/ibizlab/core/lite/extensions/domain/EntityModel.java
+119
-30
FieldModel.java
...va/cn/ibizlab/core/lite/extensions/domain/FieldModel.java
+30
-0
未找到文件。
ibzlite-core/src/main/java/cn/ibizlab/core/lite/extensions/domain/EntityModel.java
浏览文件 @
3a12d7aa
...
...
@@ -4,6 +4,8 @@ import cn.ibizlab.core.lite.domain.MetaDataSet;
import
cn.ibizlab.core.lite.domain.MetaEntity
;
import
cn.ibizlab.core.lite.domain.MetaField
;
import
cn.ibizlab.core.lite.domain.MetaRelationship
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
...
...
@@ -13,10 +15,7 @@ import lombok.NoArgsConstructor;
import
lombok.Setter
;
import
org.springframework.util.StringUtils
;
import
java.util.HashMap
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
@Getter
@Setter
...
...
@@ -68,7 +67,7 @@ public class EntityModel {
{
if
(
fields
!=
null
&&
fieldMap
==
null
)
{
fieldMap
=
new
HashMap
<>();
fieldMap
=
new
Linked
HashMap
<>();
fields
.
forEach
(
field
->{
fieldMap
.
put
(
field
.
getColumnName
(),
field
);
fieldMap
.
put
(
field
.
getCodeName
(),
field
);
...
...
@@ -77,21 +76,99 @@ public class EntityModel {
return
fieldMap
;
}
public
FieldModel
getLastModifyField
()
{
if
(
fields
!=
null
)
{
private
FieldModel
lastModifyField
;
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
FieldModel
getLastModifyField
()
{
if
(
fields
!=
null
&&
lastModifyField
==
null
)
for
(
FieldModel
fieldModel:
fields
)
{
if
(
"UPDATEDATE"
.
equals
(
fieldModel
.
getField
().
getPredefined
()))
{
return
fieldModel
;
}
}
}
return
null
;
if
(
fieldModel
.
isLastModifyField
())
{
lastModifyField
=
fieldModel
;
return
lastModifyField
;
}
return
lastModifyField
;
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
private
boolean
isLogicValid
=
true
;
@JsonIgnore
@JSONField
(
serialize
=
false
)
private
FieldModel
logicValidField
;
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
FieldModel
getLogicValidField
()
{
if
(
isLogicValid
&&
logicValidField
==
null
)
{
if
(
fields
!=
null
)
{
for
(
FieldModel
fieldModel
:
fields
)
{
if
(
fieldModel
.
isLogicValidField
())
{
logicValidField
=
fieldModel
;
return
logicValidField
;
}
}
}
isLogicValid
=
false
;
}
return
logicValidField
;
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
private
String
logicVal
;
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
String
getLogicVal
()
{
if
(
StringUtils
.
isEmpty
(
logicVal
))
logicVal
=
this
.
getExtParams
(
"logicval"
);
if
(
StringUtils
.
isEmpty
(
logicVal
))
logicVal
=
"1"
;
return
logicVal
;
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
private
String
logicDelVal
;
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
String
getLogicDelVal
()
{
if
(
StringUtils
.
isEmpty
(
logicVal
))
logicDelVal
=
this
.
getExtParams
(
"logicdelval"
);
if
(
StringUtils
.
isEmpty
(
logicDelVal
))
logicDelVal
=
"0"
;
return
logicDelVal
;
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
private
FieldModel
keyField
;
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
FieldModel
getKeyField
()
{
if
(
fields
!=
null
&&
keyField
==
null
)
for
(
FieldModel
fieldModel:
fields
)
if
(
fieldModel
.
isKeyField
())
{
keyField
=
fieldModel
;
return
keyField
;
}
return
keyField
;
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
private
List
<
FieldModel
>
unionKeyFields
;
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
List
<
FieldModel
>
getUnionKeyFields
()
{
if
(
fields
!=
null
&&
unionKeyFields
==
null
)
{
unionKeyFields
=
new
ArrayList
<>();
for
(
FieldModel
fieldModel
:
fields
)
if
(
fieldModel
.
isUnionKeyField
())
unionKeyFields
.
add
(
fieldModel
);
}
return
unionKeyFields
;
}
public
FieldModel
getField
(
String
name
)
{
...
...
@@ -125,19 +202,14 @@ public class EntityModel {
}
else
if
(
"CORE"
.
equalsIgnoreCase
(
dataSet
))
{
String
columnSet
=
""
;
for
(
FieldModel
fieldModel:
fields
)
{
if
(
StringUtils
.
isEmpty
(
fieldModel
.
getField
().
getUnionKey
())&&
1
!=
fieldModel
.
getField
().
getKeyField
())
continue
;
String
columnExp
=
fieldModel
.
getColumnExp
();
if
(
StringUtils
.
isEmpty
(
columnExp
))
continue
;
if
(!
StringUtils
.
isEmpty
(
columnSet
)){
columnSet
=
columnSet
+
","
;
}
columnSet
=
columnSet
+
columnExp
;
}
String
columnSet
=
this
.
getKeyField
().
getColumnExp
();
for
(
FieldModel
fieldModel:
this
.
getUnionKeyFields
())
{
String
columnExp
=
fieldModel
.
getColumnExp
();
if
(
StringUtils
.
isEmpty
(
columnExp
))
continue
;
columnSet
=
columnSet
+
","
+
columnExp
;
}
return
"select "
+
columnSet
+
" from "
+
this
.
getTableName
()+
" "
;
}
...
...
@@ -162,5 +234,22 @@ public class EntityModel {
}
public
String
getExtParams
(
String
key
)
{
if
(!(
StringUtils
.
isEmpty
(
this
.
getEntity
().
getExtParams
())))
{
JSONArray
ja
=
JSONArray
.
parseArray
(
this
.
getEntity
().
getExtParams
());
for
(
int
i
=
0
;
i
<
ja
.
size
();
i
++)
{
JSONObject
jo
=
ja
.
getJSONObject
(
i
);
if
(
jo
.
containsKey
(
"property"
)&&
key
.
equals
(
jo
.
getString
(
"property"
)))
{
return
jo
.
getString
(
"value"
);
}
}
}
return
null
;
}
}
ibzlite-core/src/main/java/cn/ibizlab/core/lite/extensions/domain/FieldModel.java
浏览文件 @
3a12d7aa
...
...
@@ -43,4 +43,34 @@ public class FieldModel {
}
return
""
;
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
boolean
isKeyField
()
{
return
1
==
this
.
getField
().
getKeyField
();
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
boolean
isLogicValidField
()
{
return
"LOGICVALID"
.
equals
(
this
.
getField
().
getPredefined
());
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
boolean
isLastModifyField
()
{
return
"UPDATEDATE"
.
equals
(
this
.
getField
().
getPredefined
());
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
boolean
isUnionKeyField
()
{
return
!
StringUtils
.
isEmpty
(
this
.
getField
().
getUnionKey
());
}
}
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录