diff --git a/pkg/cloudcommon/db/domain.go b/pkg/cloudcommon/db/domain.go index f4ac19763f..f419874e3f 100644 --- a/pkg/cloudcommon/db/domain.go +++ b/pkg/cloudcommon/db/domain.go @@ -91,7 +91,7 @@ func ValidateCreateDomainId(domainId string) error { func (manager *SDomainizedResourceBaseManager) QueryDistinctExtraField(q *sqlchemy.SQuery, field string) (*sqlchemy.SQuery, error) { switch field { case "domain": - tenantCacheQuery := TenantCacheManager.GetDomainQuery("name", "id").SubQuery() + tenantCacheQuery := TenantCacheManager.getTable() // GetDomainQuery("name", "id").SubQuery() q = q.AppendField(tenantCacheQuery.Field("name", "domain")).Distinct() q = q.Join(tenantCacheQuery, sqlchemy.Equals(q.Field("domain_id"), tenantCacheQuery.Field("id"))) return q, nil diff --git a/pkg/cloudcommon/db/project.go b/pkg/cloudcommon/db/project.go index 02c86b3ee3..fa4577adad 100644 --- a/pkg/cloudcommon/db/project.go +++ b/pkg/cloudcommon/db/project.go @@ -77,7 +77,7 @@ func (manager *SProjectizedResourceBaseManager) FetchOwnerId(ctx context.Context func (manager *SProjectizedResourceBaseManager) QueryDistinctExtraField(q *sqlchemy.SQuery, field string) (*sqlchemy.SQuery, error) { switch field { case "tenant": - tenantCacheQuery := TenantCacheManager.GetTenantQuery("name", "id").Distinct().SubQuery() + tenantCacheQuery := TenantCacheManager.getTable() // GetTenantQuery("name", "id").Distinct().SubQuery() q.AppendField(tenantCacheQuery.Field("name", "tenant")).Distinct() q = q.Join(tenantCacheQuery, sqlchemy.Equals(q.Field("tenant_id"), tenantCacheQuery.Field("id"))) return q, nil