From 458be2e6665ed21a4de613c15b14c804ca622cde Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Mon, 29 Aug 2022 17:08:14 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E8=A7=86=E5=9B=BE-=E6=B0=94=E6=B3=A1?= =?UTF-8?q?=E5=9C=B0=E5=9B=BE):=20sql=E6=95=B0=E6=8D=AE=E9=9B=86=E4=BB=A5?= =?UTF-8?q?=E5=88=86=E5=8F=B7=E7=BB=93=E5=B0=BE=E6=97=B6=E6=B0=94=E6=B3=A1?= =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/chart/ViewPluginBaseServiceImpl.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/io/dataease/service/chart/ViewPluginBaseServiceImpl.java b/backend/src/main/java/io/dataease/service/chart/ViewPluginBaseServiceImpl.java index 42e49b1711..9e5cad8efa 100644 --- a/backend/src/main/java/io/dataease/service/chart/ViewPluginBaseServiceImpl.java +++ b/backend/src/main/java/io/dataease/service/chart/ViewPluginBaseServiceImpl.java @@ -94,6 +94,12 @@ public class ViewPluginBaseServiceImpl implements ViewPluginBaseService { return null; } + private String sqlFix(String sql) { + if (sql.lastIndexOf(";") == (sql.length() - 1)) { + sql = sql.substring(0, sql.length() - 1); + } + return sql; + } @Override public PluginViewSQL getTableObj(PluginViewSet pluginViewSet) { String tableName = null; @@ -108,7 +114,8 @@ public class ViewPluginBaseServiceImpl implements ViewPluginBaseService { case SQL: String sql = dataTableInfoDTO.isBase64Encryption()? new String(java.util.Base64.getDecoder().decode(dataTableInfoDTO.getSql())): dataTableInfoDTO.getSql(); tableName = dataSetTableService.handleVariableDefaultValue( sql, null); - tableName = "(" + tableName + ")"; + + tableName = "(" + sqlFix(tableName) + ")"; break; case CUSTOM: List list = dataSetTableUnionService.listByTableId(dataTableInfoDTO.getList().get(0).getTableId());