mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-07-01 01:36:11 +08:00
fix(region): distinct fields (#20358)
This commit is contained in:
@@ -513,7 +513,7 @@ func (manager *SModelBaseManager) GetPropertyDistinctFields(ctx context.Context,
|
||||
result := jsonutils.NewDict()
|
||||
fields := jsonutils.NewArray()
|
||||
if len(input.Field) > 0 {
|
||||
sq := q.Copy()
|
||||
sq := q.Copy().ResetFields()
|
||||
// query field
|
||||
for i := 0; i < len(input.Field); i++ {
|
||||
sq = sq.AppendField(sq.Field(input.Field[i]))
|
||||
@@ -536,7 +536,7 @@ func (manager *SModelBaseManager) GetPropertyDistinctFields(ctx context.Context,
|
||||
extraFields := jsonutils.NewArray()
|
||||
if len(input.ExtraResource) > 0 && len(input.ExtraField) > 0 {
|
||||
// query extra field
|
||||
sq := q.Copy()
|
||||
sq := q.Copy().ResetFields()
|
||||
em := GetModelManager(input.ExtraResource)
|
||||
if gotypes.IsNil(em) {
|
||||
return nil, httperrors.NewInputParameterError("invalid extra_resource %s", input.ExtraResource)
|
||||
|
||||
3
vendor/yunion.io/x/sqlchemy/query.go
generated
vendored
3
vendor/yunion.io/x/sqlchemy/query.go
generated
vendored
@@ -50,7 +50,8 @@ type sQueryJoin struct {
|
||||
}
|
||||
|
||||
// SQuery is a data structure represents a SQL query in the form of
|
||||
// SELECT ... FROM ... JOIN ... ON ... WHERE ... GROUP BY ... ORDER BY ... HAVING ...
|
||||
//
|
||||
// SELECT ... FROM ... JOIN ... ON ... WHERE ... GROUP BY ... ORDER BY ... HAVING ...
|
||||
type SQuery struct {
|
||||
rawSql string
|
||||
fields []IQueryField
|
||||
|
||||
Reference in New Issue
Block a user