diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtOperatingLogMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtOperatingLogMapper.xml index 504bd40832..e9683befe1 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtOperatingLogMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtOperatingLogMapper.xml @@ -72,6 +72,12 @@ LEFT JOIN workspace w on t2.workspace_id = w.id t.oper_type in ('UPDATE','BATCH_UPDATE') + + and t.oper_module in + + #{module} + + and t.oper_content is not null and t.source_id like #{request.sourceId, jdbcType=VARCHAR} diff --git a/backend/src/main/java/io/metersphere/log/controller/OperatingLogController.java b/backend/src/main/java/io/metersphere/log/controller/OperatingLogController.java index 7375f759a3..9b26270a8c 100644 --- a/backend/src/main/java/io/metersphere/log/controller/OperatingLogController.java +++ b/backend/src/main/java/io/metersphere/log/controller/OperatingLogController.java @@ -30,9 +30,9 @@ public class OperatingLogController { } - @GetMapping("/get/source/{id}") - public List findBySourceId(@PathVariable String id) { - return operatingLogService.findBySourceId(id); + @PostMapping("/get/source") + public List findBySourceId(@RequestBody OperatingLogRequest request) { + return operatingLogService.findBySourceId(request); } } diff --git a/backend/src/main/java/io/metersphere/log/service/OperatingLogService.java b/backend/src/main/java/io/metersphere/log/service/OperatingLogService.java index 57fd5b65d9..a074e5d8a7 100644 --- a/backend/src/main/java/io/metersphere/log/service/OperatingLogService.java +++ b/backend/src/main/java/io/metersphere/log/service/OperatingLogService.java @@ -47,9 +47,8 @@ public class OperatingLogService { return dto; } - public List findBySourceId(String id) { - OperatingLogRequest request = new OperatingLogRequest(); - request.setSourceId("%" + id + "%"); + public List findBySourceId(OperatingLogRequest request) { + request.setSourceId("%" + request.getSourceId() + "%"); List logWithBLOBs = extOperatingLogMapper.findBySourceId(request); List dtos = new ArrayList<>(); if (CollectionUtils.isNotEmpty(logWithBLOBs)) { diff --git a/backend/src/main/java/io/metersphere/log/vo/OperatingLogRequest.java b/backend/src/main/java/io/metersphere/log/vo/OperatingLogRequest.java index 7f8f54a398..0ba75d458d 100644 --- a/backend/src/main/java/io/metersphere/log/vo/OperatingLogRequest.java +++ b/backend/src/main/java/io/metersphere/log/vo/OperatingLogRequest.java @@ -30,4 +30,6 @@ public class OperatingLogRequest implements Serializable { private List projectIds; + private List modules; + } \ No newline at end of file diff --git a/backend/src/main/resources/db/migration/V97__v1.14_release.sql b/backend/src/main/resources/db/migration/V97__v1.14_release.sql index 15705317a4..7b014e689f 100644 --- a/backend/src/main/resources/db/migration/V97__v1.14_release.sql +++ b/backend/src/main/resources/db/migration/V97__v1.14_release.sql @@ -451,4 +451,5 @@ SELECT id, follow_people FROM test_case WHERE follow_people IS NOT NULL AND follow_people != ''; ALTER TABLE test_case DROP COLUMN follow_people; - +-- 操作日志类型增加普通索引 +ALTER TABLE `operating_log` ADD INDEX oper_module_index ( `oper_module` ); diff --git a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue index 4c636e9aca..03fd91cd0f 100644 --- a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue +++ b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue @@ -865,7 +865,7 @@ export default { }) }, openHis() { - this.$refs.changeHistory.open(this.currentScenario.id); + this.$refs.changeHistory.open(this.currentScenario.id, ["接口自动化", "Api automation", "接口自動化"]); }, setModule(id, data) { this.currentScenario.apiScenarioModuleId = id; diff --git a/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue index dfd9745d64..3cc7af23d5 100644 --- a/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue +++ b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue @@ -294,7 +294,7 @@ export default { methods: { hasPermission, openHis(row) { - this.$refs.changeHistory.open(row.id); + this.$refs.changeHistory.open(row.id,["接口定义用例" , "接口定義用例" , "Api definition case"]); }, handleRunBatch() { this.$emit('batchRun'); diff --git a/frontend/src/business/components/api/definition/components/complete/EditCompleteDubboApi.vue b/frontend/src/business/components/api/definition/components/complete/EditCompleteDubboApi.vue index fc902023d2..e88384acb0 100644 --- a/frontend/src/business/components/api/definition/components/complete/EditCompleteDubboApi.vue +++ b/frontend/src/business/components/api/definition/components/complete/EditCompleteDubboApi.vue @@ -80,7 +80,7 @@ }, methods: { openHis(){ - this.$refs.changeHistory.open(this.basisData.id); + this.$refs.changeHistory.open(this.basisData.id,["接口定义" , "接口定義" , "Api definition"]); }, callback() { this.validated = true; diff --git a/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue b/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue index 37f3d5eb37..a32e67b133 100644 --- a/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue +++ b/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue @@ -254,7 +254,7 @@ }, methods: { openHis(){ - this.$refs.changeHistory.open(this.httpForm.id); + this.$refs.changeHistory.open(this.httpForm.id,["接口定义" , "接口定義" , "Api definition"]); }, mockSetting() { if(this.basisData.id){ diff --git a/frontend/src/business/components/api/definition/components/complete/EditCompleteSQLApi.vue b/frontend/src/business/components/api/definition/components/complete/EditCompleteSQLApi.vue index 3526e6504e..dd2458095c 100644 --- a/frontend/src/business/components/api/definition/components/complete/EditCompleteSQLApi.vue +++ b/frontend/src/business/components/api/definition/components/complete/EditCompleteSQLApi.vue @@ -80,7 +80,7 @@ export default { }, methods: { openHis(){ - this.$refs.changeHistory.open(this.basisData.id); + this.$refs.changeHistory.open(this.basisData.id,["接口定义" , "接口定義" , "Api definition"]); }, callback() { this.validated = true; diff --git a/frontend/src/business/components/api/definition/components/complete/EditCompleteTCPApi.vue b/frontend/src/business/components/api/definition/components/complete/EditCompleteTCPApi.vue index 50c436ba6d..cd137b2d01 100644 --- a/frontend/src/business/components/api/definition/components/complete/EditCompleteTCPApi.vue +++ b/frontend/src/business/components/api/definition/components/complete/EditCompleteTCPApi.vue @@ -143,7 +143,7 @@ export default { }, methods: { openHis(){ - this.$refs.changeHistory.open(this.basisData.id); + this.$refs.changeHistory.open(this.basisData.id,["接口定义" , "接口定義" , "Api definition"]); }, callback() { this.validated = true; diff --git a/frontend/src/business/components/history/ChangeHistory.vue b/frontend/src/business/components/history/ChangeHistory.vue index 351437bdc0..f1d3222bf0 100644 --- a/frontend/src/business/components/history/ChangeHistory.vue +++ b/frontend/src/business/components/history/ChangeHistory.vue @@ -74,8 +74,8 @@ export default { handleClose() { this.infoVisible = false; }, - getDetails(id) { - this.result = this.$get("/operating/log/get/source/" + id, response => { + getDetails(id, modules) { + this.result = this.$post("/operating/log/get/source/", {sourceId: id, modules: modules}, response => { let data = response.data; this.loading = false; if (data) { @@ -83,17 +83,17 @@ export default { } }) }, - open(id) { + open(id, modules) { this.infoVisible = true; this.loading = true; - this.getDetails(id); + this.getDetails(id, modules); }, openDetail(row, value) { value.createUser = row.details.createUser; value.operTime = row.operTime; if (value.columnName === "tags") { 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")) { this.$refs.apiHistoryDetail.open(value); } else { diff --git a/frontend/src/business/components/performance/test/EditPerformanceTest.vue b/frontend/src/business/components/performance/test/EditPerformanceTest.vue index 498d633d8f..cf4cf0f938 100644 --- a/frontend/src/business/components/performance/test/EditPerformanceTest.vue +++ b/frontend/src/business/components/performance/test/EditPerformanceTest.vue @@ -171,7 +171,7 @@ export default { }); }, openHis() { - this.$refs.changeHistory.open(this.test.id); + this.$refs.changeHistory.open(this.test.id,["性能测试" , "性能測試" , "Performance test"]); }, importAPITest() { let apiTest = this.$store.state.test; diff --git a/frontend/src/business/components/track/case/components/TestCaseEdit.vue b/frontend/src/business/components/track/case/components/TestCaseEdit.vue index bb8f6dc820..c8b7d79f84 100644 --- a/frontend/src/business/components/track/case/components/TestCaseEdit.vue +++ b/frontend/src/business/components/track/case/components/TestCaseEdit.vue @@ -360,7 +360,7 @@ }, methods: { openHis() { - this.$refs.changeHistory.open(this.form.id); + this.$refs.changeHistory.open(this.form.id,["测试用例" , "測試用例" , "Test case"]); }, setModule(id, data) { this.form.module = id;