This commit is contained in:
eson 2023-09-01 13:30:34 +08:00
parent 8337900423
commit 6245387899

View File

@ -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 {