forked from github/dataease
Merge pull request #5269 from dataease/pr@dev@fixdataset
Pr@dev@fixdataset
This commit is contained in:
commit
834680e784
@ -39,8 +39,11 @@ public class MysqlDDLProvider extends DDLProviderImpl {
|
||||
for (int i = 0; i < strings.length; i++) {
|
||||
if (StringUtils.isEmpty(strings[i])) {
|
||||
strings1[i] = null;
|
||||
} else {
|
||||
strings1[i] = strings[i].replace("'", "\\'");
|
||||
continue;
|
||||
}
|
||||
strings1[i] = strings[i].replace("'", "\\'");
|
||||
if(strings1[i].equals("/")){
|
||||
strings1[i] = "//";
|
||||
}
|
||||
}
|
||||
values.append("('").append(UUID.randomUUID())
|
||||
|
@ -1091,7 +1091,7 @@ public class CKQueryProvider extends QueryProvider {
|
||||
return null;
|
||||
}
|
||||
|
||||
AtomicReference<ChartExtFilterRequest> atomicReference = new AtomicReference<>();
|
||||
List<ChartExtFilterRequest> chartExtFilterRequests = new ArrayList<>();
|
||||
requestList.forEach(request -> {
|
||||
DatasetTableField datasetTableField = request.getDatasetTableField();
|
||||
List<String> requestValue = request.getValue();
|
||||
@ -1106,12 +1106,12 @@ public class CKQueryProvider extends QueryProvider {
|
||||
requestCopy.setValue(new ArrayList<String>() {{
|
||||
add(String.format(toDateTime64, "'" + simpleDateFormat.format(new Date(Long.parseLong(requestValue.get(1)))) + "'"));
|
||||
}});
|
||||
atomicReference.set(requestCopy);
|
||||
chartExtFilterRequests.add(requestCopy);
|
||||
}
|
||||
});
|
||||
|
||||
if (ObjectUtils.isNotEmpty(atomicReference.get())) {
|
||||
requestList.add(atomicReference.get());
|
||||
if (CollectionUtils.isNotEmpty(chartExtFilterRequests)) {
|
||||
requestList.addAll(chartExtFilterRequests);
|
||||
}
|
||||
List<SQLObj> list = new ArrayList<>();
|
||||
for (ChartExtFilterRequest request : requestList) {
|
||||
|
@ -54,6 +54,7 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
case "NCHAR":
|
||||
case "NTEXT":
|
||||
case "VARCHAR":
|
||||
case "NVARCHAR":
|
||||
case "TEXT":
|
||||
case "TINYTEXT":
|
||||
case "MEDIUMTEXT":
|
||||
@ -898,11 +899,19 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
} else if (StringUtils.equalsIgnoreCase(item.getTerm(), "not_empty")) {
|
||||
whereValue = "''";
|
||||
} else if (StringUtils.containsIgnoreCase(item.getTerm(), "in") || StringUtils.containsIgnoreCase(item.getTerm(), "not in")) {
|
||||
whereValue = "('" + String.join("','", value.split(",")) + "')";
|
||||
if(field.getType().equals("NVARCHAR")){
|
||||
whereValue = Arrays.asList(value.split(",")).stream().map(str ->{return "N"+ str;}).collect(Collectors.joining(","));
|
||||
}else {
|
||||
whereValue = "('" + String.join("','", value.split(",")) + "')";
|
||||
}
|
||||
} else if (StringUtils.containsIgnoreCase(item.getTerm(), "like")) {
|
||||
whereValue = "'%" + value + "%'";
|
||||
} else {
|
||||
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE, value);
|
||||
if(field.getType().equals("NVARCHAR")){
|
||||
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE_CH, value);
|
||||
}else {
|
||||
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE, value);
|
||||
}
|
||||
}
|
||||
SQLObj build = SQLObj.builder()
|
||||
.whereField(whereName)
|
||||
@ -1025,11 +1034,19 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
} else if (StringUtils.equalsIgnoreCase(filterItemDTO.getTerm(), "not_empty")) {
|
||||
whereValue = "''";
|
||||
} else if (StringUtils.containsIgnoreCase(filterItemDTO.getTerm(), "in") || StringUtils.containsIgnoreCase(filterItemDTO.getTerm(), "not in")) {
|
||||
whereValue = "('" + String.join("','", value.split(",")) + "')";
|
||||
if(field.getType().equals("NVARCHAR")){
|
||||
whereValue = Arrays.asList(value.split(",")).stream().map(str ->{return "N"+ str;}).collect(Collectors.joining(","));
|
||||
}else {
|
||||
whereValue = "('" + String.join("','", value.split(",")) + "')";
|
||||
}
|
||||
} else if (StringUtils.containsIgnoreCase(filterItemDTO.getTerm(), "like")) {
|
||||
whereValue = "'%" + value + "%'";
|
||||
} else {
|
||||
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE, value);
|
||||
if(field.getType().equals("NVARCHAR")){
|
||||
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE_CH, value);
|
||||
}else {
|
||||
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE, value);
|
||||
}
|
||||
}
|
||||
list.add(SQLObj.builder()
|
||||
.whereField(whereName)
|
||||
@ -1129,7 +1146,11 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
String whereValue = "";
|
||||
|
||||
if (StringUtils.containsIgnoreCase(request.getOperator(), "in")) {
|
||||
whereValue = "('" + StringUtils.join(value, "','") + "')";
|
||||
if(request.getDatasetTableField().getType().equals("NVARCHAR")){
|
||||
whereValue = value.stream().map(str ->{return "N"+ str;}).collect(Collectors.joining(","));
|
||||
}else {
|
||||
whereValue = "('" + StringUtils.join(value, "','") + "')";
|
||||
}
|
||||
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "like")) {
|
||||
String keyword = value.get(0).toUpperCase();
|
||||
whereValue = "'%" + keyword + "%'";
|
||||
@ -1144,7 +1165,13 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
whereValue = String.format(SqlServerSQLConstants.WHERE_BETWEEN, value.get(0), value.get(1));
|
||||
}
|
||||
} else {
|
||||
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE, value.get(0));
|
||||
|
||||
if(request.getDatasetTableField().getType().equals("NVARCHAR")){
|
||||
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE_CH, value.get(0));
|
||||
}else {
|
||||
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE, value.get(0));
|
||||
}
|
||||
|
||||
}
|
||||
list.add(SQLObj.builder()
|
||||
.whereField(whereName)
|
||||
@ -1301,11 +1328,19 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "not_empty")) {
|
||||
whereValue = "''";
|
||||
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) {
|
||||
whereValue = "('" + StringUtils.join(f.getValue(), "','") + "')";
|
||||
if(y.getType().equals("NVARCHAR")){
|
||||
whereValue = Arrays.asList(f.getValue().split(",")).stream().map(str ->{return "N"+ str;}).collect(Collectors.joining(","));
|
||||
}else {
|
||||
whereValue = "('" + String.join("','", f.getValue().split(",")) + "')";
|
||||
}
|
||||
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) {
|
||||
whereValue = "'%" + f.getValue() + "%'";
|
||||
} else {
|
||||
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE, f.getValue());
|
||||
if(y.getType().equals("NVARCHAR")){
|
||||
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE_CH, f.getValue());
|
||||
}else {
|
||||
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE, f.getValue());
|
||||
}
|
||||
}
|
||||
list.add(SQLObj.builder()
|
||||
.whereField(fieldAlias)
|
||||
|
@ -1,8 +1,8 @@
|
||||
package io.dataease.service.chart.util;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
|
||||
import io.dataease.dto.chart.*;
|
||||
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
|
||||
import io.dataease.plugins.common.dto.chart.ChartViewFieldDTO;
|
||||
import io.dataease.plugins.xpack.auth.dto.request.ColumnPermissionItem;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
@ -1071,11 +1071,11 @@ public class ChartDataBuild {
|
||||
break;
|
||||
}
|
||||
if (originStr.length() >= columnPermissionItem.getDesensitizationRule().getM() && originStr.length() >= columnPermissionItem.getDesensitizationRule().getN()) {
|
||||
desensitizationStr = "***" + StringUtils.substring(originStr, columnPermissionItem.getDesensitizationRule().getM() - 1, columnPermissionItem.getDesensitizationRule().getN()) + "***";
|
||||
desensitizationStr = buildPrefix(columnPermissionItem.getDesensitizationRule().getM()) + StringUtils.substring(originStr, columnPermissionItem.getDesensitizationRule().getM() - 1, columnPermissionItem.getDesensitizationRule().getN()) + "***";
|
||||
break;
|
||||
}
|
||||
if (originStr.length() >= columnPermissionItem.getDesensitizationRule().getM() && originStr.length() < columnPermissionItem.getDesensitizationRule().getN()) {
|
||||
desensitizationStr = "***" + StringUtils.substring(originStr, columnPermissionItem.getDesensitizationRule().getM() - 1, originStr.length());
|
||||
desensitizationStr = buildPrefix(columnPermissionItem.getDesensitizationRule().getM()) + StringUtils.substring(originStr, columnPermissionItem.getDesensitizationRule().getM() - 1, originStr.length());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -1086,6 +1086,18 @@ public class ChartDataBuild {
|
||||
return desensitizationStr;
|
||||
}
|
||||
|
||||
|
||||
private static String buildPrefix(Integer integer) {
|
||||
String prefix = "";
|
||||
if (integer <= 1) {
|
||||
return prefix;
|
||||
}
|
||||
for (int i = 0; i < integer - 1; i++) {
|
||||
prefix = prefix + "*";
|
||||
}
|
||||
return prefix;
|
||||
}
|
||||
|
||||
private static Map<String, Object> transTableNormal(List<ChartViewFieldDTO> fields, ChartViewWithBLOBs view, List<String[]> data, Map<String, ColumnPermissionItem> desensitizationList) {
|
||||
Map<String, Object> map = new TreeMap<>();
|
||||
List<Map<String, Object>> tableRow = new ArrayList<>();
|
||||
|
@ -208,7 +208,10 @@ public class PermissionService {
|
||||
dataSetColumnPermissionsDTO.setDatasetId(datasetId);
|
||||
dataSetColumnPermissionsDTO.setAuthTargetIds(Collections.singletonList(userId));
|
||||
dataSetColumnPermissionsDTO.setAuthTargetType("user");
|
||||
datasetColumnPermissions.addAll(columnPermissionService.searchPermissions(dataSetColumnPermissionsDTO));
|
||||
List<DataSetColumnPermissionsDTO> dataSetColumnPermissionsDTOS = columnPermissionService.searchPermissions(dataSetColumnPermissionsDTO);
|
||||
if(CollectionUtils.isNotEmpty(dataSetColumnPermissionsDTOS)){
|
||||
datasetColumnPermissions.addAll(dataSetColumnPermissionsDTOS);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(roleIds)) {
|
||||
DataSetColumnPermissionsDTO request = new DataSetColumnPermissionsDTO();
|
||||
request.setDatasetId(datasetId);
|
||||
|
@ -454,6 +454,7 @@
|
||||
size="840px"
|
||||
:before-close="closeEditItem"
|
||||
direction="rtl"
|
||||
:wrapper-closable="false"
|
||||
>
|
||||
<el-steps
|
||||
:active="active"
|
||||
|
Loading…
Reference in New Issue
Block a user