From 5b793a8ce4761c28380ff062f404bc990acaabce Mon Sep 17 00:00:00 2001 From: luowei Date: Wed, 11 Oct 2023 14:59:21 +0800 Subject: [PATCH] db_type is needed when get rules by audit result --- sqle/api/controller/v2/audit_plan.go | 1 + sqle/api/controller/v2/sql_audit.go | 1 + sqle/api/controller/v2/task.go | 2 ++ sqle/docs/docs.go | 3 +++ sqle/docs/swagger.json | 3 +++ sqle/docs/swagger.yaml | 2 ++ 6 files changed, 12 insertions(+) diff --git a/sqle/api/controller/v2/audit_plan.go b/sqle/api/controller/v2/audit_plan.go index 19dc75bfa0..7a56dee7c2 100644 --- a/sqle/api/controller/v2/audit_plan.go +++ b/sqle/api/controller/v2/audit_plan.go @@ -226,6 +226,7 @@ func GetAuditPlanReportSQLs(c echo.Context) error { Level: ar.Level, Message: ar.Message, RuleName: ar.RuleName, + DbType: ap.DBType, }) } } diff --git a/sqle/api/controller/v2/sql_audit.go b/sqle/api/controller/v2/sql_audit.go index 9fac22b76f..d7636bfc03 100644 --- a/sqle/api/controller/v2/sql_audit.go +++ b/sqle/api/controller/v2/sql_audit.go @@ -87,6 +87,7 @@ func convertTaskResultToAuditResV2(task *model.Task) *AuditResDataV2 { Level: sql.AuditResults[j].Level, Message: sql.AuditResults[j].Message, RuleName: sql.AuditResults[j].RuleName, + DbType: task.DBType, } } diff --git a/sqle/api/controller/v2/task.go b/sqle/api/controller/v2/task.go index 5dadbb3342..3d47249bd6 100644 --- a/sqle/api/controller/v2/task.go +++ b/sqle/api/controller/v2/task.go @@ -42,6 +42,7 @@ type AuditResult struct { Level string `json:"level" example:"warn"` Message string `json:"message" example:"避免使用不必要的内置函数md5()"` RuleName string `json:"rule_name"` + DbType string `json:"db_type"` } // @Summary 获取指定扫描任务的SQLs信息 @@ -114,6 +115,7 @@ func GetTaskSQLs(c echo.Context) error { Level: ar.Level, Message: ar.Message, RuleName: ar.RuleName, + DbType: task.DBType, }) } diff --git a/sqle/docs/docs.go b/sqle/docs/docs.go index bd905e0765..c5a5aab2e5 100644 --- a/sqle/docs/docs.go +++ b/sqle/docs/docs.go @@ -16377,6 +16377,9 @@ var doc = `{ "v2.AuditResult": { "type": "object", "properties": { + "db_type": { + "type": "string" + }, "level": { "type": "string", "example": "warn" diff --git a/sqle/docs/swagger.json b/sqle/docs/swagger.json index f839895841..e5a0fa04c0 100644 --- a/sqle/docs/swagger.json +++ b/sqle/docs/swagger.json @@ -16361,6 +16361,9 @@ "v2.AuditResult": { "type": "object", "properties": { + "db_type": { + "type": "string" + }, "level": { "type": "string", "example": "warn" diff --git a/sqle/docs/swagger.yaml b/sqle/docs/swagger.yaml index e799835b54..5ad2664600 100644 --- a/sqle/docs/swagger.yaml +++ b/sqle/docs/swagger.yaml @@ -4421,6 +4421,8 @@ definitions: type: object v2.AuditResult: properties: + db_type: + type: string level: example: warn type: string