From f04be521e57879a57007b6700b93eb2c266aa4c1 Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Tue, 23 Jul 2024 14:42:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=9B=9E=E6=BB=9A=E4=BB=A3=E7=A0=81=20?= =?UTF-8?q?(#5914)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/middleware/operation.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/middleware/operation.go b/backend/middleware/operation.go index 1ac3f2982..6609bdfe8 100644 --- a/backend/middleware/operation.go +++ b/backend/middleware/operation.go @@ -96,9 +96,11 @@ func OperationLog() gin.HandlerFunc { if funcs.InputValue == key { var names []string if funcs.IsList { - _ = global.DB.Raw("select ? from ? where ? in (?);", funcs.OutputColumn, funcs.DB, funcs.InputColumn, value).Scan(&names) + query := fmt.Sprintf("SELECT %s FROM %s WHERE %s in (?)", funcs.OutputColumn, funcs.DB, funcs.InputColumn) + _ = global.DB.Raw(query, value).Scan(&names) } else { - _ = global.DB.Raw("select ? from ? where ? = ?;", funcs.OutputColumn, funcs.DB, funcs.InputColumn, value).Scan(&names) + query := fmt.Sprintf("SELECT %s FROM %s WHERE %s = ?", funcs.OutputColumn, funcs.DB, funcs.InputColumn) + _ = global.DB.Raw(query, value).Scan(&names) } formatMap[funcs.OutputValue] = strings.Join(names, ",") break