From 63fe0fcbb22b1855b91a053599ffb05c80712d71 Mon Sep 17 00:00:00 2001 From: yuanruji Date: Thu, 19 Sep 2024 10:30:49 +0800 Subject: [PATCH] =?UTF-8?q?fix(dbm-services):=20=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E5=8C=B9=E9=85=8Dwindows=20os=20name=20#6984?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/db-resource/internal/svr/apply/apply.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dbm-services/common/db-resource/internal/svr/apply/apply.go b/dbm-services/common/db-resource/internal/svr/apply/apply.go index d1fd6d9e43..531f727037 100644 --- a/dbm-services/common/db-resource/internal/svr/apply/apply.go +++ b/dbm-services/common/db-resource/internal/svr/apply/apply.go @@ -124,7 +124,12 @@ func (o *SearchContext) pickBase(db *gorm.DB) { Value: "%" + strings.TrimSpace(strings.ToLower(osname)) + "%", }) } - db.Clauses(clause.OrConditions{Exprs: conditions}) + if len(conditions) == 1 { + db.Clauses(clause.AndConditions{Exprs: conditions}) + } else { + // 有多个条件,使用or,才会被用()包括起来所有的or条件 + db.Clauses(clause.OrConditions{Exprs: conditions}) + } } // 如果没有指定资源类型,表示只能选择无资源类型标签的资源