perf(测试跟踪): 优化测试计划-接口用例-切换模块-模块树响应速度
--bug=1028792 --user=宋天阳 【测试跟踪】测试计划-接口用例-切换模块-模块树响应较慢 https://www.tapd.cn/55049933/s/1404854
This commit is contained in:
parent
4151f10024
commit
f66f5c3f6c
|
@ -66,5 +66,7 @@ public interface ExtTestPlanApiCaseMapper {
|
|||
List<String> selectResourcePoolIdByReportIds(@Param("ids") List<String> resourceIds);
|
||||
|
||||
void updateStatusStop(@Param("ids") List<String> testIds);
|
||||
|
||||
List<String> getCaseProjectIdByPlanId(String planId);
|
||||
}
|
||||
|
||||
|
|
|
@ -567,6 +567,13 @@
|
|||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="getCaseProjectIdByPlanId" resultType="java.lang.String">
|
||||
SELECT DISTINCT project_id
|
||||
FROM api_test_case
|
||||
WHERE id in (SELECT api_case_id
|
||||
FROM test_plan_api_case
|
||||
WHERE test_plan_id = #{0});
|
||||
</select>
|
||||
<update id="updateStatusStop" parameterType="java.util.List">
|
||||
update test_plan_api_case set status="STOPPED" where id in
|
||||
<foreach collection="ids" item="value" separator="," open="(" close=")">
|
||||
|
|
|
@ -185,7 +185,7 @@ public class TestPlanApiCaseController {
|
|||
|
||||
@PostMapping("/list/module/{planId}/{protocol}")
|
||||
public List<ApiModuleDTO> getNodeByPlanId(@PathVariable String planId, @PathVariable String protocol, @RequestBody List<String> projectIds) {
|
||||
return testPlanApiCaseService.getNodeByPlanId(projectIds, planId, protocol);
|
||||
return testPlanApiCaseService.getNodeByPlanId(planId, protocol);
|
||||
}
|
||||
|
||||
@GetMapping("/run/{testId}/{reportId}")
|
||||
|
|
|
@ -741,9 +741,10 @@ public class TestPlanApiCaseService {
|
|||
return buildCases(extTestPlanApiCaseMapper.getFailureListByIds(planApiCaseIds, null));
|
||||
}
|
||||
|
||||
public List<ApiModuleDTO> getNodeByPlanId(List<String> projectIds, String planId, String protocol) {
|
||||
public List<ApiModuleDTO> getNodeByPlanId(String planId, String protocol) {
|
||||
List<ApiModuleDTO> list = new ArrayList<>();
|
||||
projectIds.forEach(id -> {
|
||||
List<String> apiCaseProjectId = extTestPlanApiCaseMapper.getCaseProjectIdByPlanId(planId);
|
||||
apiCaseProjectId.forEach(id -> {
|
||||
Project project = baseProjectService.getProjectById(id);
|
||||
String name = project.getName();
|
||||
List<ApiModuleDTO> nodeList = getNodeDTO(id, planId, protocol);
|
||||
|
|
|
@ -5,12 +5,12 @@ import io.metersphere.base.mapper.ProjectMapper;
|
|||
import io.metersphere.base.mapper.TestPlanMapper;
|
||||
import io.metersphere.base.mapper.TestPlanProjectMapper;
|
||||
import io.metersphere.plan.request.function.TestCaseRelevanceRequest;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -58,7 +58,6 @@ public class TestPlanProjectService {
|
|||
TestPlanExample testPlanExample = new TestPlanExample();
|
||||
testPlanExample.createCriteria().andProjectIdEqualTo(projectId);
|
||||
List<TestPlan> testPlans = testPlanMapper.selectByExample(testPlanExample);
|
||||
|
||||
if (CollectionUtils.isEmpty(testPlans)) {
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue