Merge pull request #6068 from dataease/pr@dev@pgsql

fix: 树形过滤失败
This commit is contained in:
taojinlong 2023-09-07 17:12:45 +08:00 committed by GitHub
commit 81aa79a4e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1149,7 +1149,7 @@ public class SqlserverQueryProvider extends QueryProvider {
String whereValue = ""; String whereValue = "";
if (StringUtils.containsIgnoreCase(request.getOperator(), "in")) { if (StringUtils.containsIgnoreCase(request.getOperator(), "in")) {
if(request.getDatasetTableField().getType().equalsIgnoreCase("NVARCHAR")) { if(request.getDatasetTableField() != null && request.getDatasetTableField().getType().equalsIgnoreCase("NVARCHAR")) {
whereValue = "(" + value.stream().map(str -> { whereValue = "(" + value.stream().map(str -> {
return "N" + "'" + str + "'"; return "N" + "'" + str + "'";
}).collect(Collectors.joining(",")) + ")"; }).collect(Collectors.joining(",")) + ")";
@ -1171,7 +1171,7 @@ public class SqlserverQueryProvider extends QueryProvider {
} }
} else { } else {
if(request.getDatasetTableField().getType().equalsIgnoreCase("NVARCHAR")){ if(request.getDatasetTableField() != null && request.getDatasetTableField().getType().equalsIgnoreCase("NVARCHAR")){
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE_CH, value.get(0)); whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE_CH, value.get(0));
}else { }else {
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE, value.get(0)); whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE, value.get(0));