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);