fix(测试计划): 修复测试计划组标签字段不够长的问题

This commit is contained in:
Jianguo-Genius 2024-06-19 17:01:43 +08:00 committed by Craftsman
parent 33929d6978
commit c399d27c1f
2 changed files with 15 additions and 1 deletions

View File

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

View File

@ -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<String> tags = new ArrayList<>(request.getTags());
this.checkTagsLength(tags);
updateTestPlan.setTags(tags);
}
updateTestPlan.setType(testPlan.getType());
testPlanMapper.updateByPrimaryKeySelective(updateTestPlan);