|
@@ -13,6 +13,7 @@ import ( |
|
@@ -13,6 +13,7 @@ import ( |
13
|
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/infrastructure/excel"
|
13
|
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/infrastructure/excel"
|
14
|
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/infrastructure/starrocks"
|
14
|
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/infrastructure/starrocks"
|
15
|
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/infrastructure/utils"
|
15
|
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/infrastructure/utils"
|
|
|
16
|
+ "strings"
|
16
|
"time"
|
17
|
"time"
|
17
|
)
|
18
|
)
|
18
|
|
19
|
|
|
@@ -311,6 +312,39 @@ func (querySetService *QuerySetService) SearchQuerySet(ctx *domain.Context, sear |
|
@@ -311,6 +312,39 @@ func (querySetService *QuerySetService) SearchQuerySet(ctx *domain.Context, sear |
311
|
return nil, factory.FastError(err)
|
312
|
return nil, factory.FastError(err)
|
312
|
}
|
313
|
}
|
313
|
|
314
|
|
|
|
315
|
+ if len(searchQuerySetQuery.MatchName) > 0 {
|
|
|
316
|
+ mapQuerySet := (domain.QuerySets(querySets)).ToMap()
|
|
|
317
|
+ tmpQuerySets := make([]*domain.QuerySet, 0)
|
|
|
318
|
+ for _, item := range querySets {
|
|
|
319
|
+ if strings.Contains(item.Name, searchQuerySetQuery.MatchName) {
|
|
|
320
|
+ tmpQuerySets = append(tmpQuerySets, item)
|
|
|
321
|
+ }
|
|
|
322
|
+ }
|
|
|
323
|
+
|
|
|
324
|
+ tmpParentQuerySets := make([]*domain.QuerySet, 0)
|
|
|
325
|
+ mapTmpParentQuerySets := (domain.QuerySets(tmpQuerySets)).ToMap()
|
|
|
326
|
+ for _, item := range tmpQuerySets {
|
|
|
327
|
+ var parentId = item.ParentId
|
|
|
328
|
+ for {
|
|
|
329
|
+ if parentId <= 0 {
|
|
|
330
|
+ break
|
|
|
331
|
+ }
|
|
|
332
|
+ v, ok := mapQuerySet[parentId]
|
|
|
333
|
+ if !ok {
|
|
|
334
|
+ break
|
|
|
335
|
+ }
|
|
|
336
|
+ if _, ok := mapTmpParentQuerySets[v.QuerySetId]; !ok {
|
|
|
337
|
+ mapTmpParentQuerySets[v.QuerySetId] = v
|
|
|
338
|
+ tmpParentQuerySets = append(tmpParentQuerySets, v)
|
|
|
339
|
+ }
|
|
|
340
|
+ parentId = v.ParentId
|
|
|
341
|
+ }
|
|
|
342
|
+ }
|
|
|
343
|
+
|
|
|
344
|
+ tmpQuerySets = append(tmpQuerySets, tmpParentQuerySets...)
|
|
|
345
|
+ querySets = tmpQuerySets
|
|
|
346
|
+ }
|
|
|
347
|
+
|
314
|
var result = dto.NewQuerySetDtoList(querySets)
|
348
|
var result = dto.NewQuerySetDtoList(querySets)
|
315
|
|
349
|
|
316
|
if err := transactionContext.CommitTransaction(); err != nil {
|
350
|
if err := transactionContext.CommitTransaction(); err != nil {
|