提交 e8c0d6b9 编写于 作者: U Ulric Qin

order by cate and name

上级 d0efb206
......@@ -108,6 +108,9 @@ func AlertAggrViewGets(createBy interface{}) ([]AlertAggrView, error) {
err := DB().Where("create_by = ? or cate = 0", createBy).Find(&lst).Error
if err == nil && len(lst) > 0 {
sort.Slice(lst, func(i, j int) bool {
if lst[i].Cate < lst[j].Cate {
return true
}
return lst[i].Name < lst[j].Name
})
}
......
......@@ -74,6 +74,9 @@ func MetricViewGets(createBy interface{}) ([]MetricView, error) {
err := DB().Where("create_by = ? or cate = 0", createBy).Find(&lst).Error
if err == nil && len(lst) > 0 {
sort.Slice(lst, func(i, j int) bool {
if lst[i].Cate < lst[j].Cate {
return true
}
return lst[i].Name < lst[j].Name
})
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册