Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
workflow-core
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
黄夏豪
workflow-core
Commits
9f5cb8f2
提交
9f5cb8f2
authored
3月 10, 2021
作者:
ww1xhqc
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
model layer 扫描重复bug
上级
bb9a9db9
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
46 行增加
和
22 行删除
+46
-22
ModelImpl.java
...tykj/workflowcore/model_layer/service/impl/ModelImpl.java
+46
-22
没有找到文件。
src/main/java/com/tykj/workflowcore/model_layer/service/impl/ModelImpl.java
浏览文件 @
9f5cb8f2
...
...
@@ -14,6 +14,7 @@ import com.tykj.workflowcore.model_layer.service.ModelService;
import
com.tykj.workflowcore.model_layer.utils.CreatTableUtil
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.extern.slf4j.Slf4j
;
import
org.hibernate.Session
;
import
org.hibernate.internal.SessionImpl
;
...
...
@@ -51,6 +52,7 @@ import static com.tykj.workflowcore.model_layer.utils.CreatTableUtil.getClassNam
*/
@Transactional
@Service
@Slf4j
public
class
ModelImpl
implements
ModelService
{
...
...
@@ -249,7 +251,8 @@ public class ModelImpl implements ModelService {
// tableInfo.setId(id);
TableVO
tableVO
=
new
TableVO
();
String
className
=
getClassName
(
aClass
.
toString
());
tableVO
.
setModelName
(
className
.
toLowerCase
()
+
"_model_test"
);
String
realName
=
className
.
toLowerCase
()
+
"_model_test"
;
tableVO
.
setModelName
(
realName
);
if
(
aClass
.
isAnnotationPresent
(
ApiModel
.
class
))
{
ApiModel
annotation
=
aClass
.
getAnnotation
(
ApiModel
.
class
);
...
...
@@ -298,33 +301,54 @@ public class ModelImpl implements ModelService {
tableInfo
.
setName
(
tableVO
.
getModelName
());
tableInfo
.
setCnName
(
tableVO
.
getModelTitle
());
tableInfo
.
setXML
(
xml
);
tableInfo
=
tableInfoDao
.
save
(
tableInfo
);
List
<
ColumnVO
>
dataList
=
tableVO
.
getDataList
();
for
(
ColumnVO
columnVO
:
dataList
)
{
ColumnInfo
columnInfo
=
new
ColumnInfo
();
columnInfo
.
setName
(
columnVO
.
getFieldName
());
columnInfo
.
setType
(
columnVO
.
getFiledType
());
columnInfo
.
setLength
(
columnVO
.
getFiledLength
());
columnInfo
.
setCnName
(
columnVO
.
getFiledDescription
());
if
(
genericType
.
toString
().
equals
(
"class java.lang.String"
)){
columnInfo
.
setLength
(
65535
);
}
else
if
(
genericType
.
toString
().
equals
(
"class java.lang.Integer"
)){
columnInfo
.
setLength
(
11
);
}
else
{
columnInfo
.
setLength
(
0
);
if
(
checkRepeat
(
realName
)){
tableInfo
=
tableInfoDao
.
save
(
tableInfo
);
List
<
ColumnVO
>
dataList
=
tableVO
.
getDataList
();
for
(
ColumnVO
columnVO
:
dataList
)
{
ColumnInfo
columnInfo
=
new
ColumnInfo
();
columnInfo
.
setName
(
columnVO
.
getFieldName
());
columnInfo
.
setType
(
columnVO
.
getFiledType
());
columnInfo
.
setLength
(
columnVO
.
getFiledLength
());
columnInfo
.
setCnName
(
columnVO
.
getFiledDescription
());
if
(
genericType
.
toString
().
equals
(
"class java.lang.String"
))
{
columnInfo
.
setLength
(
255
);
}
else
if
(
genericType
.
toString
().
equals
(
"class java.lang.Integer"
)&&
genericType
.
toString
().
equals
(
"int"
))
{
columnInfo
.
setLength
(
11
);
}
else
{
columnInfo
.
setLength
(
0
);
}
columnInfo
.
setDbName
(
className
);
columnInfo
.
setDbId
(
tableInfo
.
getId
());
columnInfoDao
.
save
(
columnInfo
);
}
columnInfo
.
setDbName
(
className
);
columnInfo
.
setDbId
(
tableInfo
.
getId
());
columnInfoDao
.
save
(
columnInfo
);
}
else
{
log
.
info
(
"{}已存在"
,
className
);
}
}
}
}
}
public
boolean
checkRepeat
(
String
table_name
)
{
Specification
spec
=
(
Specification
)
(
root
,
criteriaQuery
,
criteriaBuilder
)
->
{
Path
name
=
root
.
get
(
"name"
);
Predicate
equal
=
criteriaBuilder
.
equal
(
name
,
table_name
);
return
equal
;
};
List
<
TableInfo
>
all
=
tableInfoDao
.
findAll
(
spec
);
for
(
TableInfo
tableInfo
:
all
)
{
String
name
=
tableInfo
.
getName
();
if
(
table_name
.
equals
(
name
))
{
return
false
;
}
}
return
true
;
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论