|
@@ -341,7 +341,9 @@ func (ptr *QuerySetService) validDependentCircle(ctx *domain.Context, querySet * |
|
@@ -341,7 +341,9 @@ func (ptr *QuerySetService) validDependentCircle(ctx *domain.Context, querySet * |
341
|
}
|
341
|
}
|
342
|
}
|
342
|
}
|
343
|
for _, t := range validTables {
|
343
|
for _, t := range validTables {
|
344
|
- if t.TableType == domain.SchemaTable.ToString() || t.TableType == domain.SubProcessTable.ToString() {
|
344
|
+ if t.TableType == domain.SchemaTable.ToString() ||
|
|
|
345
|
+ t.TableType == domain.SubProcessTable.ToString() ||
|
|
|
346
|
+ t.TableType == domain.CalculateTable.ToString() {
|
345
|
validTables = append(validTables, t)
|
347
|
validTables = append(validTables, t)
|
346
|
}
|
348
|
}
|
347
|
}
|
349
|
}
|
|
@@ -715,7 +717,12 @@ func (ptr *QuerySetService) CreateOrUpdateCalculateTable(ctx *domain.Context, qu |
|
@@ -715,7 +717,12 @@ func (ptr *QuerySetService) CreateOrUpdateCalculateTable(ctx *domain.Context, qu |
715
|
aggregationFields := queryComponent.Aggregation.AggregationFields()
|
717
|
aggregationFields := queryComponent.Aggregation.AggregationFields()
|
716
|
selectedFields := make([]string, 0)
|
718
|
selectedFields := make([]string, 0)
|
717
|
for index, f := range aggregationFields {
|
719
|
for index, f := range aggregationFields {
|
718
|
- fields = append(fields, DataField(f.DisplayName, f.Field.SQLType, domain.MainTableField, index))
|
720
|
+ // 数值类型转浮点类型, 兼容类似表达式 1 * 1.1
|
|
|
721
|
+ sqlType := f.Field.SQLType
|
|
|
722
|
+ if f.Field.SQLType == domain.Int.ToString() || f.Field.SQLType == domain.BigInt.ToString() {
|
|
|
723
|
+ sqlType = domain.Float.ToString()
|
|
|
724
|
+ }
|
|
|
725
|
+ fields = append(fields, DataField(f.DisplayName, sqlType, domain.MainTableField, index))
|
719
|
selectedFields = append(selectedFields, f.Field.Name)
|
726
|
selectedFields = append(selectedFields, f.Field.Name)
|
720
|
}
|
727
|
}
|
721
|
queryComponent.Aggregation.SelectFields = selectedFields
|
728
|
queryComponent.Aggregation.SelectFields = selectedFields
|
|
@@ -729,6 +736,11 @@ func (ptr *QuerySetService) CreateOrUpdateCalculateTable(ctx *domain.Context, qu |
|
@@ -729,6 +736,11 @@ func (ptr *QuerySetService) CreateOrUpdateCalculateTable(ctx *domain.Context, qu |
729
|
table.UpdatedAt = time.Now()
|
736
|
table.UpdatedAt = time.Now()
|
730
|
}
|
737
|
}
|
731
|
|
738
|
|
|
|
739
|
+ // 循环依赖判断
|
|
|
740
|
+ if err = ptr.validDependentCircle(ctx, querySet, queryComponents); err != nil {
|
|
|
741
|
+ return nil, err
|
|
|
742
|
+ }
|
|
|
743
|
+
|
732
|
table.TableInfo.ApplyOnModule = domain.ModuleAll
|
744
|
table.TableInfo.ApplyOnModule = domain.ModuleAll
|
733
|
table.TableInfo.DependencyTables = dependencyTables
|
745
|
table.TableInfo.DependencyTables = dependencyTables
|
734
|
table, err = tableRepository.Save(table)
|
746
|
table, err = tableRepository.Save(table)
|
|
@@ -1032,7 +1044,11 @@ func insertQuerySetsByIndex(list []*domain.QuerySet, item *domain.QuerySet, inde |
|
@@ -1032,7 +1044,11 @@ func insertQuerySetsByIndex(list []*domain.QuerySet, item *domain.QuerySet, inde |
1032
|
|
1044
|
|
1033
|
func (ptr *QuerySetService) DependencyGraph(ctx *domain.Context, querySetId int) (interface{}, error) {
|
1045
|
func (ptr *QuerySetService) DependencyGraph(ctx *domain.Context, querySetId int) (interface{}, error) {
|
1034
|
tableRepository, _ := repository.NewTableRepository(ptr.transactionContext)
|
1046
|
tableRepository, _ := repository.NewTableRepository(ptr.transactionContext)
|
1035
|
- _, tables, err := tableRepository.Find(map[string]interface{}{"context": ctx, "tableTypes": []string{domain.SchemaTable.ToString(), domain.SubProcessTable.ToString()}})
|
1047
|
+ _, tables, err := tableRepository.Find(map[string]interface{}{"context": ctx, "tableTypes": []string{
|
|
|
1048
|
+ domain.SchemaTable.ToString(),
|
|
|
1049
|
+ domain.SubProcessTable.ToString(),
|
|
|
1050
|
+ domain.CalculateTable.ToString(),
|
|
|
1051
|
+ }})
|
1036
|
var dependencies TableDependTree = NewTableDependTree(nil, nil)
|
1052
|
var dependencies TableDependTree = NewTableDependTree(nil, nil)
|
1037
|
if err != nil {
|
1053
|
if err != nil {
|
1038
|
return dependencies, err
|
1054
|
return dependencies, err
|