fix(测试计划): 修复测试计划模块树名称唯一性校验的问题

--bug=1040713 --user=宋天阳 【测试计划】模块树-当前项目与其他项目重名-创建模块树失败了 https://www.tapd.cn/55049933/s/1518669
This commit is contained in:
Jianguo-Genius 2024-05-22 17:52:49 +08:00 committed by Craftsman
parent b089aa0a5f
commit 9a97825ea8
2 changed files with 4 additions and 3 deletions

View File

@ -104,7 +104,7 @@ public class TestPlanModuleService extends ModuleTreeService {
example.clear(); example.clear();
} }
} }
example.createCriteria().andParentIdEqualTo(module.getParentId()).andNameEqualTo(module.getName()).andIdNotEqualTo(module.getId()); example.createCriteria().andParentIdEqualTo(module.getParentId()).andProjectIdEqualTo(module.getProjectId()).andNameEqualTo(module.getName()).andIdNotEqualTo(module.getId());
if (testPlanModuleMapper.countByExample(example) > 0) { if (testPlanModuleMapper.countByExample(example) > 0) {
throw new MSException(Translator.get("node.name.repeat")); throw new MSException(Translator.get("node.name.repeat"));
} }
@ -117,6 +117,7 @@ public class TestPlanModuleService extends ModuleTreeService {
updateModule.setId(request.getId()); updateModule.setId(request.getId());
updateModule.setName(request.getName().trim()); updateModule.setName(request.getName().trim());
updateModule.setParentId(module.getParentId()); updateModule.setParentId(module.getParentId());
updateModule.setProjectId(module.getProjectId());
this.checkDataValidity(updateModule); this.checkDataValidity(updateModule);
updateModule.setUpdateTime(System.currentTimeMillis()); updateModule.setUpdateTime(System.currentTimeMillis());
updateModule.setUpdateUser(userId); updateModule.setUpdateUser(userId);

View File

@ -562,12 +562,12 @@ public class TestPlanTests extends BaseTest {
groupTestPlanId7 = returnId; groupTestPlanId7 = returnId;
} else if (i == 15) { } else if (i == 15) {
groupTestPlanId15 = returnId; groupTestPlanId15 = returnId;
} else if (i > 700) { } else if (i > 700 && i < 750) {
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH); SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
TestPlanReportMapper batchInsert = sqlSession.getMapper(TestPlanReportMapper.class); TestPlanReportMapper batchInsert = sqlSession.getMapper(TestPlanReportMapper.class);
//大于600要创建测试计划报告 每个测试计划创建250个报告 // 701-749 要创建测试计划报告 每个测试计划创建250个报告
for (int reportCount = 0; reportCount < 250; reportCount++) { for (int reportCount = 0; reportCount < 250; reportCount++) {
TestPlanReport testPlanReport = new TestPlanReport(); TestPlanReport testPlanReport = new TestPlanReport();
testPlanReport.setId(IDGenerator.nextStr()); testPlanReport.setId(IDGenerator.nextStr());