作者 yangfu

fix: copy CalculateSet

@@ -275,6 +275,8 @@ type ( @@ -275,6 +275,8 @@ type (
275 QuerySet *QuerySet 275 QuerySet *QuerySet
276 Table *Table 276 Table *Table
277 QueryComponents []*QueryComponent 277 QueryComponents []*QueryComponent
  278 + QuerySetService interface{}
  279 + Context interface{}
278 } 280 }
279 281
280 DataFormulasGenerate struct { 282 DataFormulasGenerate struct {
@@ -2,6 +2,7 @@ package domainService @@ -2,6 +2,7 @@ package domainService
2 2
3 import ( 3 import (
4 "bytes" 4 "bytes"
  5 +
5 "github.com/beego/beego/v2/client/httplib" 6 "github.com/beego/beego/v2/client/httplib"
6 "gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/constant" 7 "gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/constant"
7 "gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/domain" 8 "gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/domain"
@@ -146,6 +147,13 @@ func (ptr *ByteCoreService) FormulasGenerate(param domain.ReqFormulasGenerate) ( @@ -146,6 +147,13 @@ func (ptr *ByteCoreService) FormulasGenerate(param domain.ReqFormulasGenerate) (
146 // } 147 // }
147 // return &domain.DataFormulasGenerate{}, nil 148 // return &domain.DataFormulasGenerate{}, nil
148 //} 149 //}
  150 + if param.QuerySet.Type == domain.CalculateSet.ToString() {
  151 + _, err := param.QuerySetService.(*QuerySetService).LoadCalculateSetData(param.Context.(*domain.Context), param.QuerySet, param.QueryComponents)
  152 + if err != nil {
  153 + return nil, err
  154 + }
  155 + return &domain.DataFormulasGenerate{}, nil
  156 + }
149 return apiByteLib.FormulasGenerate(param) 157 return apiByteLib.FormulasGenerate(param)
150 } 158 }
151 159
@@ -944,22 +944,24 @@ func (ptr *QuerySetService) Copy(ctx *domain.Context, querySetId int, t string, @@ -944,22 +944,24 @@ func (ptr *QuerySetService) Copy(ctx *domain.Context, querySetId int, t string,
944 } 944 }
945 945
946 // 调用底层的组装sql 946 // 调用底层的组装sql
947 - formulasGenerateResponse, err := ByteCore.FormulasGenerate(domain.ReqFormulasGenerate{ 947 + _, err = ByteCore.FormulasGenerate(domain.ReqFormulasGenerate{
948 QuerySet: qs, 948 QuerySet: qs,
949 Table: copyTable, 949 Table: copyTable,
950 QueryComponents: qs.QueryComponents, 950 QueryComponents: qs.QueryComponents,
  951 + QuerySetService: ptr,
  952 + Context: ctx,
951 }) 953 })
952 if err != nil { 954 if err != nil {
953 return nil, err 955 return nil, err
954 } 956 }
955 - if len(formulasGenerateResponse.FormulaName) > 0 && formulasGenerateResponse.FormulaName != table.SQLName { 957 + //if len(formulasGenerateResponse.FormulaName) > 0 && formulasGenerateResponse.FormulaName != table.SQLName {
956 //copyTable.SQLName = formulasGenerateResponse.FormulaName 958 //copyTable.SQLName = formulasGenerateResponse.FormulaName
957 //tableRepository, _ := repository.NewTableRepository(ptr.transactionContext) 959 //tableRepository, _ := repository.NewTableRepository(ptr.transactionContext)
958 //copyTable, err = tableRepository.Save(copyTable) 960 //copyTable, err = tableRepository.Save(copyTable)
959 //if err != nil { 961 //if err != nil {
960 // return nil, err 962 // return nil, err
961 //} 963 //}
962 - } 964 + //}
963 copy.QuerySetInfo.BindTableId = copyTable.TableId 965 copy.QuerySetInfo.BindTableId = copyTable.TableId
964 } 966 }
965 copy, err = querySetRepository.Save(copy) 967 copy, err = querySetRepository.Save(copy)