From 9966905c8409805dedb3ac18317a39cb2431f345 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Wed, 2 Jun 2021 15:37:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=BF=87=E6=BB=A4=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=BE=85=E9=80=89=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metersphere/base/mapper/ext/ExtProjectMapper.java | 2 +- .../metersphere/base/mapper/ext/ExtProjectMapper.xml | 2 +- .../io/metersphere/controller/ProjectController.java | 11 +++++------ .../java/io/metersphere/service/ProjectService.java | 4 ++-- .../view/comonents/base/TestCaseRelevanceBase.vue | 4 ++-- .../review/view/components/TestReviewRelevance.vue | 4 ++-- 6 files changed, 13 insertions(+), 14 deletions(-) diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.java index 2fd41a2605..efc11cd725 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.java @@ -14,7 +14,7 @@ public interface ExtProjectMapper { int removeIssuePlatform(@Param("platform") String platform, @Param("orgId") String orgId); - List getSwitchProject(@Param("proRequest") ProjectRequest request); + List getUserProject(@Param("proRequest") ProjectRequest request); String getSystemIdByProjectId(String projectId); diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.xml index 20622c89cc..eba088143a 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.xml @@ -82,7 +82,7 @@ from project where workspace_id = #{workspaceId} - select distinct p.* from `group` g join user_group ug on g.id = ug.group_id join project p on p.id = ug.source_id diff --git a/backend/src/main/java/io/metersphere/controller/ProjectController.java b/backend/src/main/java/io/metersphere/controller/ProjectController.java index 8426817763..d5d9cc4638 100644 --- a/backend/src/main/java/io/metersphere/controller/ProjectController.java +++ b/backend/src/main/java/io/metersphere/controller/ProjectController.java @@ -88,15 +88,14 @@ public class ProjectController { } /** - * 切换项目 - * - * @param request - * @return + * 在工作空间下与用户有关的项目 + * @param request userId + * @return List */ @PostMapping("/list/related") - public List getSwitchProject(@RequestBody ProjectRequest request) { + public List getUserProject(@RequestBody ProjectRequest request) { request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId()); - return projectService.getSwitchProject(request); + return projectService.getUserProject(request); } diff --git a/backend/src/main/java/io/metersphere/service/ProjectService.java b/backend/src/main/java/io/metersphere/service/ProjectService.java index 235e459d4f..3848c275c2 100644 --- a/backend/src/main/java/io/metersphere/service/ProjectService.java +++ b/backend/src/main/java/io/metersphere/service/ProjectService.java @@ -135,12 +135,12 @@ public class ProjectService { return extProjectMapper.getProjectWithWorkspace(request); } - public List getSwitchProject(ProjectRequest request) { + public List getUserProject(ProjectRequest request) { if (StringUtils.isNotBlank(request.getName())) { request.setName(StringUtils.wrapIfMissing(request.getName(), "%")); } request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders())); - return extProjectMapper.getSwitchProject(request); + return extProjectMapper.getUserProject(request); } public List getProjectByIds(List ids) { diff --git a/frontend/src/business/components/track/plan/view/comonents/base/TestCaseRelevanceBase.vue b/frontend/src/business/components/track/plan/view/comonents/base/TestCaseRelevanceBase.vue index c3c1a9dd0b..7368512643 100644 --- a/frontend/src/business/components/track/plan/view/comonents/base/TestCaseRelevanceBase.vue +++ b/frontend/src/business/components/track/plan/view/comonents/base/TestCaseRelevanceBase.vue @@ -34,7 +34,7 @@ import MsDialogFooter from '../../../../../common/components/MsDialogFooter' import SelectMenu from "../../../../common/SelectMenu"; import RelevanceDialog from "./RelevanceDialog"; - import {getCurrentProjectID} from "@/common/js/utils"; + import {getCurrentProjectID, getCurrentUserId} from "@/common/js/utils"; export default { name: "TestCaseRelevanceBase", @@ -91,7 +91,7 @@ }, getProject() { - this.result = this.$get("/project/listAll", res => { + this.result = this.$post("/project/list/related", {userId: getCurrentUserId()}, res => { let data = res.data; if (data) { const index = data.findIndex(d => d.id === getCurrentProjectID()); diff --git a/frontend/src/business/components/track/review/view/components/TestReviewRelevance.vue b/frontend/src/business/components/track/review/view/components/TestReviewRelevance.vue index d004ae4d63..751175041b 100644 --- a/frontend/src/business/components/track/review/view/components/TestReviewRelevance.vue +++ b/frontend/src/business/components/track/review/view/components/TestReviewRelevance.vue @@ -108,7 +108,7 @@ import ReviewStatus from "@/business/components/track/case/components/ReviewStat import elTableInfiniteScroll from 'el-table-infinite-scroll'; import SelectMenu from "../../../common/SelectMenu"; import {_filter} from "@/common/js/tableUtils"; -import {getCurrentProjectID} from "@/common/js/utils"; +import {getCurrentProjectID, getCurrentUserId} from "@/common/js/utils"; export default { @@ -313,7 +313,7 @@ export default { }, getProject() { if (this.reviewId) { - this.$post("/test/case/review/projects", {reviewId: this.reviewId}, res => { + this.$post("/project/list/related", {userId: getCurrentUserId()}, res => { let data = res.data; if (data) { this.projects = data;