From 6245387899ed71d2a0c95be9e6e1c7f096d77df4 Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Fri, 1 Sep 2023 13:30:34 +0800 Subject: [PATCH] fix --- server/info/internal/logic/infologic.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/info/internal/logic/infologic.go b/server/info/internal/logic/infologic.go index cd61b2e1..2030eb57 100644 --- a/server/info/internal/logic/infologic.go +++ b/server/info/internal/logic/infologic.go @@ -49,6 +49,7 @@ type InfoType struct { } type ModuleQuery struct { + TableName string ModuleName string ModuleQuery map[string]struct{} } @@ -105,6 +106,7 @@ func (l *InfoLogic) Info(req *types.UserInfoRequest, userinfo *auth.UserInfo) (r mquery.ModuleQuery[strings.Join(mlist[1:], ",")] = struct{}{} } else { mquery := &ModuleQuery{ + TableName: mtable, ModuleName: mtable, ModuleQuery: map[string]struct{}{strings.Join(mlist[1:], ","): {}}} mquerys[mtable] = mquery @@ -113,7 +115,7 @@ func (l *InfoLogic) Info(req *types.UserInfoRequest, userinfo *auth.UserInfo) (r for _, mquery := range mquerys { - sqlstr := fmt.Sprintf("select id, module, %s as querydata from %s where %s ", mquery.EncodeQuery("metadata"), mquery.ModuleName, cond) + sqlstr := fmt.Sprintf("select id, module, %s as querydata from %s where %s ", mquery.EncodeQuery("metadata"), mquery.TableName, cond) var info InfoType err := l.svcCtx.MysqlConn.Raw(sqlstr).Scan(&info).Error if err == gorm.ErrRecordNotFound {