作者 yangfu

Merge branch 'test' of http://gitlab.fjmaimaimai.com/allied-creation/character-l…

…ibrary-metadata-bastion into test
@@ -26,7 +26,6 @@ require ( @@ -26,7 +26,6 @@ require (
26 github.com/sergi/go-diff v1.2.0 // indirect 26 github.com/sergi/go-diff v1.2.0 // indirect
27 github.com/shopspring/decimal v1.3.1 27 github.com/shopspring/decimal v1.3.1
28 github.com/smartystreets/goconvey v1.7.2 // indirect 28 github.com/smartystreets/goconvey v1.7.2 // indirect
29 - github.com/sony/sonyflake v1.1.0 // indirect  
30 github.com/stretchr/testify v1.7.1 29 github.com/stretchr/testify v1.7.1
31 github.com/valyala/fasthttp v1.38.0 // indirect 30 github.com/valyala/fasthttp v1.38.0 // indirect
32 github.com/xeipuuv/gojsonschema v1.2.0 // indirect 31 github.com/xeipuuv/gojsonschema v1.2.0 // indirect
@@ -162,12 +162,7 @@ func NewFormulaCalculate(table *domain.Table, queryComponent *domain.QueryCompon @@ -162,12 +162,7 @@ func NewFormulaCalculate(table *domain.Table, queryComponent *domain.QueryCompon
162 } 162 }
163 if queryComponent.Aggregation != nil { 163 if queryComponent.Aggregation != nil {
164 res.DatabaseTableName = queryComponent.MasterTable.SQLName 164 res.DatabaseTableName = queryComponent.MasterTable.SQLName
165 - for i, f := range queryComponent.Aggregation.ValueFields {  
166 - tableField, ok := table.MatchField(&domain.Field{Name: f.DisplayName})  
167 - if !ok {  
168 - continue  
169 - }  
170 - if i == 0 { 165 + if len(queryComponent.Aggregation.ValueFields)>0 || len(queryComponent.Aggregation.RowFields)>0{
171 res.FormulaCalculateFields = append(res.FormulaCalculateFields, &FormulaCalculateField{ 166 res.FormulaCalculateFields = append(res.FormulaCalculateFields, &FormulaCalculateField{
172 DatabaseTableName: queryComponent.MasterTable.SQLName, 167 DatabaseTableName: queryComponent.MasterTable.SQLName,
173 FieldSchema: NewFieldSchemaFromField(&domain.Field{ 168 FieldSchema: NewFieldSchemaFromField(&domain.Field{
@@ -179,6 +174,11 @@ func NewFormulaCalculate(table *domain.Table, queryComponent *domain.QueryCompon @@ -179,6 +174,11 @@ func NewFormulaCalculate(table *domain.Table, queryComponent *domain.QueryCompon
179 CalculateFieldName: "id", 174 CalculateFieldName: "id",
180 }) 175 })
181 } 176 }
  177 + for _, f := range queryComponent.Aggregation.ValueFields {
  178 + tableField, ok := table.MatchField(&domain.Field{Name: f.DisplayName})
  179 + if !ok {
  180 + continue
  181 + }
182 res.FormulaCalculateFields = append(res.FormulaCalculateFields, &FormulaCalculateField{ 182 res.FormulaCalculateFields = append(res.FormulaCalculateFields, &FormulaCalculateField{
183 DatabaseTableName: queryComponent.MasterTable.SQLName, 183 DatabaseTableName: queryComponent.MasterTable.SQLName,
184 FieldSchema: NewFieldSchemaFromField(f.Field), 184 FieldSchema: NewFieldSchemaFromField(f.Field),