...
|
...
|
@@ -2,13 +2,13 @@ package table |
|
|
|
|
|
import (
|
|
|
"context"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/interanl/pkg/gateway/bytelib"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/pkg/xerr"
|
|
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/svc"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/types"
|
|
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/interanl/pkg/gateway/bytelib"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/pkg/xerr"
|
|
|
"sort"
|
|
|
"strings"
|
|
|
)
|
|
|
|
|
|
type SearchTableDataLogic struct {
|
...
|
...
|
@@ -48,6 +48,28 @@ func (l *SearchTableDataLogic) SearchTableData(req *types.SearchTableDataRequest |
|
|
if err != nil {
|
|
|
return resp, xerr.NewErr(err)
|
|
|
}
|
|
|
//排序
|
|
|
orderField := ""
|
|
|
orderBy := ""
|
|
|
for _, item := range req.Condition {
|
|
|
if item.Order != "" {
|
|
|
orderField = item.FieldName
|
|
|
orderBy = item.Order
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
sort.Slice(response.Grid.List, func(i, j int) bool {
|
|
|
if _, ok := response.Grid.List[i][orderField]; ok {
|
|
|
if _, ok := response.Grid.List[j][orderField]; ok {
|
|
|
if strings.ToLower(orderBy) == "asc" {
|
|
|
return response.Grid.List[i][orderField] < response.Grid.List[j][orderField]
|
|
|
} else {
|
|
|
return response.Grid.List[i][orderField] > response.Grid.List[j][orderField]
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return true
|
|
|
})
|
|
|
resp = map[string]interface{}{
|
|
|
"objectId": response.ObjectId,
|
|
|
"fields": removeIdField(response.Fields),
|
...
|
...
|
|