Merge pull request #2970 from dataease/pr@dev@fix_sql_dataset

fix(视图-气泡地图): sql数据集以分号结尾时气泡地图报错
This commit is contained in:
fit2cloud-chenyw 2022-08-29 17:08:54 +08:00 committed by GitHub
commit 702da60c24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -94,6 +94,12 @@ public class ViewPluginBaseServiceImpl implements ViewPluginBaseService {
return null; return null;
} }
private String sqlFix(String sql) {
if (sql.lastIndexOf(";") == (sql.length() - 1)) {
sql = sql.substring(0, sql.length() - 1);
}
return sql;
}
@Override @Override
public PluginViewSQL getTableObj(PluginViewSet pluginViewSet) { public PluginViewSQL getTableObj(PluginViewSet pluginViewSet) {
String tableName = null; String tableName = null;
@ -108,7 +114,8 @@ public class ViewPluginBaseServiceImpl implements ViewPluginBaseService {
case SQL: case SQL:
String sql = dataTableInfoDTO.isBase64Encryption()? new String(java.util.Base64.getDecoder().decode(dataTableInfoDTO.getSql())): dataTableInfoDTO.getSql(); String sql = dataTableInfoDTO.isBase64Encryption()? new String(java.util.Base64.getDecoder().decode(dataTableInfoDTO.getSql())): dataTableInfoDTO.getSql();
tableName = dataSetTableService.handleVariableDefaultValue( sql, null); tableName = dataSetTableService.handleVariableDefaultValue( sql, null);
tableName = "(" + tableName + ")";
tableName = "(" + sqlFix(tableName) + ")";
break; break;
case CUSTOM: case CUSTOM:
List<DataSetTableUnionDTO> list = dataSetTableUnionService.listByTableId(dataTableInfoDTO.getList().get(0).getTableId()); List<DataSetTableUnionDTO> list = dataSetTableUnionService.listByTableId(dataTableInfoDTO.getList().get(0).getTableId());