From c399d27c1fcc1a7b7b79bcbcff9687b4d7dd39cc Mon Sep 17 00:00:00 2001 From: Jianguo-Genius Date: Wed, 19 Jun 2024 17:01:43 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E7=BB=84?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=E5=AD=97=E6=AE=B5=E4=B8=8D=E5=A4=9F=E9=95=BF?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migration/3.0.1/ddl/V3.0.1_2__ga_ddl.sql | 5 +++++ .../io/metersphere/plan/service/TestPlanService.java | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/backend/framework/domain/src/main/resources/migration/3.0.1/ddl/V3.0.1_2__ga_ddl.sql b/backend/framework/domain/src/main/resources/migration/3.0.1/ddl/V3.0.1_2__ga_ddl.sql index 3078d7251d..86386f256f 100644 --- a/backend/framework/domain/src/main/resources/migration/3.0.1/ddl/V3.0.1_2__ga_ddl.sql +++ b/backend/framework/domain/src/main/resources/migration/3.0.1/ddl/V3.0.1_2__ga_ddl.sql @@ -230,7 +230,12 @@ ALTER TABLE test_plan_report_function_case ADD `function_case_execute_report_id` CREATE INDEX idx_test_plan_collection_id ON test_plan_report_function_case(test_plan_collection_id); CREATE INDEX idx_pos ON test_plan_report_function_case(pos); +-- 修改测试计划标签字段长度 +ALTER TABLE `test_plan` + MODIFY COLUMN `tags` VARCHAR(1000); + -- set innodb lock wait timeout to default SET SESSION innodb_lock_wait_timeout = DEFAULT; + diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanService.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanService.java index 04496a77e7..24b2d7ce24 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanService.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanService.java @@ -131,6 +131,7 @@ public class TestPlanService extends TestPlanBaseUtilsService { private TestPlan savePlanDTO(TestPlanCreateRequest createOrCopyRequest, String operator) { //检查模块的合法性 checkModule(createOrCopyRequest.getModuleId()); + this.checkTagsLength(createOrCopyRequest.getTags()); if (StringUtils.equalsIgnoreCase(createOrCopyRequest.getType(), TestPlanConstants.TEST_PLAN_TYPE_GROUP) && !StringUtils.equalsIgnoreCase(createOrCopyRequest.getGroupId(), TestPlanConstants.TEST_PLAN_DEFAULT_GROUP_ID)) { throw new MSException(Translator.get("test_plan.group.error")); @@ -139,6 +140,12 @@ public class TestPlanService extends TestPlanBaseUtilsService { TestPlan createTestPlan = new TestPlan(); BeanUtils.copyBean(createTestPlan, createOrCopyRequest); validateTestPlanGroup(createTestPlan.getGroupId(), 1); + + if (!StringUtils.equals(createTestPlan.getGroupId(), TestPlanConstants.TEST_PLAN_DEFAULT_GROUP_ID)) { + // 判断测试计划组是否存在 + createTestPlan.setModuleId(testPlanMapper.selectByPrimaryKey(createTestPlan.getGroupId()).getModuleId()); + } + initTestPlanPos(createTestPlan); createTestPlan.setId(IDGenerator.nextStr()); @@ -363,7 +370,9 @@ public class TestPlanService extends TestPlanBaseUtilsService { updateTestPlan.setPlannedEndTime(request.getPlannedEndTime()); updateTestPlan.setDescription(request.getDescription()); if (CollectionUtils.isNotEmpty(request.getTags())) { - updateTestPlan.setTags(new ArrayList<>(request.getTags())); + List tags = new ArrayList<>(request.getTags()); + this.checkTagsLength(tags); + updateTestPlan.setTags(tags); } updateTestPlan.setType(testPlan.getType()); testPlanMapper.updateByPrimaryKeySelective(updateTestPlan);