bug:修改导出参数
This commit is contained in:
parent
6030eed880
commit
4f81d1013f
@ -3,6 +3,7 @@ package dal
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"ifms/internal/consts"
|
||||
"ifms/internal/mods/envmonitor/schema"
|
||||
@ -37,6 +38,14 @@ func (a *EnvMonitorDeviceWarningLog) QueryAll(ctx context.Context, params schema
|
||||
db = db.Where("created_at <= ?", params.EndTime)
|
||||
}
|
||||
|
||||
if params.IsOK != nil {
|
||||
db = db.Where("is_ok = ?", *params.IsOK)
|
||||
}
|
||||
|
||||
if params.Ids != "" {
|
||||
db = db.Where("id in (?)", strings.Split(params.Ids, ","))
|
||||
}
|
||||
|
||||
var list []*schema.EnvMonitorDeviceWarningLog
|
||||
err := db.Find(&list).Error
|
||||
if err != nil {
|
||||
@ -67,6 +76,10 @@ func (a *EnvMonitorDeviceWarningLog) Query(ctx context.Context, params schema.En
|
||||
db = db.Where("is_ok = ?", *params.IsOK)
|
||||
}
|
||||
|
||||
if params.Ids != "" {
|
||||
db = db.Where("id in (?)", strings.Split(params.Ids, ","))
|
||||
}
|
||||
|
||||
var list schema.EnvMonitorDeviceWarningLogs
|
||||
pageResult, err := util.WrapPageQuery(ctx, db, params.PaginationParam, opt.QueryOptions, &list)
|
||||
if err != nil {
|
||||
|
@ -32,6 +32,7 @@ type EnvMonitorDeviceWarningLogQueryParam struct {
|
||||
StartTime string `form:"start_time"` // 开始时间
|
||||
EndTime string `form:"end_time"` // 结束时间
|
||||
IsOK *bool `form:"is_ok"` // 是否正常
|
||||
Ids string `form:"ids"` // 设备ID
|
||||
}
|
||||
|
||||
// Defining the query options for the `EnvMonitorDeviceWarningLog` struct.
|
||||
|
Loading…
x
Reference in New Issue
Block a user