正在显示
1 个修改的文件
包含
12 行增加
和
10 行删除
@@ -58,18 +58,20 @@ func (l *SearchTableDataLogic) SearchTableData(req *types.SearchTableDataRequest | @@ -58,18 +58,20 @@ func (l *SearchTableDataLogic) SearchTableData(req *types.SearchTableDataRequest | ||
58 | break | 58 | break |
59 | } | 59 | } |
60 | } | 60 | } |
61 | - sort.Slice(response.Grid.List, func(i, j int) bool { | ||
62 | - if _, ok := response.Grid.List[i][orderField]; ok { | ||
63 | - if _, ok := response.Grid.List[j][orderField]; ok { | ||
64 | - if strings.ToLower(orderBy) == "asc" { | ||
65 | - return response.Grid.List[i][orderField] < response.Grid.List[j][orderField] | ||
66 | - } else { | ||
67 | - return response.Grid.List[i][orderField] > response.Grid.List[j][orderField] | 61 | + if orderField != "" && orderBy != "" { |
62 | + sort.Slice(response.Grid.List, func(i, j int) bool { | ||
63 | + if _, ok := response.Grid.List[i][orderField]; ok { | ||
64 | + if _, ok := response.Grid.List[j][orderField]; ok { | ||
65 | + if strings.ToLower(orderBy) == "asc" { | ||
66 | + return response.Grid.List[i][orderField] < response.Grid.List[j][orderField] | ||
67 | + } else { | ||
68 | + return response.Grid.List[i][orderField] > response.Grid.List[j][orderField] | ||
69 | + } | ||
68 | } | 70 | } |
69 | } | 71 | } |
70 | - } | ||
71 | - return true | ||
72 | - }) | 72 | + return true |
73 | + }) | ||
74 | + } | ||
73 | resp = map[string]interface{}{ | 75 | resp = map[string]interface{}{ |
74 | "objectId": response.ObjectId, | 76 | "objectId": response.ObjectId, |
75 | "fields": removeIdField(response.Fields), | 77 | "fields": removeIdField(response.Fields), |
-
请 注册 或 登录 后发表评论