fix: 过滤项目待选列表

This commit is contained in:
shiziyuan9527 2021-06-02 15:37:36 +08:00 committed by 刘瑞斌
parent d52a95cae1
commit 9966905c84
6 changed files with 13 additions and 14 deletions

View File

@ -14,7 +14,7 @@ public interface ExtProjectMapper {
int removeIssuePlatform(@Param("platform") String platform, @Param("orgId") String orgId);
List<ProjectDTO> getSwitchProject(@Param("proRequest") ProjectRequest request);
List<ProjectDTO> getUserProject(@Param("proRequest") ProjectRequest request);
String getSystemIdByProjectId(String projectId);

View File

@ -82,7 +82,7 @@
from project
where workspace_id = #{workspaceId}
</select>
<select id="getSwitchProject" resultType="io.metersphere.dto.ProjectDTO">
<select id="getUserProject" resultType="io.metersphere.dto.ProjectDTO">
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
<where>

View File

@ -88,15 +88,14 @@ public class ProjectController {
}
/**
* 切换项目
*
* @param request
* @return
* 在工作空间下与用户有关的项目
* @param request userId
* @return List<ProjectDTO>
*/
@PostMapping("/list/related")
public List<ProjectDTO> getSwitchProject(@RequestBody ProjectRequest request) {
public List<ProjectDTO> getUserProject(@RequestBody ProjectRequest request) {
request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
return projectService.getSwitchProject(request);
return projectService.getUserProject(request);
}

View File

@ -135,12 +135,12 @@ public class ProjectService {
return extProjectMapper.getProjectWithWorkspace(request);
}
public List<ProjectDTO> getSwitchProject(ProjectRequest request) {
public List<ProjectDTO> 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<Project> getProjectByIds(List<String> ids) {

View File

@ -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());

View File

@ -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;