Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
workflow2
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
黄夏豪
workflow2
Commits
6186bd96
提交
6186bd96
authored
9月 10, 2021
作者:
黄承天
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[模型模块]根据processKey查询接口 添加了Column属性
上级
450de053
显示空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
39 行增加
和
13 行删除
+39
-13
TableInfoExController.java
.../workflowcore/model/controller/TableInfoExController.java
+1
-1
Bind.java
src/main/java/com/tykj/workflowcore/model/entity/Bind.java
+5
-1
BindRepository.java
...om/tykj/workflowcore/model/repository/BindRepository.java
+6
-1
ColumnInfoRepository.java
...j/workflowcore/model/repository/ColumnInfoRepository.java
+2
-0
QuoteRepository.java
...m/tykj/workflowcore/model/repository/QuoteRepository.java
+2
-0
TableInfoExService.java
...m/tykj/workflowcore/model/service/TableInfoExService.java
+9
-3
TableInfoService.java
...com/tykj/workflowcore/model/service/TableInfoService.java
+14
-7
没有找到文件。
src/main/java/com/tykj/workflowcore/model/controller/TableInfoExController.java
浏览文件 @
6186bd96
...
...
@@ -31,7 +31,7 @@ public class TableInfoExController {
@ApiOperation
(
value
=
"修改聚合模型"
)
@PutMapping
public
ResponseEntity
update
(
@RequestBody
TableInfoEx
tableInfoEx
)
{
tableInfoExService
.
update
(
tableInfoEx
);
tableInfoExService
.
update
(
tableInfoEx
);
return
ResponseEntity
.
ok
(
ImmutableMap
.
of
(
"message"
,
"修改成功"
));
}
...
...
src/main/java/com/tykj/workflowcore/model/entity/Bind.java
浏览文件 @
6186bd96
...
...
@@ -36,13 +36,17 @@ public class Bind {
@ApiModelProperty
(
value
=
"是否为复数 true/false"
,
position
=
5
)
private
Boolean
isComplex
;
@ApiModelProperty
(
value
=
"字段信息"
,
readOnly
=
true
,
position
=
7
)
@Transient
private
List
<
ColumnInfo
>
columnInfos
;
@JsonIgnore
private
Integer
tableInfoExId
;
@JsonIgnore
private
Integer
parentId
;
@ApiModelProperty
(
value
=
"下级基础对象的绑定信息"
,
position
=
4
)
@ApiModelProperty
(
value
=
"下级基础对象的绑定信息"
,
position
=
8
)
@Transient
private
List
<
Bind
>
children
;
...
...
src/main/java/com/tykj/workflowcore/model/repository/BindRepository.java
浏览文件 @
6186bd96
...
...
@@ -3,6 +3,7 @@ package com.tykj.workflowcore.model.repository;
import
com.tykj.workflowcore.model.entity.Bind
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
javax.transaction.Transactional
;
import
java.util.List
;
public
interface
BindRepository
extends
JpaRepository
<
Bind
,
Integer
>
{
...
...
@@ -13,5 +14,9 @@ public interface BindRepository extends JpaRepository<Bind, Integer> {
List
<
Bind
>
findByName
(
String
name
);
void
deleteByTableInfoExId
(
Integer
tableInfoExId
);
@Transactional
void
deleteAllByTableInfoExId
(
Integer
tableInfoExId
);
boolean
existsByName
(
String
name
);
}
src/main/java/com/tykj/workflowcore/model/repository/ColumnInfoRepository.java
浏览文件 @
6186bd96
...
...
@@ -3,12 +3,14 @@ package com.tykj.workflowcore.model.repository;
import
com.tykj.workflowcore.model.entity.ColumnInfo
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
javax.transaction.Transactional
;
import
java.util.List
;
public
interface
ColumnInfoRepository
extends
JpaRepository
<
ColumnInfo
,
Integer
>
{
List
<
ColumnInfo
>
findByTableInfoId
(
Integer
tableInfoId
);
@Transactional
void
deleteAllByTableInfoId
(
Integer
tableInfoId
);
}
src/main/java/com/tykj/workflowcore/model/repository/QuoteRepository.java
浏览文件 @
6186bd96
...
...
@@ -3,12 +3,14 @@ package com.tykj.workflowcore.model.repository;
import
com.tykj.workflowcore.model.entity.Quote
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
javax.transaction.Transactional
;
import
java.util.List
;
public
interface
QuoteRepository
extends
JpaRepository
<
Quote
,
Integer
>
{
List
<
Quote
>
findByColumnInfoId
(
Integer
columnInfoId
);
@Transactional
void
deleteAllByColumnInfoId
(
Integer
columnInfoId
);
}
src/main/java/com/tykj/workflowcore/model/service/TableInfoExService.java
浏览文件 @
6186bd96
...
...
@@ -34,6 +34,7 @@ public class TableInfoExService {
TableInfoService
tableInfoService
;
@Autowired
FormPageService
formPageService
;
public
void
save
(
TableInfoEx
tableInfoEx
)
{
//数据检查
boolean
exists
=
tableInfoExRepository
.
existsByName
(
tableInfoEx
.
getName
());
...
...
@@ -94,7 +95,7 @@ public class TableInfoExService {
List
<
TableInfoEx
>
tableInfoExes
=
tableInfoExRepository
.
findByName
(
name
);
for
(
TableInfoEx
tableInfoEx
:
tableInfoExes
)
{
Integer
tableInfoExId
=
tableInfoEx
.
getId
();
bindRepository
.
deleteByTableInfoExId
(
tableInfoExId
);
bindRepository
.
delete
All
ByTableInfoExId
(
tableInfoExId
);
tableInfoExRepository
.
deleteById
(
tableInfoExId
);
}
}
...
...
@@ -206,15 +207,20 @@ public class TableInfoExService {
private
TableInfoEx
getBinds
(
TableInfoEx
tableInfoEx
)
{
List
<
Bind
>
binds
=
bindRepository
.
findByTableInfoExIdAndParentId
(
tableInfoEx
.
getId
(),
null
).
stream
()
.
map
(
this
::
getChildren
)
.
map
(
bind
->
bind
.
setColumnInfos
(
tableInfoService
.
findLastVersion
(
bind
.
getName
()).
getColumnInfos
()))
.
collect
(
Collectors
.
toList
());
tableInfoEx
.
setBinds
(
binds
);
return
tableInfoEx
;
}
private
Bind
getChildren
(
Bind
bind
)
{
List
<
Bind
>
children
=
bindRepository
.
findByTableInfoExIdAndParentId
(
bind
.
getTableInfoExId
(),
bind
.
getId
()).
stream
()
.
map
(
child
->
child
.
setChildren
(
Collections
.
emptyList
()))
List
<
Bind
>
children
=
bindRepository
.
findByTableInfoExIdAndParentId
(
bind
.
getTableInfoExId
(),
bind
.
getId
());
if
(!
children
.
isEmpty
())
{
children
=
children
.
stream
()
.
map
(
this
::
getChildren
)
.
map
(
child
->
child
.
setColumnInfos
(
tableInfoService
.
findLastVersion
(
child
.
getName
()).
getColumnInfos
()))
.
collect
(
Collectors
.
toList
());
}
bind
.
setChildren
(
children
);
return
bind
;
}
...
...
src/main/java/com/tykj/workflowcore/model/service/TableInfoService.java
浏览文件 @
6186bd96
...
...
@@ -4,6 +4,7 @@ import com.tykj.workflowcore.base.result.ApiException;
import
com.tykj.workflowcore.model.entity.ColumnInfo
;
import
com.tykj.workflowcore.model.entity.Quote
;
import
com.tykj.workflowcore.model.entity.TableInfo
;
import
com.tykj.workflowcore.model.repository.BindRepository
;
import
com.tykj.workflowcore.model.repository.ColumnInfoRepository
;
import
com.tykj.workflowcore.model.repository.QuoteRepository
;
import
com.tykj.workflowcore.model.repository.TableInfoRepository
;
...
...
@@ -37,6 +38,8 @@ public class TableInfoService {
private
QuoteRepository
quoteRepository
;
@Autowired
private
FormPageService
formPageService
;
@Autowired
private
BindRepository
bindRepository
;
public
void
save
(
TableInfo
tableInfo
)
{
//数据检查
...
...
@@ -102,11 +105,14 @@ public class TableInfoService {
.
map
(
TableInfo:
:
getName
)
.
distinct
()
.
map
(
this
::
findLastVersion
)
.
map
(
this
::
getColumnInfos
)
.
collect
(
Collectors
.
toList
());
}
public
void
deleteByName
(
String
name
)
{
boolean
hasBind
=
bindRepository
.
existsByName
(
name
);
if
(
hasBind
){
throw
new
RuntimeException
(
"该模型已在聚合模型中绑定"
);
}
List
<
TableInfo
>
tableInfos
=
tableInfoRepository
.
findByName
(
name
);
for
(
TableInfo
tableInfo
:
tableInfos
)
{
Integer
tableInfoId
=
tableInfo
.
getId
();
...
...
@@ -120,6 +126,13 @@ public class TableInfoService {
}
}
public
TableInfo
findLastVersion
(
String
name
)
{
return
tableInfoRepository
.
findByName
(
name
).
stream
()
.
max
(
Comparator
.
comparingInt
(
TableInfo:
:
getVersion
))
.
map
(
this
::
getColumnInfos
)
.
orElseThrow
(()
->
new
RuntimeException
(
"查询失败"
));
}
//-----------------------------------------------------------------------------//
private
void
saveColumnInfo
(
ColumnInfo
columnInfo
,
Integer
tableInfoId
)
{
...
...
@@ -143,12 +156,6 @@ public class TableInfoService {
return
tableInfo
;
}
private
TableInfo
findLastVersion
(
String
name
)
{
return
tableInfoRepository
.
findByName
(
name
).
stream
()
.
max
(
Comparator
.
comparingInt
(
TableInfo:
:
getVersion
))
.
orElseThrow
(()
->
new
RuntimeException
(
"查询失败"
));
}
private
ColumnInfo
getQuotes
(
ColumnInfo
columnInfo
)
{
List
<
Quote
>
quotes
=
quoteRepository
.
findByColumnInfoId
(
columnInfo
.
getId
());
columnInfo
.
setQuotes
(
quotes
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论