作者 yangfu

fix: copy CalculateSet

... ... @@ -275,6 +275,8 @@ type (
QuerySet *QuerySet
Table *Table
QueryComponents []*QueryComponent
QuerySetService interface{}
Context interface{}
}
DataFormulasGenerate struct {
... ...
... ... @@ -2,6 +2,7 @@ package domainService
import (
"bytes"
"github.com/beego/beego/v2/client/httplib"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/constant"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/domain"
... ... @@ -146,6 +147,13 @@ func (ptr *ByteCoreService) FormulasGenerate(param domain.ReqFormulasGenerate) (
// }
// return &domain.DataFormulasGenerate{}, nil
//}
if param.QuerySet.Type == domain.CalculateSet.ToString() {
_, err := param.QuerySetService.(*QuerySetService).LoadCalculateSetData(param.Context.(*domain.Context), param.QuerySet, param.QueryComponents)
if err != nil {
return nil, err
}
return &domain.DataFormulasGenerate{}, nil
}
return apiByteLib.FormulasGenerate(param)
}
... ...
... ... @@ -944,22 +944,24 @@ func (ptr *QuerySetService) Copy(ctx *domain.Context, querySetId int, t string,
}
// 调用底层的组装sql
formulasGenerateResponse, err := ByteCore.FormulasGenerate(domain.ReqFormulasGenerate{
_, err = ByteCore.FormulasGenerate(domain.ReqFormulasGenerate{
QuerySet: qs,
Table: copyTable,
QueryComponents: qs.QueryComponents,
QuerySetService: ptr,
Context: ctx,
})
if err != nil {
return nil, err
}
if len(formulasGenerateResponse.FormulaName) > 0 && formulasGenerateResponse.FormulaName != table.SQLName {
//if len(formulasGenerateResponse.FormulaName) > 0 && formulasGenerateResponse.FormulaName != table.SQLName {
//copyTable.SQLName = formulasGenerateResponse.FormulaName
//tableRepository, _ := repository.NewTableRepository(ptr.transactionContext)
//copyTable, err = tableRepository.Save(copyTable)
//if err != nil {
// return nil, err
//}
}
//}
copy.QuerySetInfo.BindTableId = copyTable.TableId
}
copy, err = querySetRepository.Save(copy)
... ...