Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
ee3c99e1
提交
ee3c99e1
authored
5月 25, 2021
作者:
junjie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(backend):关联视图表、字段重复关联校验 测试
上级
3e6caadf
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
36 行增加
和
4 行删除
+36
-4
DataSetTableUnionService.java
...io/dataease/service/dataset/DataSetTableUnionService.java
+29
-0
messages_en_US.properties
backend/src/main/resources/i18n/messages_en_US.properties
+3
-2
messages_zh_CN.properties
backend/src/main/resources/i18n/messages_zh_CN.properties
+1
-0
messages_zh_TW.properties
backend/src/main/resources/i18n/messages_zh_TW.properties
+3
-2
没有找到文件。
backend/src/main/java/io/dataease/service/dataset/DataSetTableUnionService.java
浏览文件 @
ee3c99e1
package
io
.
dataease
.
service
.
dataset
;
import
io.dataease.base.domain.DatasetTableUnion
;
import
io.dataease.base.domain.DatasetTableUnionExample
;
import
io.dataease.base.mapper.DatasetTableUnionMapper
;
import
io.dataease.base.mapper.ext.ExtDatasetTableUnionMapper
;
import
io.dataease.commons.utils.AuthUtils
;
import
io.dataease.dto.dataset.DataSetTableUnionDTO
;
import
io.dataease.i18n.Translator
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -28,6 +31,7 @@ public class DataSetTableUnionService {
private
ExtDatasetTableUnionMapper
extDatasetTableUnionMapper
;
public
DatasetTableUnion
save
(
DatasetTableUnion
datasetTableUnion
)
{
checkUnion
(
datasetTableUnion
);
if
(
StringUtils
.
isEmpty
(
datasetTableUnion
.
getId
()))
{
datasetTableUnion
.
setId
(
UUID
.
randomUUID
().
toString
());
datasetTableUnion
.
setCreateBy
(
AuthUtils
.
getUser
().
getUsername
());
...
...
@@ -71,4 +75,29 @@ public class DataSetTableUnionService {
sourceList
.
sort
(
Comparator
.
comparing
(
DatasetTableUnion:
:
getCreateTime
));
return
sourceList
;
}
private
void
checkUnion
(
DatasetTableUnion
datasetTableUnion
)
{
DatasetTableUnionExample
datasetTableUnionExample
=
new
DatasetTableUnionExample
();
DatasetTableUnionExample
.
Criteria
criteria
=
datasetTableUnionExample
.
createCriteria
();
if
(
StringUtils
.
isNotEmpty
(
datasetTableUnion
.
getId
()))
{
criteria
.
andIdNotEqualTo
(
datasetTableUnion
.
getId
());
}
criteria
.
andSourceTableIdEqualTo
(
datasetTableUnion
.
getSourceTableId
());
criteria
.
andSourceTableFieldIdEqualTo
(
datasetTableUnion
.
getSourceTableFieldId
());
criteria
.
andTargetTableIdEqualTo
(
datasetTableUnion
.
getTargetTableId
());
criteria
.
andTargetTableFieldIdEqualTo
(
datasetTableUnion
.
getTargetTableFieldId
());
List
<
DatasetTableUnion
>
sourceResult
=
datasetTableUnionMapper
.
selectByExample
(
datasetTableUnionExample
);
datasetTableUnionExample
.
clear
();
if
(
StringUtils
.
isNotEmpty
(
datasetTableUnion
.
getId
()))
{
criteria
.
andIdNotEqualTo
(
datasetTableUnion
.
getId
());
}
criteria
.
andSourceTableIdEqualTo
(
datasetTableUnion
.
getTargetTableId
());
criteria
.
andSourceTableFieldIdEqualTo
(
datasetTableUnion
.
getTargetTableFieldId
());
criteria
.
andTargetTableIdEqualTo
(
datasetTableUnion
.
getSourceTableId
());
criteria
.
andTargetTableFieldIdEqualTo
(
datasetTableUnion
.
getSourceTableFieldId
());
List
<
DatasetTableUnion
>
targetResult
=
datasetTableUnionMapper
.
selectByExample
(
datasetTableUnionExample
);
if
(
CollectionUtils
.
isNotEmpty
(
sourceResult
)
||
CollectionUtils
.
isNotEmpty
(
targetResult
))
{
throw
new
RuntimeException
(
Translator
.
get
(
"i18n_union_already_exists"
));
}
}
}
backend/src/main/resources/i18n/messages_en_US.properties
浏览文件 @
ee3c99e1
...
...
@@ -235,4 +235,5 @@ i18n_cron_expression_error=Cron expression error
i18n_same_folder_can_not_repeat
=
Same Folder Can Not Repeat
i18n_default_panel
=
Default Panel
i18n_panel_list
=
Panel List
i18n_processing_data
=
Processing data now, Refresh later
\ No newline at end of file
i18n_processing_data
=
Processing data now, Refresh later
i18n_union_already_exists
=
Union relation already exists
\ No newline at end of file
backend/src/main/resources/i18n/messages_zh_CN.properties
浏览文件 @
ee3c99e1
...
...
@@ -237,3 +237,4 @@ i18n_same_folder_can_not_repeat=相同的目录下名称不能重复
i18n_default_panel
=
默认仪表盘
i18n_panel_list
=
仪表盘列表
i18n_processing_data
=
正在处理数据,稍后刷新
i18n_union_already_exists
=
关联关系已存在
backend/src/main/resources/i18n/messages_zh_TW.properties
浏览文件 @
ee3c99e1
...
...
@@ -236,4 +236,5 @@ i18n_cron_expression_error=Cron表達式校驗錯誤
i18n_same_folder_can_not_repeat
=
相同的目录下名称不能重复
i18n_default_panel
=
默认仪表盘
i18n_panel_list
=
仪表盘列表
i18n_processing_data
=
正在處理數據,稍後刷新
\ No newline at end of file
i18n_processing_data
=
正在處理數據,稍後刷新
i18n_union_already_exists
=
關聯關系已存在
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论