order by cate and name
This commit is contained in:
parent
d0efb206d9
commit
e8c0d6b987
|
@ -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
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue