fix(测试跟踪): 修复测试计划跳转跨项目场景报告时出现的所属模块丢失的问题

--bug=1022175 --user=宋天阳 【测试跟踪】github#21463,从测试报告点击用例名进入用例编辑页,module会丢失
https://www.tapd.cn/55049933/s/1329608
This commit is contained in:
song-tianyang 2023-02-01 10:51:20 +08:00 committed by 建国
parent 6ff8490b7a
commit d8de2463a7
5 changed files with 27 additions and 10 deletions

View File

@ -47,4 +47,6 @@ public interface ExtProjectMapper {
void updateUseDefaultCaseTemplateProject(@Param("originId") String originId,@Param("templateId") String templateId,@Param("projectId") String projectId);
List<String> getThirdPartProjectIds();
ProjectDTO getProjectByScenario(String scenarioId);
}

View File

@ -432,4 +432,11 @@
NULL)
</insert>
<select id="getProjectByScenario" 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 api_scenario a on a.project_id = p.id
where a.id = #{scenarioId}
</select>
</mapper>

View File

@ -164,4 +164,9 @@ public class ProjectController {
public void checkThirdProjectExist(@RequestBody Project project) {
projectService.checkThirdProjectExist(project);
}
@GetMapping("/api/project/get/{id}")
public ProjectDTO getProjectByScenario(@PathVariable String id) {
return projectService.getProjectByScenario(id);
}
}

View File

@ -1082,4 +1082,8 @@ public class ProjectService {
}
}
}
public ProjectDTO getProjectByScenario(String id) {
return extProjectMapper.getProjectByScenario(id);
}
}

View File

@ -136,16 +136,15 @@ export default {
},
clickResource() {
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);
}
this.$get("/project/api/project/get/" + this.scenarioId, res => {
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);
}
});
},
checkPermission(workspaceId, projectId, projectName) {
this.$get("/workspace/get/" + workspaceId, response => {