1
1
package io .dataease .engine .trans ;
2
2
3
3
import io .dataease .api .permissions .dataset .dto .DataSetRowPermissionsTreeDTO ;
4
- import io .dataease .engine .constant .ExtFieldConstant ;
5
4
import io .dataease .constant .SQLConstants ;
5
+ import io .dataease .engine .constant .ExtFieldConstant ;
6
6
import io .dataease .engine .utils .Utils ;
7
7
import io .dataease .extensions .datasource .api .PluginManageApi ;
8
8
import io .dataease .extensions .datasource .constant .SqlPlaceholderConstants ;
11
11
import io .dataease .extensions .datasource .dto .DatasourceSchemaDTO ;
12
12
import io .dataease .extensions .datasource .model .SQLMeta ;
13
13
import io .dataease .extensions .datasource .model .SQLObj ;
14
+ import io .dataease .extensions .datasource .vo .DatasourceConfiguration ;
14
15
import io .dataease .extensions .view .dto .DatasetRowPermissionsTreeItem ;
15
16
import io .dataease .extensions .view .dto .DatasetRowPermissionsTreeObj ;
16
17
import org .apache .commons .collections4 .CollectionUtils ;
@@ -180,7 +181,9 @@ public static String transTreeItem(SQLObj tableObj, DatasetRowPermissionsTreeIte
180
181
if (StringUtils .equalsIgnoreCase (item .getFilterType (), "enum" )) {
181
182
if (CollectionUtils .isNotEmpty (item .getEnumValue ())) {
182
183
if ((StringUtils .containsIgnoreCase (field .getType (), "NVARCHAR" )
183
- || StringUtils .containsIgnoreCase (field .getType (), "NCHAR" )) && !isCross ) {
184
+ || StringUtils .containsIgnoreCase (field .getType (), "NCHAR" ))
185
+ && !isCross
186
+ && StringUtils .equalsIgnoreCase (dsType , DatasourceConfiguration .DatasourceType .sqlServer .getType ())) {
184
187
res = "(" + whereName + " IN (" + item .getEnumValue ().stream ().map (str -> "'" + SQLConstants .MSSQL_N_PREFIX + str + "'" ).collect (Collectors .joining ("," )) + "))" ;
185
188
} else {
186
189
res = "(" + whereName + " IN ('" + String .join ("','" , item .getEnumValue ()) + "'))" ;
@@ -205,14 +208,18 @@ public static String transTreeItem(SQLObj tableObj, DatasetRowPermissionsTreeIte
205
208
whereValue = "''" ;
206
209
} else if (StringUtils .containsIgnoreCase (item .getTerm (), "in" ) || StringUtils .containsIgnoreCase (item .getTerm (), "not in" )) {
207
210
if ((StringUtils .containsIgnoreCase (field .getType (), "NVARCHAR" )
208
- || StringUtils .containsIgnoreCase (field .getType (), "NCHAR" )) && !isCross ) {
211
+ || StringUtils .containsIgnoreCase (field .getType (), "NCHAR" ))
212
+ && !isCross
213
+ && StringUtils .equalsIgnoreCase (dsType , DatasourceConfiguration .DatasourceType .sqlServer .getType ())) {
209
214
whereValue = "(" + Arrays .stream (value .split ("," )).map (str -> "'" + SQLConstants .MSSQL_N_PREFIX + str + "'" ).collect (Collectors .joining ("," )) + ")" ;
210
215
} else {
211
216
whereValue = "('" + String .join ("','" , value .split ("," )) + "')" ;
212
217
}
213
218
} else if (StringUtils .containsIgnoreCase (item .getTerm (), "like" )) {
214
219
if ((StringUtils .containsIgnoreCase (field .getType (), "NVARCHAR" )
215
- || StringUtils .containsIgnoreCase (field .getType (), "NCHAR" )) && !isCross ) {
220
+ || StringUtils .containsIgnoreCase (field .getType (), "NCHAR" ))
221
+ && !isCross
222
+ && StringUtils .equalsIgnoreCase (dsType , DatasourceConfiguration .DatasourceType .sqlServer .getType ())) {
216
223
whereValue = "'" + SQLConstants .MSSQL_N_PREFIX + "%" + value + "%'" ;
217
224
} else {
218
225
whereValue = "'%" + value + "%'" ;
@@ -256,7 +263,9 @@ public static String transTreeItem(SQLObj tableObj, DatasetRowPermissionsTreeIte
256
263
}
257
264
} else {
258
265
if ((StringUtils .containsIgnoreCase (field .getType (), "NVARCHAR" )
259
- || StringUtils .containsIgnoreCase (field .getType (), "NCHAR" )) && !isCross ) {
266
+ || StringUtils .containsIgnoreCase (field .getType (), "NCHAR" ))
267
+ && !isCross
268
+ && StringUtils .equalsIgnoreCase (dsType , DatasourceConfiguration .DatasourceType .sqlServer .getType ())) {
260
269
whereValue = String .format (SQLConstants .WHERE_VALUE_VALUE_CH , value );
261
270
} else {
262
271
whereValue = String .format (SQLConstants .WHERE_VALUE_VALUE , value );
0 commit comments