fix: 关联前后置用例列表数量显示不正确
This commit is contained in:
parent
da47fe6a08
commit
113de8da6c
|
@ -322,7 +322,6 @@ public class ApiDefinitionController {
|
|||
|
||||
@PostMapping("/relationship/relate/{goPage}/{pageSize}")
|
||||
public Pager< List<ApiDefinitionResult>> getRelationshipRelateList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ApiDefinitionRequest request) {
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
return PageUtils.setPageInfo(page, apiDefinitionService.getRelationshipRelateList(request));
|
||||
return apiDefinitionService.getRelationshipRelateList(request, goPage, pageSize);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@ package io.metersphere.api.service;
|
|||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.metersphere.api.dto.APIReportResult;
|
||||
import io.metersphere.api.dto.ApiTestImportRequest;
|
||||
import io.metersphere.api.dto.automation.ApiScenarioRequest;
|
||||
|
@ -58,6 +60,7 @@ import org.apache.ibatis.session.SqlSessionFactory;
|
|||
import org.apache.jorphan.collections.HashTree;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import sun.security.util.Cache;
|
||||
|
||||
|
@ -1663,11 +1666,12 @@ public class ApiDefinitionService {
|
|||
}
|
||||
}
|
||||
|
||||
public List<ApiDefinitionResult> getRelationshipRelateList(ApiDefinitionRequest request) {
|
||||
public Pager<List<ApiDefinitionResult>> getRelationshipRelateList(ApiDefinitionRequest request, int goPage, @PathVariable int pageSize) {
|
||||
request = this.initRequest(request, true, true);
|
||||
List<String> relationshipIds = relationshipEdgeService.getRelationshipIds(request.getId());
|
||||
request.setNotInIds(relationshipIds);
|
||||
request.setId(null); // 去掉id的查询条件
|
||||
return extApiDefinitionMapper.list(request);
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
return PageUtils.setPageInfo(page, extApiDefinitionMapper.list(request));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -559,7 +559,7 @@
|
|||
</select>
|
||||
<select id="getTestCase" resultType="io.metersphere.base.domain.TestCase">
|
||||
select test_case.id, test_case.name, test_case.priority, test_case.type, test_case.review_status,
|
||||
test_case.num, test_case.custom_num, test_case.priority, test_case.tags, test_case.create_time, test_case.update_time
|
||||
test_case.num, test_case.custom_num, test_case.tags, test_case.create_time, test_case.update_time
|
||||
from test_case as test_case
|
||||
<include refid="notInQueryWhereCondition"></include>
|
||||
ORDER BY test_case.order DESC
|
||||
|
|
|
@ -127,8 +127,7 @@ public class TestCaseController {
|
|||
|
||||
@PostMapping("/relationship/relate/{goPage}/{pageSize}")
|
||||
public Pager<List<TestCase>> getRelationshipRelateList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestCaseRequest request) {
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
return PageUtils.setPageInfo(page, testCaseService.getRelationshipRelateList(request));
|
||||
return testCaseService.getRelationshipRelateList(request, goPage, pageSize);
|
||||
}
|
||||
|
||||
@PostMapping("/relate/issue/{goPage}/{pageSize}")
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.alibaba.excel.EasyExcelFactory;
|
|||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.metersphere.api.dto.automation.ApiScenarioDTO;
|
||||
import io.metersphere.api.dto.automation.ApiScenarioRequest;
|
||||
|
@ -1955,11 +1956,12 @@ public class TestCaseService {
|
|||
testCaseMapper::updateByPrimaryKeySelective);
|
||||
}
|
||||
|
||||
public List<TestCase> getRelationshipRelateList(QueryTestCaseRequest request) {
|
||||
public Pager<List<TestCase>> getRelationshipRelateList(QueryTestCaseRequest request, int goPage, int pageSize) {
|
||||
setDefaultOrder(request);
|
||||
List<String> relationshipIds = relationshipEdgeService.getRelationshipIds(request.getId());
|
||||
request.setTestCaseContainIds(relationshipIds);
|
||||
return extTestCaseMapper.getTestCase(request);
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
return PageUtils.setPageInfo(page, extTestCaseMapper.getTestCase(request));
|
||||
}
|
||||
|
||||
public List<RelationshipEdgeDTO> getRelationshipCase(String id, String relationshipType) {
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
:select-node-ids="selectNodeIds"
|
||||
:result="result"
|
||||
:current-protocol="currentProtocol"
|
||||
:current-page="currentPage"
|
||||
:page-size="pageSize"
|
||||
:screen-height="screenHeight"
|
||||
@setSelectRow="setSelectRow"
|
||||
@refreshTable="initTable"
|
||||
|
@ -58,8 +56,6 @@
|
|||
result: {},
|
||||
screenHeight: 'calc(100vh - 400px)',//屏幕高度,
|
||||
tableData: [],
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
environmentId: "",
|
||||
selectRows: new Set()
|
||||
}
|
||||
|
@ -133,7 +129,8 @@
|
|||
this.condition.planId = this.planId;
|
||||
}
|
||||
|
||||
this.result = this.$post(url + this.currentPage + "/" + this.pageSize, this.condition, response => {
|
||||
this.$nextTick(() => {
|
||||
this.result = this.$post(url + this.$refs.apitable.currentPage + "/" + this.$refs.apitable.pageSize, this.condition, response => {
|
||||
this.total = response.data.itemCount;
|
||||
this.tableData = response.data.listObject;
|
||||
this.tableData.forEach(item => {
|
||||
|
@ -142,6 +139,7 @@
|
|||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
setEnvironment(data) {
|
||||
this.environmentId = data.id;
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
:select-node-ids="selectNodeIds"
|
||||
:result="result"
|
||||
:current-protocol="currentProtocol"
|
||||
:current-page="currentPage"
|
||||
:page-size="pageSize"
|
||||
@refreshTable="initTable"
|
||||
ref="apitable"/>
|
||||
|
||||
|
@ -55,8 +53,6 @@
|
|||
currentRow: {},
|
||||
projectId: "",
|
||||
result: {},
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
tableData: []
|
||||
};
|
||||
},
|
||||
|
@ -91,6 +87,7 @@
|
|||
this.condition.protocol = "HTTP";
|
||||
}
|
||||
|
||||
this.$nextTick(() => {
|
||||
if (this.apiDefinitionId) {
|
||||
this.condition.id = this.apiDefinitionId;
|
||||
this.result = this.$post(this.buildPagePath('/api/definition/relationship/relate'), this.condition, response => {
|
||||
|
@ -103,9 +100,10 @@
|
|||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
buildPagePath(path) {
|
||||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||
return path + "/" + this.$refs.apitable.currentPage + "/" + this.$refs.apitable.pageSize;
|
||||
},
|
||||
setProject(projectId) {
|
||||
this.projectId = projectId;
|
||||
|
|
|
@ -143,7 +143,9 @@
|
|||
],
|
||||
methodColorMap: new Map(API_METHOD_COLOUR),
|
||||
methodFilters: [],
|
||||
userFilters: []
|
||||
userFilters: [],
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
}
|
||||
},
|
||||
props: {
|
||||
|
@ -152,8 +154,8 @@
|
|||
result: Object,
|
||||
tableData: Array,
|
||||
condition: Object,
|
||||
currentPage: Number,
|
||||
pageSize: Number,
|
||||
// currentPage: Number,
|
||||
// pageSize: Number,
|
||||
screenHeight: {
|
||||
type: [Number, String],
|
||||
default() {
|
||||
|
|
|
@ -1,100 +0,0 @@
|
|||
<template>
|
||||
<api-table-list
|
||||
:table-data="tableData"
|
||||
:condition="condition"
|
||||
:select-node-ids="selectNodeIds"
|
||||
:result="result"
|
||||
:current-protocol="currentProtocol"
|
||||
:current-page="currentPage"
|
||||
:page-size="pageSize"
|
||||
@refreshTable="initTable"
|
||||
ref="apitable"/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import {
|
||||
TEST_PLAN_RELEVANCE_API_DEFINITION_CONFIGS,
|
||||
} from "@/business/components/common/components/search/search-components";
|
||||
import ApiTableList from "@/business/components/api/definition/components/complete/ApiTableList";
|
||||
|
||||
export default {
|
||||
name: "RelationshipRelevanceList",
|
||||
components: {
|
||||
ApiTableList,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
condition: {
|
||||
components: TEST_PLAN_RELEVANCE_API_DEFINITION_CONFIGS
|
||||
},
|
||||
result: {},
|
||||
tableData: [],
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
environmentId: "",
|
||||
selectRows: new Set()
|
||||
}
|
||||
},
|
||||
props: {
|
||||
currentProtocol: String,
|
||||
selectNodeIds: Array,
|
||||
visible: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
projectId: String,
|
||||
apiDefinitionId: String
|
||||
},
|
||||
created: function () {
|
||||
this.initTable();
|
||||
},
|
||||
watch: {
|
||||
selectNodeIds() {
|
||||
this.initTable();
|
||||
},
|
||||
currentProtocol() {
|
||||
this.initTable();
|
||||
},
|
||||
projectId() {
|
||||
this.initTable();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initTable(projectId) {
|
||||
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
|
||||
this.condition.moduleIds = this.selectNodeIds;
|
||||
if (projectId != null && typeof projectId === 'string') {
|
||||
this.condition.projectId = projectId;
|
||||
} else if (this.projectId != null) {
|
||||
this.condition.projectId = this.projectId;
|
||||
}
|
||||
|
||||
if (this.currentProtocol != null) {
|
||||
this.condition.protocol = this.currentProtocol;
|
||||
} else {
|
||||
this.condition.protocol = "HTTP";
|
||||
}
|
||||
|
||||
if (this.apiDefinitionId) {
|
||||
this.condition.id = this.apiDefinitionId;
|
||||
this.result = this.$post(this.buildPagePath('/api/definition/relationship/relate'), this.condition, response => {
|
||||
this.total = response.data.itemCount;
|
||||
this.tableData = response.data.listObject;
|
||||
this.tableData.forEach(item => {
|
||||
if (item.tags && item.tags.length > 0) {
|
||||
item.tags = JSON.parse(item.tags);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
buildPagePath(path) {
|
||||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
|
@ -38,7 +38,7 @@ export function hasPermission(permission) {
|
|||
});
|
||||
|
||||
// todo 权限验证
|
||||
let currentProjectPermissions = user.userGroups.filter(ug => ug.group.type === 'PROJECT')
|
||||
let currentProjectPermissions = user.userGroups.filter(ug => ug.group && ug.group.type === 'PROJECT')
|
||||
.filter(ug => ug.sourceId === getCurrentProjectID())
|
||||
.map(ug => ug.userGroupPermissions)
|
||||
.reduce((total, current) => {
|
||||
|
@ -56,7 +56,7 @@ export function hasPermission(permission) {
|
|||
}
|
||||
}
|
||||
|
||||
let currentWorkspacePermissions = user.userGroups.filter(ug => ug.group.type === 'WORKSPACE')
|
||||
let currentWorkspacePermissions = user.userGroups.filter(ug => ug.group && ug.group.type === 'WORKSPACE')
|
||||
.filter(ug => ug.sourceId === getCurrentWorkspaceId())
|
||||
.map(ug => ug.userGroupPermissions)
|
||||
.reduce((total, current) => {
|
||||
|
@ -74,7 +74,7 @@ export function hasPermission(permission) {
|
|||
}
|
||||
}
|
||||
|
||||
let systemPermissions = user.userGroups.filter(gp => gp.group.type === 'SYSTEM')
|
||||
let systemPermissions = user.userGroups.filter(gp => gp.group && gp.group.type === 'SYSTEM')
|
||||
.filter(ug => ug.sourceId === 'system' || ug.sourceId === 'adminSourceId')
|
||||
.map(ug => ug.userGroupPermissions)
|
||||
.reduce((total, current) => {
|
||||
|
|
Loading…
Reference in New Issue