Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
workflow
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
2
议题
2
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
黄夏豪
workflow
Commits
dbbbf9cc
提交
dbbbf9cc
authored
4月 21, 2021
作者:
ww1xhqc
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[数据模型] 修改model的bug。
上级
ebc68b1e
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
79 行增加
和
36 行删除
+79
-36
pom.xml
pom.xml
+20
-26
ColumnInfoDao.java
.../com/tykj/workflowcore/model_layer/dao/ColumnInfoDao.java
+10
-0
TableInfoDao.java
...a/com/tykj/workflowcore/model_layer/dao/TableInfoDao.java
+14
-0
ColumnInfo.java
.../com/tykj/workflowcore/model_layer/entity/ColumnInfo.java
+0
-2
AggregationImpl.java
...orkflowcore/model_layer/service/impl/AggregationImpl.java
+1
-1
ModelImpl.java
...tykj/workflowcore/model_layer/service/impl/ModelImpl.java
+18
-6
application.yml
src/main/resources/application.yml
+1
-1
WorkflowCoreApplicationTests.java
...a/com/tykj/workflowcore/WorkflowCoreApplicationTests.java
+15
-0
没有找到文件。
pom.xml
浏览文件 @
dbbbf9cc
...
@@ -111,36 +111,30 @@
...
@@ -111,36 +111,30 @@
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-cache
</artifactId>
<artifactId>
spring-boot-starter-cache
</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>
org.jetbrains
</groupId>
<artifactId>
annotations
</artifactId>
<version>
RELEASE
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
<resources
>
<!-- <resources>--
>
<resource
>
<!-- <resource>--
>
<directory>
src/main/java
</directory
>
<!-- <directory>src/main/java</directory>--
>
<includes
>
<!-- <includes>--
>
<include>
**/*
</include
>
<!-- <include>**/*</include>--
>
</includes
>
<!-- </includes>--
>
<excludes
>
<!-- <excludes>--
>
<exclude>
**/.svn/*
</exclude
>
<!-- <exclude>**/.svn/*</exclude>--
>
</excludes
>
<!-- </excludes>--
>
<filtering>
false
</filtering
>
<!-- <filtering>false</filtering>--
>
</resource
>
<!-- </resource>--
>
<resource
>
<!-- <resource>--
>
<directory>
${project.basedir}/src/main/resources
</directory
>
<!-- <directory>${project.basedir}/src/main/resources</directory>--
>
<targetPath>
META-INF/resources/
</targetPath
>
<!-- <targetPath>META-INF/resources/</targetPath>--
>
</resource
>
<!-- </resource>--
>
</resources
>
<!-- </resources>--
>
<plugins>
<plugins>
<!-- <plugin>--
>
<plugin
>
<!-- <groupId>org.springframework.boot</groupId>--
>
<groupId>
org.springframework.boot
</groupId
>
<!-- <artifactId>spring-boot-maven-plugin</artifactId>--
>
<artifactId>
spring-boot-maven-plugin
</artifactId
>
<!-- </plugin>--
>
</plugin
>
<plugin>
<plugin>
<artifactId>
maven-surefire-plugin
</artifactId>
<artifactId>
maven-surefire-plugin
</artifactId>
...
...
src/main/java/com/tykj/workflowcore/model_layer/dao/ColumnInfoDao.java
浏览文件 @
dbbbf9cc
...
@@ -4,6 +4,8 @@ package com.tykj.workflowcore.model_layer.dao;
...
@@ -4,6 +4,8 @@ package com.tykj.workflowcore.model_layer.dao;
import
com.tykj.workflowcore.model_layer.entity.ColumnInfo
;
import
com.tykj.workflowcore.model_layer.entity.ColumnInfo
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.data.jpa.repository.Modifying
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
import
java.util.List
;
...
@@ -21,4 +23,12 @@ public interface ColumnInfoDao extends JpaRepository<ColumnInfo, Integer>, JpaSp
...
@@ -21,4 +23,12 @@ public interface ColumnInfoDao extends JpaRepository<ColumnInfo, Integer>, JpaSp
* @return
* @return
*/
*/
List
<
ColumnInfo
>
findAllByDbId
(
int
id
);
List
<
ColumnInfo
>
findAllByDbId
(
int
id
);
/**
* 根据dbID删除
* @param id
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Modifying
void
deleteAllByDbId
(
Integer
id
);
}
}
src/main/java/com/tykj/workflowcore/model_layer/dao/TableInfoDao.java
浏览文件 @
dbbbf9cc
...
@@ -4,6 +4,10 @@ package com.tykj.workflowcore.model_layer.dao;
...
@@ -4,6 +4,10 @@ package com.tykj.workflowcore.model_layer.dao;
import
com.tykj.workflowcore.model_layer.entity.TableInfo
;
import
com.tykj.workflowcore.model_layer.entity.TableInfo
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.data.jpa.repository.Modifying
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
/**
/**
* @ClassName TableInfoDao
* @ClassName TableInfoDao
...
@@ -19,4 +23,14 @@ public interface TableInfoDao extends JpaRepository<TableInfo, Integer>, JpaSpec
...
@@ -19,4 +23,14 @@ public interface TableInfoDao extends JpaRepository<TableInfo, Integer>, JpaSpec
* @return
* @return
*/
*/
TableInfo
findByModelName
(
String
name
);
TableInfo
findByModelName
(
String
name
);
/**
* 删除modelType是0的数据
* @param type
* @return
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Modifying
List
<
TableInfo
>
deleteAllByModelType
(
Integer
type
);
}
}
src/main/java/com/tykj/workflowcore/model_layer/entity/ColumnInfo.java
浏览文件 @
dbbbf9cc
...
@@ -25,8 +25,6 @@ import java.io.Serializable;
...
@@ -25,8 +25,6 @@ import java.io.Serializable;
@Data
@Data
@NoArgsConstructor
@NoArgsConstructor
@Entity
@Entity
@SQLDelete
(
sql
=
"update column_info set deleted = 1 where id = ?"
)
@Where
(
clause
=
"deleted = 0"
)
public
class
ColumnInfo
extends
BaseEntity
{
public
class
ColumnInfo
extends
BaseEntity
{
/**
/**
...
...
src/main/java/com/tykj/workflowcore/model_layer/service/impl/AggregationImpl.java
浏览文件 @
dbbbf9cc
...
@@ -48,7 +48,7 @@ public class AggregationImpl implements AggregationService {
...
@@ -48,7 +48,7 @@ public class AggregationImpl implements AggregationService {
SessionUtil
sessionUtil
;
SessionUtil
sessionUtil
;
@Override
@Override
@Transactional
@Transactional
(
rollbackOn
=
Exception
.
class
)
public
void
addAggregation
(
AggregationVO
aggregationVO
)
{
public
void
addAggregation
(
AggregationVO
aggregationVO
)
{
Document
mainTableDocument
;
Document
mainTableDocument
;
//获取主表XML
//获取主表XML
...
...
src/main/java/com/tykj/workflowcore/model_layer/service/impl/ModelImpl.java
浏览文件 @
dbbbf9cc
...
@@ -11,7 +11,7 @@ import com.tykj.workflowcore.model_layer.entity.vo.*;
...
@@ -11,7 +11,7 @@ import com.tykj.workflowcore.model_layer.entity.vo.*;
import
com.tykj.workflowcore.model_layer.entity.*
;
import
com.tykj.workflowcore.model_layer.entity.*
;
import
com.tykj.workflowcore.model_layer.myEnum.ModelType
;
import
com.tykj.workflowcore.model_layer.myEnum.ModelType
;
import
com.tykj.workflowcore.model_layer.service.ModelService
;
import
com.tykj.workflowcore.model_layer.service.ModelService
;
import
com.tykj.workflowcore.model_layer.utils.CreateTableUtil
;
import
com.tykj.workflowcore.model_layer.utils.SessionUtil
;
import
com.tykj.workflowcore.model_layer.utils.SessionUtil
;
import
com.tykj.workflowcore.model_layer.utils.SqlUtil
;
import
com.tykj.workflowcore.model_layer.utils.SqlUtil
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
...
@@ -268,6 +268,8 @@ public class ModelImpl implements ModelService {
...
@@ -268,6 +268,8 @@ public class ModelImpl implements ModelService {
*/
*/
@Override
@Override
public
void
swaggerScan
(
List
<
Class
<?>>
classList
)
{
public
void
swaggerScan
(
List
<
Class
<?>>
classList
)
{
/* 扫描前先删除原数据*/
delTableAndColumnInfo
();
for
(
Class
<?>
aClass
:
classList
)
{
for
(
Class
<?>
aClass
:
classList
)
{
//不扫描自己
//不扫描自己
TableInfo
tableInfo
=
new
TableInfo
();
TableInfo
tableInfo
=
new
TableInfo
();
...
@@ -279,12 +281,11 @@ public class ModelImpl implements ModelService {
...
@@ -279,12 +281,11 @@ public class ModelImpl implements ModelService {
if
(
aClass
.
isAnnotationPresent
(
Table
.
class
))
{
if
(
aClass
.
isAnnotationPresent
(
Table
.
class
))
{
Table
table
=
aClass
.
getAnnotation
(
Table
.
class
);
Table
table
=
aClass
.
getAnnotation
(
Table
.
class
);
if
(!
""
.
equals
(
table
.
name
())
&&
table
.
name
()
!=
null
)
{
if
(!
""
.
equals
(
table
.
name
())
&&
table
.
name
()
!=
null
)
{
realName
=
table
.
name
();
realName
=
table
.
name
();
}
}
}
}
else
{
else
{
String
className
=
getClassName
(
aClass
.
toString
());
String
className
=
getClassName
(
aClass
.
toString
());
realName
=
className
;
realName
=
className
;
}
}
tableVO
.
setModelName
(
realName
);
tableVO
.
setModelName
(
realName
);
//获得类中文描述
//获得类中文描述
...
@@ -308,7 +309,7 @@ public class ModelImpl implements ModelService {
...
@@ -308,7 +309,7 @@ public class ModelImpl implements ModelService {
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
();
if
(
declaredField
.
isAnnotationPresent
(
Transient
.
class
)){
if
(
declaredField
.
isAnnotationPresent
(
Transient
.
class
))
{
continue
;
continue
;
}
}
//获得类型
//获得类型
...
@@ -604,4 +605,15 @@ public class ModelImpl implements ModelService {
...
@@ -604,4 +605,15 @@ public class ModelImpl implements ModelService {
tableAndColumnInfoVO
.
setColumnInfos
(
allColumnInfos
);
tableAndColumnInfoVO
.
setColumnInfos
(
allColumnInfos
);
return
tableAndColumnInfoVO
;
return
tableAndColumnInfoVO
;
}
}
public
void
delTableAndColumnInfo
()
{
/* 先删除上次扫描的基础类型*/
List
<
TableInfo
>
tableInfos
=
tableInfoDao
.
deleteAllByModelType
(
ModelType
.
BASICS
);
for
(
TableInfo
tableInfo
:
tableInfos
)
{
/*删除columnInfo*/
columnInfoDao
.
deleteAllByDbId
(
tableInfo
.
getId
());
}
}
}
}
src/main/resources/application.yml
浏览文件 @
dbbbf9cc
...
@@ -2,7 +2,7 @@ spring:
...
@@ -2,7 +2,7 @@ spring:
datasource
:
datasource
:
username
:
root
username
:
root
password
:
Huang123+
password
:
Huang123+
url
:
jdbc:mysql://47.106.142.73:3306/www
3
?useSSL=false&serverTimezone=GMT%2b8&characterEncoding=utf-8&nullCatalogMeansCurrent=true
url
:
jdbc:mysql://47.106.142.73:3306/www
_hxh
?useSSL=false&serverTimezone=GMT%2b8&characterEncoding=utf-8&nullCatalogMeansCurrent=true
driver-class-name
:
com.mysql.cj.jdbc.Driver
driver-class-name
:
com.mysql.cj.jdbc.Driver
jpa
:
jpa
:
show-sql
:
true
show-sql
:
true
...
...
src/main/test/java/com/tykj/workflowcore/WorkflowCoreApplicationTests.java
浏览文件 @
dbbbf9cc
...
@@ -3,8 +3,10 @@ package com.tykj.workflowcore;
...
@@ -3,8 +3,10 @@ package com.tykj.workflowcore;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.tykj.workflowcore.model_layer.controller.ModelController
;
import
com.tykj.workflowcore.model_layer.controller.ModelController
;
import
com.tykj.workflowcore.model_layer.dao.ColumnInfoDao
;
import
com.tykj.workflowcore.model_layer.dao.TableInfoDao
;
import
com.tykj.workflowcore.model_layer.dao.TableInfoDao
;
import
com.tykj.workflowcore.model_layer.dao.TableInfoExDao
;
import
com.tykj.workflowcore.model_layer.dao.TableInfoExDao
;
import
com.tykj.workflowcore.model_layer.entity.ColumnInfo
;
import
com.tykj.workflowcore.model_layer.entity.TableInfo
;
import
com.tykj.workflowcore.model_layer.entity.TableInfo
;
import
com.tykj.workflowcore.model_layer.entity.vo.TableAndColumnInfoVO
;
import
com.tykj.workflowcore.model_layer.entity.vo.TableAndColumnInfoVO
;
import
com.tykj.workflowcore.model_layer.myEnum.ModelType
;
import
com.tykj.workflowcore.model_layer.myEnum.ModelType
;
...
@@ -88,6 +90,9 @@ class WorkflowCoreApplicationTests {
...
@@ -88,6 +90,9 @@ class WorkflowCoreApplicationTests {
@Autowired
@Autowired
TableInfoExDao
tableInfoExDao
;
TableInfoExDao
tableInfoExDao
;
@Autowired
ColumnInfoDao
columnInfoDao
;
@Before
(
""
)
@Before
(
""
)
public
void
setUp
()
{
public
void
setUp
()
{
mockMvc
=
MockMvcBuilders
.
standaloneSetup
(
modelController
).
build
();
mockMvc
=
MockMvcBuilders
.
standaloneSetup
(
modelController
).
build
();
...
@@ -489,4 +494,14 @@ class WorkflowCoreApplicationTests {
...
@@ -489,4 +494,14 @@ class WorkflowCoreApplicationTests {
// System.out.println(jsonExample);
// System.out.println(jsonExample);
StringUtils
.
hasLength
(
xml
);
StringUtils
.
hasLength
(
xml
);
}
}
@Test
public
void
testDelete
(){
List
<
TableInfo
>
tableInfos
=
tableInfoDao
.
deleteAllByModelType
(
0
);
for
(
TableInfo
tableInfo
:
tableInfos
)
{
System
.
out
.
println
(
tableInfo
.
getId
());
columnInfoDao
.
deleteAllByDbId
(
tableInfo
.
getId
());
}
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论