refactor(性能测试): 性能测试查询项目下所有的用例(带版本)

This commit is contained in:
CaptainB 2022-10-13 14:58:12 +08:00 committed by 刘瑞斌
parent 9c0761736b
commit 32a82ac55d
5 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,12 @@
package io.metersphere.dto;
import lombok.Data;
@Data
public class BaseCase {
private String id;
private String name;
private String projectId;
private String versionName;
private String type;
}

View File

@ -2,6 +2,7 @@ package io.metersphere.base.mapper.ext;
import io.metersphere.base.domain.FileMetadata;
import io.metersphere.base.domain.LoadTest;
import io.metersphere.dto.BaseCase;
import io.metersphere.dto.LoadCaseCountChartResult;
import io.metersphere.dto.LoadTestDTO;
import io.metersphere.plan.request.LoadCaseRequest;
@ -49,4 +50,6 @@ public interface ExtLoadTestMapper {
List<LoadCaseCountChartResult> countByRequest(LoadCaseCountRequest request);
List<LoadTestDTO> relevanceLoadList(@Param("request") LoadCaseRequest request);
List<BaseCase> selectBaseCaseByProjectId(@Param("projectId") String projectId);
}

View File

@ -630,4 +630,15 @@
</include>
</if>
</sql>
<select id="selectBaseCaseByProjectId" resultType="io.metersphere.dto.BaseCase">
select load_test.id, load_test.name, load_test.project_id,'性能测试' as type, project_version.name as version_name
from load_test inner join project_version on project_version.project_id = load_test.project_id and
project_version.id = load_test.version_id
<where>
<if test="projectId!=null">
and load_test.project_id= #{projectId}
</if>
</where>
</select>
</mapper>

View File

@ -324,4 +324,10 @@ public class PerformanceTestController {
public List<LoadTest> getLoadCaseByIds(@RequestBody List<String> ids) {
return performanceTestService.getLoadCaseByIds(ids);
}
@GetMapping("/get-base-case/{projectId}")
@RequiresPermissions("PROJECT_PERFORMANCE_TEST:READ")
public List<BaseCase> getBaseCaseByProjectId(@PathVariable String projectId) {
return performanceTestService.getBaseCaseByProjectId(projectId);
}
}

View File

@ -1014,4 +1014,8 @@ public class PerformanceTestService {
MSException.throwException(errorMessage + Translator.get("project_file_in_use"));
}
}
public List<BaseCase> getBaseCaseByProjectId(String projectId) {
return extLoadTestMapper.selectBaseCaseByProjectId(projectId);
}
}