|
@@ -1,6 +1,7 @@
|
|
|
package dao
|
|
|
|
|
|
import (
|
|
|
+ "fmt"
|
|
|
"gorm.io/gorm"
|
|
|
"iot_manager_service/app/warn/model"
|
|
|
"iot_manager_service/util/common"
|
|
@@ -30,7 +31,6 @@ func (r NoticeRecord) GetList(filter model.RequestNoticeRecordFilter) ([]NoticeR
|
|
|
var list []NoticeRecord
|
|
|
var total int64
|
|
|
db := Db.Debug().Model(&r)
|
|
|
- db = db.Scopes(common.Paginate(filter.Current, filter.Size)).Preload("NoticeSet")
|
|
|
// 告警类型
|
|
|
if filter.ClassifyName != 0 {
|
|
|
db = db.Where(&NoticeRecord{ArmClassify: filter.ClassifyName})
|
|
@@ -54,9 +54,12 @@ func (r NoticeRecord) GetList(filter model.RequestNoticeRecordFilter) ([]NoticeR
|
|
|
if filter.SendName != "" {
|
|
|
db = db.Where("send_name=?", filter.SendName)
|
|
|
}
|
|
|
- err := db.Preload("PlatformAlarm").Find(&list).Error
|
|
|
db.Count(&total)
|
|
|
- //fmt.Printf("total = %v", total)
|
|
|
+ db = db.Scopes(common.Paginate(filter.Current, filter.Size)).Preload("NoticeSet")
|
|
|
+
|
|
|
+ err := db.Preload("PlatformAlarm").Order("id desc").Find(&list).Error
|
|
|
+
|
|
|
+ fmt.Printf("total = %v", total)
|
|
|
return list, total, err
|
|
|
}
|
|
|
|