作者 yangfu

表对象搜索排序

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