Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
jing Tang
Dataease
Commits
b8ab1d74
Commit
b8ab1d74
authored
3 years ago
by
junjie
Browse files
Options
Download
Email Patches
Plain Diff
fix: rollback
parent
aeb35b01
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java
+15
-42
...java/io/dataease/service/dataset/DataSetTableService.java
with
15 additions
and
42 deletions
+15
-42
backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java
+
15
-
42
View file @
b8ab1d74
...
...
@@ -797,35 +797,22 @@ public class DataSetTableService {
String
f
=
field
.
substring
(
0
,
field
.
length
()
-
1
);
StringBuilder
join
=
new
StringBuilder
();
List
<
DataSetTableUnionDTO
>
unions
=
new
ArrayList
<>();
for
(
DataTableInfoCustomUnion
dataTableInfoCustomUnion
:
dataTableInfoDTO
.
getList
())
{
for
(
DataSetTableUnionDTO
dto
:
list
)
{
// 被关联表和自助数据集的表相等
if
(
StringUtils
.
equals
(
dto
.
getTargetTableId
(),
dataTableInfoCustomUnion
.
getTableId
()))
{
unions
.
add
(
dto
);
}
}
}
if
(
CollectionUtils
.
isNotEmpty
(
unions
))
{
for
(
int
i
=
0
;
i
<
unions
.
size
();
i
++)
{
DataSetTableUnionDTO
dto
=
unions
.
get
(
i
);
DatasetTableField
sourceField
=
dataSetTableFieldsService
.
get
(
dto
.
getSourceTableFieldId
());
DatasetTableField
targetField
=
dataSetTableFieldsService
.
get
(
dto
.
getTargetTableFieldId
());
if
(
ObjectUtils
.
isEmpty
(
sourceField
)
||
ObjectUtils
.
isEmpty
(
targetField
))
{
DEException
.
throwException
(
Translator
.
get
(
"i18n_dataset_field_delete"
));
}
if
(
i
==
0
)
{
DatasetTableField
sourceField
=
dataSetTableFieldsService
.
get
(
dto
.
getSourceTableFieldId
());
DatasetTableField
targetField
=
dataSetTableFieldsService
.
get
(
dto
.
getTargetTableFieldId
());
if
(
ObjectUtils
.
isEmpty
(
sourceField
)
||
ObjectUtils
.
isEmpty
(
targetField
))
{
DEException
.
throwException
(
Translator
.
get
(
"i18n_dataset_field_delete"
));
}
join
.
append
(
convertUnionTypeToSQL
(
dto
.
getSourceUnionRelation
()))
.
append
(
DorisTableUtils
.
dorisName
(
dto
.
getTargetTableId
()))
.
append
(
" ON "
)
.
append
(
DorisTableUtils
.
dorisName
(
dto
.
getSourceTableId
())).
append
(
"."
).
append
(
sourceField
.
getDataeaseName
())
.
append
(
" = "
)
.
append
(
DorisTableUtils
.
dorisName
(
dto
.
getTargetTableId
())).
append
(
"."
).
append
(
targetField
.
getDataeaseName
());
}
else
{
join
.
append
(
" AND "
)
.
append
(
DorisTableUtils
.
dorisName
(
dto
.
getSourceTableId
())).
append
(
"."
).
append
(
sourceField
.
getDataeaseName
())
.
append
(
" = "
)
.
append
(
DorisTableUtils
.
dorisName
(
dto
.
getTargetTableId
())).
append
(
"."
).
append
(
targetField
.
getDataeaseName
());
}
}
}
...
...
@@ -871,39 +858,25 @@ public class DataSetTableService {
String
f
=
field
.
substring
(
0
,
field
.
length
()
-
1
);
StringBuilder
join
=
new
StringBuilder
();
List
<
DataSetTableUnionDTO
>
unions
=
new
ArrayList
<>();
for
(
DataTableInfoCustomUnion
dataTableInfoCustomUnion
:
dataTableInfoDTO
.
getList
())
{
for
(
DataSetTableUnionDTO
dto
:
list
)
{
// 被关联表和自助数据集的表相等
if
(
StringUtils
.
equals
(
dto
.
getTargetTableId
(),
dataTableInfoCustomUnion
.
getTableId
()))
{
unions
.
add
(
dto
);
}
}
}
if
(
CollectionUtils
.
isNotEmpty
(
unions
))
{
for
(
int
i
=
0
;
i
<
unions
.
size
();
i
++)
{
DataSetTableUnionDTO
dto
=
unions
.
get
(
i
);
DatasetTableField
sourceField
=
dataSetTableFieldsService
.
get
(
dto
.
getSourceTableFieldId
());
DatasetTableField
targetField
=
dataSetTableFieldsService
.
get
(
dto
.
getTargetTableFieldId
());
if
(
ObjectUtils
.
isEmpty
(
sourceField
)
||
ObjectUtils
.
isEmpty
(
targetField
))
{
DEException
.
throwException
(
Translator
.
get
(
"i18n_dataset_field_delete"
));
}
DatasetTable
sourceTable
=
datasetTableMapper
.
selectByPrimaryKey
(
dto
.
getSourceTableId
());
String
sourceTableName
=
new
Gson
().
fromJson
(
sourceTable
.
getInfo
(),
DataTableInfoDTO
.
class
).
getTable
();
DatasetTable
targetTable
=
datasetTableMapper
.
selectByPrimaryKey
(
dto
.
getTargetTableId
());
String
targetTableName
=
new
Gson
().
fromJson
(
targetTable
.
getInfo
(),
DataTableInfoDTO
.
class
).
getTable
();
if
(
i
==
0
)
{
DatasetTableField
sourceField
=
dataSetTableFieldsService
.
get
(
dto
.
getSourceTableFieldId
());
DatasetTableField
targetField
=
dataSetTableFieldsService
.
get
(
dto
.
getTargetTableFieldId
());
if
(
ObjectUtils
.
isEmpty
(
sourceField
)
||
ObjectUtils
.
isEmpty
(
targetField
))
{
DEException
.
throwException
(
Translator
.
get
(
"i18n_dataset_field_delete"
));
}
DatasetTable
sourceTable
=
datasetTableMapper
.
selectByPrimaryKey
(
dto
.
getSourceTableId
());
String
sourceTableName
=
new
Gson
().
fromJson
(
sourceTable
.
getInfo
(),
DataTableInfoDTO
.
class
).
getTable
();
DatasetTable
targetTable
=
datasetTableMapper
.
selectByPrimaryKey
(
dto
.
getTargetTableId
());
String
targetTableName
=
new
Gson
().
fromJson
(
targetTable
.
getInfo
(),
DataTableInfoDTO
.
class
).
getTable
();
join
.
append
(
convertUnionTypeToSQL
(
dto
.
getSourceUnionRelation
()))
.
append
(
String
.
format
(
keyword
,
targetTableName
))
.
append
(
" ON "
)
.
append
(
String
.
format
(
keyword
,
sourceTableName
)).
append
(
"."
).
append
(
String
.
format
(
keyword
,
sourceField
.
getOriginName
()))
.
append
(
" = "
)
.
append
(
String
.
format
(
keyword
,
targetTableName
)).
append
(
"."
).
append
(
String
.
format
(
keyword
,
targetField
.
getOriginName
()));
}
else
{
join
.
append
(
" AND "
)
.
append
(
String
.
format
(
keyword
,
sourceTableName
)).
append
(
"."
).
append
(
String
.
format
(
keyword
,
sourceField
.
getOriginName
()))
.
append
(
" = "
)
.
append
(
String
.
format
(
keyword
,
targetTableName
)).
append
(
"."
).
append
(
String
.
format
(
keyword
,
targetField
.
getOriginName
()));
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help