作者 yangfu

表对象搜索排序

1 package service 1 package service
2 2
3 import ( 3 import (
4 - "fmt"  
5 "github.com/linmadan/egglib-go/core/application" 4 "github.com/linmadan/egglib-go/core/application"
6 "gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/application/factory" 5 "gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/application/factory"
7 "gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/application/table/dto" 6 "gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/application/table/dto"
@@ -84,6 +83,10 @@ func (tableService *TableService) TableObjectSearch(searchQuery *query.SearchTab @@ -84,6 +83,10 @@ func (tableService *TableService) TableObjectSearch(searchQuery *query.SearchTab
84 if filterTableByFilterRule(t, searchQuery) { 83 if filterTableByFilterRule(t, searchQuery) {
85 continue 84 continue
86 } 85 }
  86 + // 默认关闭的都不返回(拆解、计算)
  87 + if t.Status == domain.StatusOff {
  88 + continue
  89 + }
87 if !domain.TableType(t.TableType).TableIsSplitByGroup() { 90 if !domain.TableType(t.TableType).TableIsSplitByGroup() {
88 response = append(response, t) 91 response = append(response, t)
89 continue 92 continue
@@ -121,9 +124,10 @@ func (tableService *TableService) TableObjectSearch(searchQuery *query.SearchTab @@ -121,9 +124,10 @@ func (tableService *TableService) TableObjectSearch(searchQuery *query.SearchTab
121 sort.Slice(response, func(i, j int) bool { 124 sort.Slice(response, func(i, j int) bool {
122 item1 := response[i] 125 item1 := response[i]
123 item2 := response[j] 126 item2 := response[j]
124 - k1 := fmt.Sprintf("%v-%v-%v", item1.TableType, item1.ParentId, item1.Id)  
125 - k2 := fmt.Sprintf("%v-%v-%v", item2.TableType, item2.ParentId, item2.Id)  
126 - return k1 < k2 127 + //k1 := fmt.Sprintf("%v-%v-%v", item1.TableType, item1.ParentId, item1.Id)
  128 + //k2 := fmt.Sprintf("%v-%v-%v", item2.TableType, item2.ParentId, item2.Id)
  129 + //return k1 < k2
  130 + return item1.Id < item2.Id
127 }) 131 })
128 return map[string]interface{}{ 132 return map[string]interface{}{
129 "count": len(response), 133 "count": len(response),