fix (接口定义): 优化操作历史查询缓慢问题
--bug=1007003 --user=赵勇 【github#6347】查询变更历史,出现慢查询,查询5分钟 才查出结果 https://www.tapd.cn/55049933/s/1058794
This commit is contained in:
parent
aff4b551f2
commit
ed512308e5
|
@ -72,6 +72,12 @@
|
||||||
LEFT JOIN workspace w on t2.workspace_id = w.id
|
LEFT JOIN workspace w on t2.workspace_id = w.id
|
||||||
<where>
|
<where>
|
||||||
t.oper_type in ('UPDATE','BATCH_UPDATE')
|
t.oper_type in ('UPDATE','BATCH_UPDATE')
|
||||||
|
<if test="request.modules != null and request.modules.size > 0 ">
|
||||||
|
and t.oper_module in
|
||||||
|
<foreach collection="request.modules" item="module" separator="," open="(" close=")">
|
||||||
|
#{module}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
and t.oper_content is not null
|
and t.oper_content is not null
|
||||||
<if test="request.sourceId != null and request.sourceId != ''">
|
<if test="request.sourceId != null and request.sourceId != ''">
|
||||||
and t.source_id like #{request.sourceId, jdbcType=VARCHAR}
|
and t.source_id like #{request.sourceId, jdbcType=VARCHAR}
|
||||||
|
|
|
@ -30,9 +30,9 @@ public class OperatingLogController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/get/source/{id}")
|
@PostMapping("/get/source")
|
||||||
public List<OperatingLogDTO> findBySourceId(@PathVariable String id) {
|
public List<OperatingLogDTO> findBySourceId(@RequestBody OperatingLogRequest request) {
|
||||||
return operatingLogService.findBySourceId(id);
|
return operatingLogService.findBySourceId(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,9 +47,8 @@ public class OperatingLogService {
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<OperatingLogDTO> findBySourceId(String id) {
|
public List<OperatingLogDTO> findBySourceId(OperatingLogRequest request) {
|
||||||
OperatingLogRequest request = new OperatingLogRequest();
|
request.setSourceId("%" + request.getSourceId() + "%");
|
||||||
request.setSourceId("%" + id + "%");
|
|
||||||
List<OperatingLogDTO> logWithBLOBs = extOperatingLogMapper.findBySourceId(request);
|
List<OperatingLogDTO> logWithBLOBs = extOperatingLogMapper.findBySourceId(request);
|
||||||
List<OperatingLogDTO> dtos = new ArrayList<>();
|
List<OperatingLogDTO> dtos = new ArrayList<>();
|
||||||
if (CollectionUtils.isNotEmpty(logWithBLOBs)) {
|
if (CollectionUtils.isNotEmpty(logWithBLOBs)) {
|
||||||
|
|
|
@ -30,4 +30,6 @@ public class OperatingLogRequest implements Serializable {
|
||||||
|
|
||||||
private List<String> projectIds;
|
private List<String> projectIds;
|
||||||
|
|
||||||
|
private List<String> modules;
|
||||||
|
|
||||||
}
|
}
|
|
@ -451,4 +451,5 @@ SELECT id, follow_people
|
||||||
FROM test_case
|
FROM test_case
|
||||||
WHERE follow_people IS NOT NULL AND follow_people != '';
|
WHERE follow_people IS NOT NULL AND follow_people != '';
|
||||||
ALTER TABLE test_case DROP COLUMN follow_people;
|
ALTER TABLE test_case DROP COLUMN follow_people;
|
||||||
|
-- 操作日志类型增加普通索引
|
||||||
|
ALTER TABLE `operating_log` ADD INDEX oper_module_index ( `oper_module` );
|
||||||
|
|
|
@ -865,7 +865,7 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
openHis() {
|
openHis() {
|
||||||
this.$refs.changeHistory.open(this.currentScenario.id);
|
this.$refs.changeHistory.open(this.currentScenario.id, ["接口自动化", "Api automation", "接口自動化"]);
|
||||||
},
|
},
|
||||||
setModule(id, data) {
|
setModule(id, data) {
|
||||||
this.currentScenario.apiScenarioModuleId = id;
|
this.currentScenario.apiScenarioModuleId = id;
|
||||||
|
|
|
@ -294,7 +294,7 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
hasPermission,
|
hasPermission,
|
||||||
openHis(row) {
|
openHis(row) {
|
||||||
this.$refs.changeHistory.open(row.id);
|
this.$refs.changeHistory.open(row.id,["接口定义用例" , "接口定義用例" , "Api definition case"]);
|
||||||
},
|
},
|
||||||
handleRunBatch() {
|
handleRunBatch() {
|
||||||
this.$emit('batchRun');
|
this.$emit('batchRun');
|
||||||
|
|
|
@ -80,7 +80,7 @@
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
openHis(){
|
openHis(){
|
||||||
this.$refs.changeHistory.open(this.basisData.id);
|
this.$refs.changeHistory.open(this.basisData.id,["接口定义" , "接口定義" , "Api definition"]);
|
||||||
},
|
},
|
||||||
callback() {
|
callback() {
|
||||||
this.validated = true;
|
this.validated = true;
|
||||||
|
|
|
@ -254,7 +254,7 @@
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
openHis(){
|
openHis(){
|
||||||
this.$refs.changeHistory.open(this.httpForm.id);
|
this.$refs.changeHistory.open(this.httpForm.id,["接口定义" , "接口定義" , "Api definition"]);
|
||||||
},
|
},
|
||||||
mockSetting() {
|
mockSetting() {
|
||||||
if(this.basisData.id){
|
if(this.basisData.id){
|
||||||
|
|
|
@ -80,7 +80,7 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
openHis(){
|
openHis(){
|
||||||
this.$refs.changeHistory.open(this.basisData.id);
|
this.$refs.changeHistory.open(this.basisData.id,["接口定义" , "接口定義" , "Api definition"]);
|
||||||
},
|
},
|
||||||
callback() {
|
callback() {
|
||||||
this.validated = true;
|
this.validated = true;
|
||||||
|
|
|
@ -143,7 +143,7 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
openHis(){
|
openHis(){
|
||||||
this.$refs.changeHistory.open(this.basisData.id);
|
this.$refs.changeHistory.open(this.basisData.id,["接口定义" , "接口定義" , "Api definition"]);
|
||||||
},
|
},
|
||||||
callback() {
|
callback() {
|
||||||
this.validated = true;
|
this.validated = true;
|
||||||
|
|
|
@ -74,8 +74,8 @@ export default {
|
||||||
handleClose() {
|
handleClose() {
|
||||||
this.infoVisible = false;
|
this.infoVisible = false;
|
||||||
},
|
},
|
||||||
getDetails(id) {
|
getDetails(id, modules) {
|
||||||
this.result = this.$get("/operating/log/get/source/" + id, response => {
|
this.result = this.$post("/operating/log/get/source/", {sourceId: id, modules: modules}, response => {
|
||||||
let data = response.data;
|
let data = response.data;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
if (data) {
|
if (data) {
|
||||||
|
@ -83,17 +83,17 @@ export default {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
open(id) {
|
open(id, modules) {
|
||||||
this.infoVisible = true;
|
this.infoVisible = true;
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.getDetails(id);
|
this.getDetails(id, modules);
|
||||||
},
|
},
|
||||||
openDetail(row, value) {
|
openDetail(row, value) {
|
||||||
value.createUser = row.details.createUser;
|
value.createUser = row.details.createUser;
|
||||||
value.operTime = row.operTime;
|
value.operTime = row.operTime;
|
||||||
if (value.columnName === "tags") {
|
if (value.columnName === "tags") {
|
||||||
this.$refs.tagsHistoryDetail.open(value);
|
this.$refs.tagsHistoryDetail.open(value);
|
||||||
} else if ((value.columnName === "request" || value.columnName === "response")&&
|
} else if ((value.columnName === "request" || value.columnName === "response") &&
|
||||||
(row.operModule === "接口定义" || row.operModule === "接口定義" || row.operModule === "Api definition")) {
|
(row.operModule === "接口定义" || row.operModule === "接口定義" || row.operModule === "Api definition")) {
|
||||||
this.$refs.apiHistoryDetail.open(value);
|
this.$refs.apiHistoryDetail.open(value);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -171,7 +171,7 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
openHis() {
|
openHis() {
|
||||||
this.$refs.changeHistory.open(this.test.id);
|
this.$refs.changeHistory.open(this.test.id,["性能测试" , "性能測試" , "Performance test"]);
|
||||||
},
|
},
|
||||||
importAPITest() {
|
importAPITest() {
|
||||||
let apiTest = this.$store.state.test;
|
let apiTest = this.$store.state.test;
|
||||||
|
|
|
@ -360,7 +360,7 @@
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
openHis() {
|
openHis() {
|
||||||
this.$refs.changeHistory.open(this.form.id);
|
this.$refs.changeHistory.open(this.form.id,["测试用例" , "測試用例" , "Test case"]);
|
||||||
},
|
},
|
||||||
setModule(id, data) {
|
setModule(id, data) {
|
||||||
this.form.module = id;
|
this.form.module = id;
|
||||||
|
|
Loading…
Reference in New Issue