fix(测试计划): 移动同名模块报错问题

--bug=1040813 --user=宋昌昌 【测试计划】模块树-同层级有同名模块-拖拽报错 https://www.tapd.cn/55049933/s/1518222
This commit is contained in:
song-cc-rock 2024-05-22 16:42:10 +08:00 committed by Craftsman
parent 43d6ed5916
commit 218f8052c7
8 changed files with 24 additions and 6 deletions

View File

@ -95,4 +95,6 @@ test_plan_not_exist=测试计划不存在
test_plan.report_id.not_blank=测试计划报告ID不能为空
test_plan.report.share_id.not_blank=测试计划报告分享ID不能为空
no_plan_to_archive=没有可归档的计划/计划组
test_plan.is.archived=测试计划已归档
test_plan.is.archived=测试计划已归档
test_plan_module_already_exists=同名模块已存在
test_plan_report_name_length_range=报告名称长度过长

View File

@ -107,4 +107,6 @@ test_plan_not_exist=The test plan does not exist
test_plan.report_id.not_blank=The test plan report ID cannot be empty
test_plan.report.share_id.not_blank=The test plan report share ID cannot be empty
no_plan_to_archive=No plans/plan groups to archive
test_plan.is.archived=Test plan has been archived
test_plan.is.archived=Test plan has been archived
test_plan_module_already_exists=The module with the same name already exists
test_plan_report_name_length_range=The report name is too long

View File

@ -107,4 +107,6 @@ test_plan_not_exist=测试计划不存在
test_plan.report_id.not_blank=测试计划报告ID不能为空
test_plan.report.share_id.not_blank=测试计划报告分享ID不能为空
no_plan_to_archive=没有可归档的计划/计划组
test_plan.is.archived=测试计划已归档
test_plan.is.archived=测试计划已归档
test_plan_module_already_exists=同名模块已存在
test_plan_report_name_length_range=报告名称长度过长

View File

@ -107,4 +107,6 @@ test_plan_not_exist=測試計劃不存在
test_plan.report_id.not_blank=測試計劃報告ID不能爲空
test_plan.report.share_id.not_blank=測試計劃報告分享ID不能爲空
no_plan_to_archive=沒有可歸檔的計劃/計劃組
test_plan.is.archived=測試計劃已歸檔
test_plan.is.archived=測試計劃已歸檔
test_plan_module_already_exists=同名模塊已存在
test_plan_report_name_length_range=报告名称长度过长

View File

@ -12,7 +12,7 @@
<select id="list" resultType="io.metersphere.bug.dto.response.BugDTO">
select distinct tprb.bug_id as id, tprb.bug_num as num, tprb.bug_title as title, tprb.bug_status as status, tprb.bug_handle_user as handleUserName,
tprb.bug_case_count as relationCaseCount
ifnull(tprb.bug_case_count, 0) as relationCaseCount
from test_plan_report_bug tprb
where tprb.test_plan_report_id = #{request.reportId}
</select>

View File

@ -43,7 +43,7 @@
select distinct tprfc.function_case_id as id, tprfc.function_case_num as num, tprfc.function_case_name as name,
tprfc.function_case_module as moduleName, tprfc.function_case_priority as priority,
tprfc.function_case_execute_result as executeResult, tprfc.function_case_execute_user as executeUser,
tprfc.function_case_bug_count as bugCount
ifnull(tprfc.function_case_bug_count, 0) as bugCount
from test_plan_report_function_case tprfc
where tprfc.test_plan_report_id = #{request.reportId}
<include refid="filter"/>

View File

@ -165,6 +165,13 @@ public class TestPlanModuleService extends ModuleTreeService {
extTestPlanModuleMapper::selectModuleByParentIdAndPosOperator);
TestPlanModuleExample example = new TestPlanModuleExample();
// 拖拽后, 父级模块下存在同名模块
example.createCriteria().andParentIdEqualTo(nodeSortDTO.getParent().getId()).andNameEqualTo(nodeSortDTO.getNode().getName())
.andIdNotEqualTo(nodeSortDTO.getNode().getId());
if (testPlanModuleMapper.countByExample(example) > 0) {
throw new MSException(Translator.get("test_plan_module_already_exists"));
}
example.clear();
example.createCriteria().andParentIdEqualTo(nodeSortDTO.getParent().getId()).andIdEqualTo(request.getDragNodeId());
//节点换到了别的节点下,要先更新parent节点再计算sort
if (testPlanModuleMapper.countByExample(example) == 0) {

View File

@ -102,6 +102,9 @@ public class TestPlanReportService {
* 报告重命名
*/
public void rename(String id, String name) {
if (name.length() > 300) {
throw new MSException(Translator.get("test_plan_report_name_length_range"));
}
TestPlanReport report = checkReport(id);
report.setName(name);
testPlanReportMapper.updateByPrimaryKeySelective(report);