...
|
...
|
@@ -341,7 +341,9 @@ func (ptr *QuerySetService) validDependentCircle(ctx *domain.Context, querySet * |
|
|
}
|
|
|
}
|
|
|
for _, t := range validTables {
|
|
|
if t.TableType == domain.SchemaTable.ToString() || t.TableType == domain.SubProcessTable.ToString() {
|
|
|
if t.TableType == domain.SchemaTable.ToString() ||
|
|
|
t.TableType == domain.SubProcessTable.ToString() ||
|
|
|
t.TableType == domain.CalculateTable.ToString() {
|
|
|
validTables = append(validTables, t)
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -715,7 +717,12 @@ func (ptr *QuerySetService) CreateOrUpdateCalculateTable(ctx *domain.Context, qu |
|
|
aggregationFields := queryComponent.Aggregation.AggregationFields()
|
|
|
selectedFields := make([]string, 0)
|
|
|
for index, f := range aggregationFields {
|
|
|
fields = append(fields, DataField(f.DisplayName, f.Field.SQLType, domain.MainTableField, index))
|
|
|
// 数值类型转浮点类型, 兼容类似表达式 1 * 1.1
|
|
|
sqlType := f.Field.SQLType
|
|
|
if f.Field.SQLType == domain.Int.ToString() || f.Field.SQLType == domain.BigInt.ToString() {
|
|
|
sqlType = domain.Float.ToString()
|
|
|
}
|
|
|
fields = append(fields, DataField(f.DisplayName, sqlType, domain.MainTableField, index))
|
|
|
selectedFields = append(selectedFields, f.Field.Name)
|
|
|
}
|
|
|
queryComponent.Aggregation.SelectFields = selectedFields
|
...
|
...
|
@@ -729,6 +736,11 @@ func (ptr *QuerySetService) CreateOrUpdateCalculateTable(ctx *domain.Context, qu |
|
|
table.UpdatedAt = time.Now()
|
|
|
}
|
|
|
|
|
|
// 循环依赖判断
|
|
|
if err = ptr.validDependentCircle(ctx, querySet, queryComponents); err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
|
|
|
table.TableInfo.ApplyOnModule = domain.ModuleAll
|
|
|
table.TableInfo.DependencyTables = dependencyTables
|
|
|
table, err = tableRepository.Save(table)
|
...
|
...
|
@@ -1032,7 +1044,11 @@ func insertQuerySetsByIndex(list []*domain.QuerySet, item *domain.QuerySet, inde |
|
|
|
|
|
func (ptr *QuerySetService) DependencyGraph(ctx *domain.Context, querySetId int) (interface{}, error) {
|
|
|
tableRepository, _ := repository.NewTableRepository(ptr.transactionContext)
|
|
|
_, tables, err := tableRepository.Find(map[string]interface{}{"context": ctx, "tableTypes": []string{domain.SchemaTable.ToString(), domain.SubProcessTable.ToString()}})
|
|
|
_, tables, err := tableRepository.Find(map[string]interface{}{"context": ctx, "tableTypes": []string{
|
|
|
domain.SchemaTable.ToString(),
|
|
|
domain.SubProcessTable.ToString(),
|
|
|
domain.CalculateTable.ToString(),
|
|
|
}})
|
|
|
var dependencies TableDependTree = NewTableDependTree(nil, nil)
|
|
|
if err != nil {
|
|
|
return dependencies, err
|
...
|
...
|
|