Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
workflow-core
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
黄夏豪
workflow-core
Commits
eab4359c
提交
eab4359c
authored
3月 10, 2021
作者:
ww1xhqc
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
model layer类型和字段主键问题
上级
f2530727
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
22 行增加
和
7 行删除
+22
-7
ColumnInfo.java
...a/com/tykj/workflowcore/model_layer/model/ColumnInfo.java
+4
-0
ColumnVO.java
...ava/com/tykj/workflowcore/model_layer/model/ColumnVO.java
+2
-1
ModelImpl.java
...tykj/workflowcore/model_layer/service/impl/ModelImpl.java
+14
-5
CreatTableUtil.java
...m/tykj/workflowcore/model_layer/utils/CreatTableUtil.java
+0
-1
HqlUtil.java
...java/com/tykj/workflowcore/model_layer/utils/HqlUtil.java
+2
-0
没有找到文件。
src/main/java/com/tykj/workflowcore/model_layer/model/ColumnInfo.java
浏览文件 @
eab4359c
...
@@ -23,6 +23,10 @@ public class ColumnInfo {
...
@@ -23,6 +23,10 @@ public class ColumnInfo {
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Column
(
name
=
"id"
)
@Column
(
name
=
"id"
)
private
long
id
;
private
long
id
;
//0是,1否
@Column
(
name
=
"primary_key"
)
private
Integer
primarykey
;
@Column
(
name
=
"name"
)
@Column
(
name
=
"name"
)
private
String
name
;
private
String
name
;
@Column
(
name
=
"cn_name"
)
@Column
(
name
=
"cn_name"
)
...
...
src/main/java/com/tykj/workflowcore/model_layer/model/ColumnVO.java
浏览文件 @
eab4359c
package
com
.
tykj
.
workflowcore
.
model_layer
.
model
;
package
com
.
tykj
.
workflowcore
.
model_layer
.
model
;
import
com.tykj.workflowcore.model_layer.annotatiion.WorkFlowCoreNoScan
;
import
lombok.Data
;
import
lombok.Data
;
/**
/**
...
@@ -19,5 +19,6 @@ public class ColumnVO {
...
@@ -19,5 +19,6 @@ public class ColumnVO {
private
String
fieldName
;
private
String
fieldName
;
private
String
filedDescription
;
private
String
filedDescription
;
private
int
filedLength
;
private
int
filedLength
;
private
Integer
primarykey
=
1
;
}
}
src/main/java/com/tykj/workflowcore/model_layer/service/impl/ModelImpl.java
浏览文件 @
eab4359c
package
com
.
tykj
.
workflowcore
.
model_layer
.
service
.
impl
;
package
com
.
tykj
.
workflowcore
.
model_layer
.
service
.
impl
;
import
com.fasterxml.jackson.annotation.JsonTypeInfo
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
...
@@ -32,6 +33,7 @@ import javax.persistence.Entity;
...
@@ -32,6 +33,7 @@ import javax.persistence.Entity;
import
javax.persistence.EntityManagerFactory
;
import
javax.persistence.EntityManagerFactory
;
import
javax.persistence.Id
;
import
javax.persistence.criteria.*
;
import
javax.persistence.criteria.*
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Field
;
...
@@ -245,15 +247,16 @@ public class ModelImpl implements ModelService {
...
@@ -245,15 +247,16 @@ public class ModelImpl implements ModelService {
@Override
@Override
public
void
swaggerScan
(
List
<
Class
<?>>
classList
)
{
public
void
swaggerScan
(
List
<
Class
<?>>
classList
)
{
for
(
Class
<?>
aClass
:
classList
)
{
for
(
Class
<?>
aClass
:
classList
)
{
//不扫描自己
if
(!
aClass
.
isAnnotationPresent
(
WorkFlowCoreNoScan
.
class
))
{
if
(!
aClass
.
isAnnotationPresent
(
WorkFlowCoreNoScan
.
class
))
{
if
(
aClass
.
isAnnotationPresent
(
Entity
.
class
))
{
if
(
aClass
.
isAnnotationPresent
(
Entity
.
class
))
{
TableInfo
tableInfo
=
new
TableInfo
();
TableInfo
tableInfo
=
new
TableInfo
();
// tableInfo.setId(id);
TableVO
tableVO
=
new
TableVO
();
TableVO
tableVO
=
new
TableVO
();
String
className
=
getClassName
(
aClass
.
toString
());
String
className
=
getClassName
(
aClass
.
toString
());
//入表真实名称
String
realName
=
className
.
toLowerCase
()
+
"_model_test"
;
String
realName
=
className
.
toLowerCase
()
+
"_model_test"
;
tableVO
.
setModelName
(
realName
);
tableVO
.
setModelName
(
realName
);
//获得类中文描述
if
(
aClass
.
isAnnotationPresent
(
ApiModel
.
class
))
{
if
(
aClass
.
isAnnotationPresent
(
ApiModel
.
class
))
{
ApiModel
annotation
=
aClass
.
getAnnotation
(
ApiModel
.
class
);
ApiModel
annotation
=
aClass
.
getAnnotation
(
ApiModel
.
class
);
StringBuilder
APiModelDocument
=
new
StringBuilder
();
StringBuilder
APiModelDocument
=
new
StringBuilder
();
...
@@ -269,17 +272,22 @@ public class ModelImpl implements ModelService {
...
@@ -269,17 +272,22 @@ public class ModelImpl implements ModelService {
}
else
{
}
else
{
tableVO
.
setModelTitle
(
""
);
tableVO
.
setModelTitle
(
""
);
}
}
//获得类所有属性
Field
[]
declaredFields
=
aClass
.
getDeclaredFields
();
Field
[]
declaredFields
=
aClass
.
getDeclaredFields
();
java
.
lang
.
reflect
.
Type
genericType
=
null
;
java
.
lang
.
reflect
.
Type
genericType
=
null
;
List
<
ColumnVO
>
list
=
new
ArrayList
<>();
List
<
ColumnVO
>
list
=
new
ArrayList
<>();
for
(
Field
declaredField
:
declaredFields
)
{
for
(
Field
declaredField
:
declaredFields
)
{
ColumnVO
columnVO
=
new
ColumnVO
();
ColumnVO
columnVO
=
new
ColumnVO
();
//获得类型
genericType
=
declaredField
.
getGenericType
();
genericType
=
declaredField
.
getGenericType
();
//是否主键
if
(
declaredField
.
isAnnotationPresent
(
javax
.
persistence
.
Id
.
class
)){
columnVO
.
setPrimarykey
(
0
);
}
columnVO
.
setFiledType
(
genericType
.
toString
());
columnVO
.
setFiledType
(
genericType
.
toString
());
columnVO
.
setFieldName
(
getClassName
(
declaredField
.
toString
()));
columnVO
.
setFieldName
(
getClassName
(
declaredField
.
toString
()));
//获得属性中文描述
if
(
declaredField
.
isAnnotationPresent
(
ApiModelProperty
.
class
))
{
if
(
declaredField
.
isAnnotationPresent
(
ApiModelProperty
.
class
))
{
ApiModelProperty
annotation
=
declaredField
.
getAnnotation
(
ApiModelProperty
.
class
);
ApiModelProperty
annotation
=
declaredField
.
getAnnotation
(
ApiModelProperty
.
class
);
StringBuilder
ApiModelPropertyDocument
=
new
StringBuilder
();
StringBuilder
ApiModelPropertyDocument
=
new
StringBuilder
();
...
@@ -302,7 +310,7 @@ public class ModelImpl implements ModelService {
...
@@ -302,7 +310,7 @@ public class ModelImpl implements ModelService {
tableInfo
.
setCnName
(
tableVO
.
getModelTitle
());
tableInfo
.
setCnName
(
tableVO
.
getModelTitle
());
tableInfo
.
setXML
(
xml
);
tableInfo
.
setXML
(
xml
);
tableInfo
.
setType
(
0
);
tableInfo
.
setType
(
0
);
//判断是否存在
if
(
checkRepeat
(
realName
)){
if
(
checkRepeat
(
realName
)){
tableInfo
=
tableInfoDao
.
save
(
tableInfo
);
tableInfo
=
tableInfoDao
.
save
(
tableInfo
);
List
<
ColumnVO
>
dataList
=
tableVO
.
getDataList
();
List
<
ColumnVO
>
dataList
=
tableVO
.
getDataList
();
...
@@ -312,6 +320,7 @@ public class ModelImpl implements ModelService {
...
@@ -312,6 +320,7 @@ public class ModelImpl implements ModelService {
columnInfo
.
setType
(
columnVO
.
getFiledType
());
columnInfo
.
setType
(
columnVO
.
getFiledType
());
columnInfo
.
setLength
(
columnVO
.
getFiledLength
());
columnInfo
.
setLength
(
columnVO
.
getFiledLength
());
columnInfo
.
setCnName
(
columnVO
.
getFiledDescription
());
columnInfo
.
setCnName
(
columnVO
.
getFiledDescription
());
columnInfo
.
setPrimarykey
(
columnVO
.
getPrimarykey
());
if
(
genericType
.
toString
().
equals
(
"class java.lang.String"
))
{
if
(
genericType
.
toString
().
equals
(
"class java.lang.String"
))
{
columnInfo
.
setLength
(
255
);
columnInfo
.
setLength
(
255
);
...
...
src/main/java/com/tykj/workflowcore/model_layer/utils/CreatTableUtil.java
浏览文件 @
eab4359c
...
@@ -81,7 +81,6 @@ public class CreatTableUtil {
...
@@ -81,7 +81,6 @@ public class CreatTableUtil {
public
static
String
getClassName
(
String
aClass
){
public
static
String
getClassName
(
String
aClass
){
int
i
=
aClass
.
lastIndexOf
(
"."
);
int
i
=
aClass
.
lastIndexOf
(
"."
);
String
substring
=
aClass
.
substring
(
i
+
1
);
String
substring
=
aClass
.
substring
(
i
+
1
);
return
substring
;
return
substring
;
...
...
src/main/java/com/tykj/workflowcore/model_layer/utils/HqlUtil.java
浏览文件 @
eab4359c
package
com
.
tykj
.
workflowcore
.
model_layer
.
utils
;
package
com
.
tykj
.
workflowcore
.
model_layer
.
utils
;
import
com.tykj.workflowcore.model_layer.model.QueryCondition
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.Objects
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论