Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
workflow
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
2
议题
2
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
黄夏豪
workflow
Commits
4f9b066e
提交
4f9b066e
authored
4月 06, 2021
作者:
ww1xhqc
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[数据模型] 新增聚合对象接口。
上级
1eeae3cc
显示空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
131 行增加
和
28 行删除
+131
-28
pom.xml
pom.xml
+6
-0
TableInfoExController.java
...lowcore/model_layer/controller/TableInfoExController.java
+21
-0
AggregationRelationshipDao.java
...kflowcore/model_layer/dao/AggregationRelationshipDao.java
+4
-3
Aggregation.java
...com/tykj/workflowcore/model_layer/entity/Aggregation.java
+2
-2
AggregationVO.java
...ykj/workflowcore/model_layer/entity/vo/AggregationVO.java
+3
-2
AggregationService.java
.../workflowcore/model_layer/service/AggregationService.java
+2
-0
TableInfoExService.java
.../workflowcore/model_layer/service/TableInfoExService.java
+27
-0
AggregationImpl.java
...orkflowcore/model_layer/service/impl/AggregationImpl.java
+15
-15
ModelImpl.java
...tykj/workflowcore/model_layer/service/impl/ModelImpl.java
+4
-2
TableInfoExImpl.java
...orkflowcore/model_layer/service/impl/TableInfoExImpl.java
+41
-0
AggregationUtil.java
.../tykj/workflowcore/model_layer/utils/AggregationUtil.java
+5
-4
WorkflowCoreApplicationTests.java
...a/com/tykj/workflowcore/WorkflowCoreApplicationTests.java
+1
-0
没有找到文件。
pom.xml
浏览文件 @
4f9b066e
...
@@ -115,6 +115,12 @@
...
@@ -115,6 +115,12 @@
<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>
...
...
src/main/java/com/tykj/workflowcore/model_layer/controller/TableInfoExController.java
0 → 100644
浏览文件 @
4f9b066e
package
com
.
tykj
.
workflowcore
.
model_layer
.
controller
;
import
com.tykj.workflowcore.model_layer.service.TableInfoExService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* @ClassName TableInfoExController
* @Description TODO
* @Author WWW
* @Date 2021/4/6 10:37
* @Version 1.0
*/
@RestController
public
class
TableInfoExController
{
@Autowired
TableInfoExService
tableInfoExService
;
}
src/main/java/com/tykj/workflowcore/model_layer/dao/AggregationRelationshipDao.java
浏览文件 @
4f9b066e
package
com
.
tykj
.
workflowcore
.
model_layer
.
dao
;
package
com
.
tykj
.
workflowcore
.
model_layer
.
dao
;
import
com.tykj.workflowcore.model_layer.entity.AggregationRelationship
;
import
com.tykj.workflowcore.model_layer.entity.Aggregation
;
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
;
...
@@ -12,6 +13,6 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
...
@@ -12,6 +13,6 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
* @Date 2021/4/2 10:34
* @Date 2021/4/2 10:34
* @Version 1.0
* @Version 1.0
*/
*/
public
interface
AggregationRelationshipDao
extends
JpaRepository
<
Aggregation
Relationship
,
Integer
>,
JpaSpecificationExecutor
<
AggregationRelationship
>
{
public
interface
AggregationRelationshipDao
extends
JpaRepository
<
Aggregation
,
Integer
>,
JpaSpecificationExecutor
<
Aggregation
>
{
}
}
src/main/java/com/tykj/workflowcore/model_layer/entity/Aggregation
Relationship
.java
→
src/main/java/com/tykj/workflowcore/model_layer/entity/Aggregation.java
浏览文件 @
4f9b066e
...
@@ -23,12 +23,12 @@ import javax.persistence.Entity;
...
@@ -23,12 +23,12 @@ import javax.persistence.Entity;
@Entity
@Entity
@SQLDelete
(
sql
=
"update column_info set deleted = 1 where id = ?"
)
@SQLDelete
(
sql
=
"update column_info set deleted = 1 where id = ?"
)
@Where
(
clause
=
"deleted = 0"
)
@Where
(
clause
=
"deleted = 0"
)
public
class
Aggregation
Relationship
extends
BaseEntity
{
public
class
Aggregation
extends
BaseEntity
{
@ApiModelProperty
(
"聚合对象ID"
)
@ApiModelProperty
(
"聚合对象ID"
)
private
Integer
tableInfoExId
;
private
Integer
tableInfoExId
;
@ApiModelProperty
(
"
附
表id"
)
@ApiModelProperty
(
"
副
表id"
)
private
Integer
sideTableId
;
private
Integer
sideTableId
;
@ApiModelProperty
(
"聚合对象关系"
)
@ApiModelProperty
(
"聚合对象关系"
)
...
...
src/main/java/com/tykj/workflowcore/model_layer/entity/vo/AggregationVO.java
浏览文件 @
4f9b066e
package
com
.
tykj
.
workflowcore
.
model_layer
.
entity
.
vo
;
package
com
.
tykj
.
workflowcore
.
model_layer
.
entity
.
vo
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.BeanUtil
;
import
com.tykj.workflowcore.model_layer.entity.AggregationRelationship
;
import
com.tykj.workflowcore.model_layer.entity.Aggregation
;
import
com.tykj.workflowcore.model_layer.entity.TableInfoEx
;
import
com.tykj.workflowcore.model_layer.entity.TableInfoEx
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
...
@@ -30,7 +31,7 @@ public class AggregationVO {
...
@@ -30,7 +31,7 @@ public class AggregationVO {
private
Integer
mainTableId
;
private
Integer
mainTableId
;
@ApiModelProperty
(
"关系集合"
)
@ApiModelProperty
(
"关系集合"
)
private
List
<
Aggregation
Relationship
>
lists
;
private
List
<
Aggregation
>
lists
;
public
TableInfoEx
getTableInfoEx
(){
public
TableInfoEx
getTableInfoEx
(){
TableInfoEx
tableInfoEx
=
new
TableInfoEx
();
TableInfoEx
tableInfoEx
=
new
TableInfoEx
();
...
...
src/main/java/com/tykj/workflowcore/model_layer/service/AggregationService.java
浏览文件 @
4f9b066e
...
@@ -4,6 +4,8 @@ import com.tykj.workflowcore.model_layer.entity.TableInfoEx;
...
@@ -4,6 +4,8 @@ import com.tykj.workflowcore.model_layer.entity.TableInfoEx;
import
com.tykj.workflowcore.model_layer.entity.vo.AggregationVO
;
import
com.tykj.workflowcore.model_layer.entity.vo.AggregationVO
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
/**
* @ClassName Aggregation
* @ClassName Aggregation
* @Description TODO
* @Description TODO
...
...
src/main/java/com/tykj/workflowcore/model_layer/service/TableInfoExService.java
0 → 100644
浏览文件 @
4f9b066e
package
com
.
tykj
.
workflowcore
.
model_layer
.
service
;
import
com.tykj.workflowcore.model_layer.entity.TableInfoEx
;
import
java.util.List
;
/**
* @Author WWW
* @Description
* @Date 14:06 2021/4/6
* @return
**/
public
interface
TableInfoExService
{
/**
* 查询所有
* @return
*/
List
<
TableInfoEx
>
findAll
();
/**
* 根据id获取tableInfoExXML
* @param id
* @return
*/
String
findXml
(
Integer
id
);
}
src/main/java/com/tykj/workflowcore/model_layer/service/impl/AggregationImpl.java
浏览文件 @
4f9b066e
...
@@ -4,7 +4,8 @@ import com.tykj.workflowcore.base.result.ApiException;
...
@@ -4,7 +4,8 @@ import com.tykj.workflowcore.base.result.ApiException;
import
com.tykj.workflowcore.model_layer.dao.AggregationRelationshipDao
;
import
com.tykj.workflowcore.model_layer.dao.AggregationRelationshipDao
;
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.AggregationRelationship
;
import
com.tykj.workflowcore.model_layer.entity.Aggregation
;
import
com.tykj.workflowcore.model_layer.entity.TableInfo
;
import
com.tykj.workflowcore.model_layer.entity.TableInfo
;
import
com.tykj.workflowcore.model_layer.entity.TableInfoEx
;
import
com.tykj.workflowcore.model_layer.entity.TableInfoEx
;
import
com.tykj.workflowcore.model_layer.entity.vo.AggregationVO
;
import
com.tykj.workflowcore.model_layer.entity.vo.AggregationVO
;
...
@@ -15,7 +16,7 @@ import org.dom4j.Document;
...
@@ -15,7 +16,7 @@ import org.dom4j.Document;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.Optional
;
import
java.util.UUID
;
import
java.util.UUID
;
...
@@ -28,6 +29,7 @@ import java.util.UUID;
...
@@ -28,6 +29,7 @@ import java.util.UUID;
*/
*/
@Service
@Service
public
class
AggregationImpl
implements
AggregationService
{
public
class
AggregationImpl
implements
AggregationService
{
@Autowired
@Autowired
TableInfoDao
tableInfoDao
;
TableInfoDao
tableInfoDao
;
@Autowired
@Autowired
...
@@ -51,22 +53,23 @@ public class AggregationImpl implements AggregationService {
...
@@ -51,22 +53,23 @@ public class AggregationImpl implements AggregationService {
// save TableInfoEx (name des mainTableId)
// save TableInfoEx (name des mainTableId)
TableInfoEx
tableInfoEx
=
tableInfoExDao
.
save
(
aggregationVO
.
getTableInfoEx
());
TableInfoEx
tableInfoEx
=
tableInfoExDao
.
save
(
aggregationVO
.
getTableInfoEx
());
// 遍历VO 根据聚合类型 生成对应的 XML 节点 并添加到DOCUMENT中
// 遍历VO 根据聚合类型 生成对应的 XML 节点 并添加到DOCUMENT中
for
(
Aggregation
Relationship
aggregationRelationship
:
aggregationVO
.
getLists
())
{
for
(
Aggregation
aggregationRelationship
:
aggregationVO
.
getLists
())
{
//取出副表的table
i
nfo
//取出副表的table
I
nfo
Optional
<
TableInfo
>
sideTableById
=
tableInfoDao
.
findById
(
aggregationRelationship
.
getSideTableId
());
Optional
<
TableInfo
>
sideTableById
=
tableInfoDao
.
findById
(
aggregationRelationship
.
getSideTableId
());
aggregationRelationship
.
setTableInfoExId
(
tableInfoEx
.
getId
());
aggregationRelationship
.
setTableInfoExId
(
tableInfoEx
.
getId
());
if
(!
sideTableById
.
isPresent
()){
if
(!
sideTableById
.
isPresent
()){
throw
new
ApiException
(
"id为:"
+
aggregationRelationship
.
getSideTableId
()+
"的副表不存在"
);
throw
new
ApiException
(
"id为:"
+
aggregationRelationship
.
getSideTableId
()+
"的副表不存在"
);
}
}
if
(
aggregationRelationship
.
getRelationship
().
equals
(
AggregationType
.
ONE_TO_ONE
)){
if
(
aggregationRelationship
.
getRelationship
().
equals
(
AggregationType
.
ONE_TO_ONE
)){
AggregationUtil
.
addOneToOne
(
aggregationRelationship
.
getSideTableConnectionKey
(),
sideTableById
.
get
().
getModelName
(),
mainTableDocument
);
Document
document
=
AggregationUtil
.
addOneToOne
(
aggregationRelationship
.
getSideTableConnectionKey
(),
sideTableById
.
get
().
getModelName
(),
mainTableDocument
);
tableInfoEx
.
setXml
(
document
.
asXML
());
}
}
if
(
aggregationRelationship
.
getRelationship
().
equals
(
AggregationType
.
ONE_TO_MANY
)){
if
(
aggregationRelationship
.
getRelationship
().
equals
(
AggregationType
.
ONE_TO_MANY
)){
//如果是一对多需要 为 aggregationRelationship 生成连接的KEY
//如果是一对多需要 为 aggregationRelationship 生成连接的KEY
String
mainTableConnectionKey
=
sideTableById
.
get
().
getModelName
()+
"
L
ist"
;
String
mainTableConnectionKey
=
sideTableById
.
get
().
getModelName
()+
"
_l
ist"
;
AggregationUtil
.
addOneToMany
(
sideTableById
.
get
().
getModelName
(),
mainTableConnectionKey
,
aggregationRelationship
.
getSideTableConnectionKey
(),
mainTableDocument
);
Document
document
=
AggregationUtil
.
addOneToMany
(
sideTableById
.
get
().
getModelName
(),
mainTableConnectionKey
,
aggregationRelationship
.
getSideTableConnectionKey
(),
mainTableDocument
);
tableInfoEx
.
setXml
(
document
.
asXML
());
}
}
if
(
aggregationRelationship
.
getRelationship
().
equals
(
AggregationType
.
MANY_TO_MANY
)){
if
(
aggregationRelationship
.
getRelationship
().
equals
(
AggregationType
.
MANY_TO_MANY
)){
//如果是多对多需要 为 aggregationRelationship 生成连接的KEY
//如果是多对多需要 为 aggregationRelationship 生成连接的KEY
...
@@ -75,16 +78,13 @@ public class AggregationImpl implements AggregationService {
...
@@ -75,16 +78,13 @@ public class AggregationImpl implements AggregationService {
aggregationRelationship
.
setMainTableConnectionKey
(
mainTableConnectionKey
);
aggregationRelationship
.
setMainTableConnectionKey
(
mainTableConnectionKey
);
aggregationRelationship
.
setSideTableConnectionKey
(
sideTableConnectionKey
);
aggregationRelationship
.
setSideTableConnectionKey
(
sideTableConnectionKey
);
//如果是多对多需要 为 aggregationRelationship 生成连接的中间表名
//如果是多对多需要 为 aggregationRelationship 生成连接的中间表名
String
C
onnectionTableName
=
mainTableById
.
get
().
getModelName
()+
"_"
+
sideTableById
.
get
().
getModelName
()+
"_"
+
(
UUID
.
randomUUID
().
toString
().
substring
(
0
,
8
));
String
c
onnectionTableName
=
mainTableById
.
get
().
getModelName
()+
"_"
+
sideTableById
.
get
().
getModelName
()+
"_"
+
(
UUID
.
randomUUID
().
toString
().
substring
(
0
,
8
));
aggregationRelationship
.
setConnectionTableName
(
C
onnectionTableName
);
aggregationRelationship
.
setConnectionTableName
(
c
onnectionTableName
);
//Util.addManyToMany
//Util.addManyToMany
AggregationUtil
.
addManyToMany
(
sideTableById
.
get
().
getModelName
(),
C
onnectionTableName
,
mainTableConnectionKey
,
sideTableConnectionKey
,
mainTableDocument
);
Document
document
=
AggregationUtil
.
addManyToMany
(
sideTableById
.
get
().
getModelName
(),
c
onnectionTableName
,
mainTableConnectionKey
,
sideTableConnectionKey
,
mainTableDocument
);
tableInfoEx
.
setXml
(
document
.
asXML
());
}
}
aggregationRelationshipDao
.
save
(
aggregationRelationship
);
aggregationRelationshipDao
.
save
(
aggregationRelationship
);
}
}
}
}
}
}
src/main/java/com/tykj/workflowcore/model_layer/service/impl/ModelImpl.java
浏览文件 @
4f9b066e
...
@@ -222,8 +222,10 @@ public class ModelImpl implements ModelService {
...
@@ -222,8 +222,10 @@ public class ModelImpl implements ModelService {
* @Date 16:17 2021/3/5
* @Date 16:17 2021/3/5
**/
**/
public
void
insertValue
(
String
tableName
,
Map
map
)
{
public
void
insertValue
(
String
tableName
,
Map
map
)
{
// CreateTableUtil createTableUtil = new CreateTableUtil();
/*
// Session newSession = createTableUtil.getSession(entityManagerFactory, xml);
CreateTableUtil createTableUtil = new CreateTableUtil();
Session newSession = createTableUtil.getSession(entityManagerFactory, xml);
*/
Session
newSession
=
sessionUtil
.
getSession
();
Session
newSession
=
sessionUtil
.
getSession
();
...
...
src/main/java/com/tykj/workflowcore/model_layer/service/impl/TableInfoExImpl.java
0 → 100644
浏览文件 @
4f9b066e
package
com
.
tykj
.
workflowcore
.
model_layer
.
service
.
impl
;
import
com.tykj.workflowcore.base.result.ApiException
;
import
com.tykj.workflowcore.model_layer.dao.TableInfoExDao
;
import
com.tykj.workflowcore.model_layer.entity.TableInfoEx
;
import
com.tykj.workflowcore.model_layer.service.TableInfoExService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
sun.rmi.runtime.NewThreadAction
;
import
java.util.List
;
import
java.util.Optional
;
/**
* @ClassName TableInfoExImpl
* @Description TODO
* @Author WWW
* @Date 2021/4/6 9:58
* @Version 1.0
*/
@Service
public
class
TableInfoExImpl
implements
TableInfoExService
{
@Autowired
TableInfoExDao
tableInfoExDao
;
@Override
public
List
<
TableInfoEx
>
findAll
()
{
return
tableInfoExDao
.
findAll
()
;
}
@Override
public
String
findXml
(
Integer
id
)
{
Optional
<
TableInfoEx
>
byId
=
tableInfoExDao
.
findById
(
id
);
if
(
byId
.
isPresent
()){
return
byId
.
get
().
getXml
();
}
throw
new
ApiException
(
"id错误!"
);
}
}
src/main/java/com/tykj/workflowcore/model_layer/utils/AggregationUtil.java
浏览文件 @
4f9b066e
...
@@ -2,14 +2,13 @@ package com.tykj.workflowcore.model_layer.utils;
...
@@ -2,14 +2,13 @@ package com.tykj.workflowcore.model_layer.utils;
import
com.tykj.workflowcore.base.result.ApiException
;
import
com.tykj.workflowcore.base.result.ApiException
;
import
com.tykj.workflowcore.model_layer.myEnum.AggregationType
;
import
com.tykj.workflowcore.model_layer.myEnum.AggregationType
;
import
liquibase.pro.packaged.E
;
import
org.dom4j.Document
;
import
org.dom4j.Document
;
import
org.dom4j.DocumentException
;
import
org.dom4j.DocumentException
;
import
org.dom4j.DocumentHelper
;
import
org.dom4j.DocumentHelper
;
import
org.dom4j.Element
;
import
org.dom4j.Element
;
import
org.springframework.util.StringUtils
;
import
java.util.List
;
/**
/**
* @ClassName AggregationUtil
* @ClassName AggregationUtil
...
@@ -19,6 +18,7 @@ import java.util.List;
...
@@ -19,6 +18,7 @@ import java.util.List;
* @Version 1.0
* @Version 1.0
*/
*/
public
class
AggregationUtil
{
public
class
AggregationUtil
{
//xml工具
public
static
Document
getDocument
(
String
xml
){
public
static
Document
getDocument
(
String
xml
){
try
{
try
{
...
@@ -45,7 +45,7 @@ public class AggregationUtil {
...
@@ -45,7 +45,7 @@ public class AggregationUtil {
}
}
public
static
Document
addOneToMany
(
String
sideTableName
,
String
mainTableConnectionKey
,
String
sideTableConnectionKey
,
Document
document
)
{
public
static
Document
addOneToMany
(
String
sideTableName
,
String
mainTableConnectionKey
,
String
sideTableConnectionKey
,
Document
document
)
{
//创建ELEMTN
//创建ELEM
E
TN
Element
setElement
=
createSetElement
(
mainTableConnectionKey
,
sideTableName
,
""
,
mainTableConnectionKey
,
sideTableConnectionKey
,
AggregationType
.
ONE_TO_MANY
);
Element
setElement
=
createSetElement
(
mainTableConnectionKey
,
sideTableName
,
""
,
mainTableConnectionKey
,
sideTableConnectionKey
,
AggregationType
.
ONE_TO_MANY
);
//创建结束
//创建结束
Element
classElement
=
getNode
(
document
);
Element
classElement
=
getNode
(
document
);
...
@@ -92,6 +92,7 @@ public class AggregationUtil {
...
@@ -92,6 +92,7 @@ public class AggregationUtil {
return
elementSet
;
return
elementSet
;
}
}
// 字符串拼接
// private static String xmlStart = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
// private static String xmlStart = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
// "<!DOCTYPE hibernate-mapping PUBLIC\n" +
// "<!DOCTYPE hibernate-mapping PUBLIC\n" +
// " \"-//Hibernate/Hibernate Mapping DTD 3.0//EN\"\n" +
// " \"-//Hibernate/Hibernate Mapping DTD 3.0//EN\"\n" +
...
...
src/main/test/java/com/tykj/workflowcore/WorkflowCoreApplicationTests.java
浏览文件 @
4f9b066e
...
@@ -431,6 +431,7 @@ class WorkflowCoreApplicationTests {
...
@@ -431,6 +431,7 @@ class WorkflowCoreApplicationTests {
@Test
@Test
public
void
testOldProperty
()
throws
DocumentException
{
public
void
testOldProperty
()
throws
DocumentException
{
TableInfo
stus
=
tableInfoDao
.
findByModelName
(
"stus"
);
TableInfo
stus
=
tableInfoDao
.
findByModelName
(
"stus"
);
String
xml
=
stus
.
getXml
();
String
xml
=
stus
.
getXml
();
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论