fix(测试计划): 修复测试计划关联功能用例时出现的排序问题
This commit is contained in:
parent
239e7b5f63
commit
44a071ab37
|
@ -19,7 +19,8 @@ import static io.metersphere.system.controller.handler.result.MsHttpResultCode.N
|
||||||
|
|
||||||
public class ServiceUtils {
|
public class ServiceUtils {
|
||||||
|
|
||||||
public static final int POS_STEP = 5000;
|
//用于排序的pos
|
||||||
|
public static final int POS_STEP = 4096;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存资源名称,在处理 NOT_FOUND 异常时,拼接资源名称
|
* 保存资源名称,在处理 NOT_FOUND 异常时,拼接资源名称
|
||||||
|
|
|
@ -114,9 +114,9 @@
|
||||||
project.id as projectId
|
project.id as projectId
|
||||||
FROM
|
FROM
|
||||||
functional_case
|
functional_case
|
||||||
left join project on functional_case.project_id = project.id
|
inner join project on functional_case.project_id = project.id
|
||||||
|
inner join test_plan_functional_case on functional_case.id = test_plan_functional_case.functional_case_id
|
||||||
LEFT JOIN project_version ON functional_case.version_id = project_version.id
|
LEFT JOIN project_version ON functional_case.version_id = project_version.id
|
||||||
left join test_plan_functional_case on functional_case.id = test_plan_functional_case.functional_case_id
|
|
||||||
where functional_case.deleted = #{deleted}
|
where functional_case.deleted = #{deleted}
|
||||||
and test_plan_functional_case.test_plan_id = #{request.testPlanId}
|
and test_plan_functional_case.test_plan_id = #{request.testPlanId}
|
||||||
and functional_case.project_id = #{request.projectId}
|
and functional_case.project_id = #{request.projectId}
|
||||||
|
@ -126,7 +126,7 @@
|
||||||
functional_case.${sort}
|
functional_case.${sort}
|
||||||
</if>
|
</if>
|
||||||
<if test="sort == null or sort == ''">
|
<if test="sort == null or sort == ''">
|
||||||
functional_case.pos desc
|
test_plan_functional_case.pos desc
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
@ -36,6 +37,8 @@ public class TestPlanCaseService {
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
List<TestPlanFunctionalCase> testPlanFunctionalCaseList = new ArrayList<>();
|
List<TestPlanFunctionalCase> testPlanFunctionalCaseList = new ArrayList<>();
|
||||||
List<String> associationIdList = associationParam.getResourceIdList();
|
List<String> associationIdList = associationParam.getResourceIdList();
|
||||||
|
// 批量添加时,按照列表顺序进行展示。所以这里将集合倒叙排列
|
||||||
|
Collections.reverse(associationIdList);
|
||||||
for (int i = 0; i < associationIdList.size(); i++) {
|
for (int i = 0; i < associationIdList.size(); i++) {
|
||||||
TestPlanFunctionalCase testPlanFunctionalCase = new TestPlanFunctionalCase();
|
TestPlanFunctionalCase testPlanFunctionalCase = new TestPlanFunctionalCase();
|
||||||
testPlanFunctionalCase.setId(IDGenerator.nextStr());
|
testPlanFunctionalCase.setId(IDGenerator.nextStr());
|
||||||
|
|
|
@ -45,6 +45,11 @@ public class TestPlanManagementService {
|
||||||
TestPlanQueryConditions testPlanQueryConditions = new TestPlanQueryConditions(null, request.getProjectId(), request);
|
TestPlanQueryConditions testPlanQueryConditions = new TestPlanQueryConditions(null, request.getProjectId(), request);
|
||||||
List<ModuleCountDTO> moduleCountDTOList = extTestPlanMapper.countModuleIdByConditions(testPlanQueryConditions);
|
List<ModuleCountDTO> moduleCountDTOList = extTestPlanMapper.countModuleIdByConditions(testPlanQueryConditions);
|
||||||
Map<String, Long> moduleCountMap = testPlanModuleService.getModuleCountMap(request.getProjectId(), moduleCountDTOList);
|
Map<String, Long> moduleCountMap = testPlanModuleService.getModuleCountMap(request.getProjectId(), moduleCountDTOList);
|
||||||
|
long allCount = 0;
|
||||||
|
for (ModuleCountDTO item : moduleCountDTOList) {
|
||||||
|
allCount += item.getDataCount();
|
||||||
|
}
|
||||||
|
moduleCountMap.put("all", allCount);
|
||||||
return moduleCountMap;
|
return moduleCountMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue