Merge pull request #2590 from dataease/pr@dev@fix_dataset_paramter

fix(数据集): 带参数的数据集设置仪表板过滤器报错空指针
This commit is contained in:
fit2cloud-chenyw 2022-07-05 22:24:00 +08:00 committed by GitHub
commit 834cab55e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -649,7 +649,7 @@ public class ChartViewService {
boolean hasParameters = false;
if (StringUtils.isNotEmpty(table.getSqlVariableDetails())) {
List<SqlVariableDetails> sqlVariables = new Gson().fromJson(table.getSqlVariableDetails(), new TypeToken<List<SqlVariableDetails>>() {}.getType());
for (String parameter : request.getParameters()) {
for (String parameter : Optional.ofNullable(request.getParameters()).orElse(new ArrayList<>()) ) {
if (sqlVariables.stream().map(SqlVariableDetails::getVariableName).collect(Collectors.toList()).contains(parameter)) {
hasParameters = true;
}