fix(接口测试): 优化接口场景和UI共用的报告头组件中跳转数据方法
优化接口场景和UI共用的报告头组件中跳转数据方法
This commit is contained in:
parent
43c23773a8
commit
a80199cfe6
|
@ -49,4 +49,6 @@ public interface ExtProjectMapper {
|
|||
List<String> getThirdPartProjectIds();
|
||||
|
||||
ProjectDTO getProjectByScenario(String scenarioId);
|
||||
|
||||
ProjectDTO getProjectByUi(String id);
|
||||
}
|
||||
|
|
|
@ -439,4 +439,13 @@
|
|||
INNER join api_scenario a on a.project_id = p.id
|
||||
where a.id = #{scenarioId}
|
||||
</select>
|
||||
|
||||
<select id="getProjectByUi" resultType="io.metersphere.dto.ProjectDTO">
|
||||
SELECT p.* , w.name as workspaceName
|
||||
from project p
|
||||
INNER JOIN workspace w on p.workspace_id = w.id
|
||||
INNER join ui_scenario a on a.project_id = p.id
|
||||
where a.id = #{scenarioId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -166,7 +166,7 @@ public class ProjectController {
|
|||
}
|
||||
|
||||
@GetMapping("/api/project/get/{id}")
|
||||
public ProjectDTO getProjectByScenario(@PathVariable String id) {
|
||||
return projectService.getProjectByScenario(id);
|
||||
public ProjectDTO getProjectByScenarioOrUi(@PathVariable String id) {
|
||||
return projectService.getProjectByScenarioOrUi(id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1083,7 +1083,11 @@ public class ProjectService {
|
|||
}
|
||||
}
|
||||
|
||||
public ProjectDTO getProjectByScenario(String id) {
|
||||
return extProjectMapper.getProjectByScenario(id);
|
||||
public ProjectDTO getProjectByScenarioOrUi(String id) {
|
||||
ProjectDTO project = extProjectMapper.getProjectByScenario(id);
|
||||
if(project == null){
|
||||
project = extProjectMapper.getProjectByUi(id);
|
||||
}
|
||||
return project;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -136,34 +136,16 @@ export default {
|
|||
},
|
||||
clickResource() {
|
||||
//跳转修改只修改场景报告跳转逻辑。 UI部分的不清楚具体跳转细节,所以维持原来的代码逻辑。
|
||||
if(this.isUi){
|
||||
this.clickUiResource();
|
||||
}else {
|
||||
this.clickScenarioResource();
|
||||
}
|
||||
},
|
||||
clickUiResource(){
|
||||
let workspaceId = getCurrentWorkspaceId();
|
||||
if (this.report.projectId !== getCurrentProjectID()) {
|
||||
this.$get("/project/get/" + this.report.projectId, response => {
|
||||
if (response.data) {
|
||||
workspaceId = response.data.workspaceId;
|
||||
this.checkPermission(workspaceId, this.report.projectId, response.data.name);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.checkPermission(workspaceId, this.report.projectId, null);
|
||||
}
|
||||
},
|
||||
clickScenarioResource(){
|
||||
let workspaceId = getCurrentWorkspaceId();
|
||||
this.$get("/project/api/project/get/" + this.scenarioId, res => {
|
||||
let scenarioProjectId = res.data.id;
|
||||
if (scenarioProjectId !== getCurrentProjectID()) {
|
||||
if(res.data){
|
||||
let scenarioProjectId = res.data.id;
|
||||
if (scenarioProjectId !== getCurrentProjectID()) {
|
||||
workspaceId = res.data.workspaceId;
|
||||
this.checkPermission(workspaceId, scenarioProjectId, res.data.name);
|
||||
} else {
|
||||
this.checkPermission(workspaceId, scenarioProjectId, null);
|
||||
} else {
|
||||
this.checkPermission(workspaceId, scenarioProjectId, null);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue