From ba0036eccb600cee1024e3e17c6cd75f5de64af3 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Mon, 24 Jul 2023 11:19:25 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E7=8E=AF=E5=A2=83=E7=BB=84=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E5=9C=A8=E8=BE=B9=E7=95=8C=E5=80=BC=E6=97=B6=E7=9A=84?= =?UTF-8?q?=E5=A4=8D=E5=88=B6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1027794 --user=王孝刚 【系统设置】github#25592,系统设置-环境组名称为边界值50,在列表里面点复制字符超长 会提示sql error。 _copy边界值复制问题请优化 https://www.tapd.cn/55049933/s/1396374 --- .../metersphere/commons/constants/PermissionConstants.java | 2 +- .../io/metersphere/service/EnvironmentGroupService.java | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/framework/sdk-parent/sdk/src/main/java/io/metersphere/commons/constants/PermissionConstants.java b/framework/sdk-parent/sdk/src/main/java/io/metersphere/commons/constants/PermissionConstants.java index e87802eb58..a30efbd391 100644 --- a/framework/sdk-parent/sdk/src/main/java/io/metersphere/commons/constants/PermissionConstants.java +++ b/framework/sdk-parent/sdk/src/main/java/io/metersphere/commons/constants/PermissionConstants.java @@ -236,7 +236,7 @@ public class PermissionConstants { public static final String WORKSPACE_PROJECT_ENVIRONMENT_GROUP_READ = "WORKSPACE_PROJECT_ENVIRONMENT:READ+CREATE_GROUP"; public static final String WORKSPACE_PROJECT_ENVIRONMENT_GROUP_DELETE = "WORKSPACE_PROJECT_ENVIRONMENT:READ+DELETE_GROUP"; public static final String WORKSPACE_PROJECT_ENVIRONMENT_GROUP_EDIT = "WORKSPACE_PROJECT_ENVIRONMENT:READ+EDIT_GROUP"; - public static final String WORKSPACE_PROJECT_ENVIRONMENT_GROUP_COPY = "WORKSPACE_PROJECT_ENVIRONMENT:READ+COPY_GROU"; + public static final String WORKSPACE_PROJECT_ENVIRONMENT_GROUP_COPY = "WORKSPACE_PROJECT_ENVIRONMENT:READ+COPY_GROUP"; public static final String SYSTEM_PLUGIN_DEL = "SYSTEM_PLUGIN:DEL"; public static final String SYSTEM_PLUGIN_UPLOAD = "SYSTEM_PLUGIN:UPLOAD"; diff --git a/system-setting/backend/src/main/java/io/metersphere/service/EnvironmentGroupService.java b/system-setting/backend/src/main/java/io/metersphere/service/EnvironmentGroupService.java index b55595215d..154f8d8a74 100644 --- a/system-setting/backend/src/main/java/io/metersphere/service/EnvironmentGroupService.java +++ b/system-setting/backend/src/main/java/io/metersphere/service/EnvironmentGroupService.java @@ -11,6 +11,7 @@ import io.metersphere.commons.utils.SessionUtils; import io.metersphere.dto.EnvironmentGroupDTO; import io.metersphere.environment.dto.EnvironmentGroupRequest; import io.metersphere.i18n.Translator; +import jakarta.annotation.Resource; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; @@ -22,7 +23,6 @@ import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import jakarta.annotation.Resource; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -184,6 +184,10 @@ public class EnvironmentGroupService { copy.setId(copyId); String copyNameId = copyId.substring(0, 3); + //名字长度大于50 则截取前四十个字符 + if (environmentGroup.getName().length() + 9 > 50) { + environmentGroup.setName(environmentGroup.getName().substring(0, 41)); + } String copyName = environmentGroup.getName() + "_" + copyNameId + "_COPY"; copy.setName(copyName); copy.setWorkspaceId(environmentGroup.getWorkspaceId());