bug:修改设备列表参数
This commit is contained in:
parent
6a8a6c0fff
commit
c01f75b003
@ -2,6 +2,7 @@ package dal
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"ifms/internal/consts"
|
"ifms/internal/consts"
|
||||||
"ifms/internal/mods/envmonitor/schema"
|
"ifms/internal/mods/envmonitor/schema"
|
||||||
@ -38,8 +39,8 @@ func (a *EnvMonitorDevice) Query(ctx context.Context, params schema.EnvMonitorDe
|
|||||||
if params.Type != nil && *params.Type != 0 {
|
if params.Type != nil && *params.Type != 0 {
|
||||||
db = db.Where("type=?", *params.Type)
|
db = db.Where("type=?", *params.Type)
|
||||||
}
|
}
|
||||||
if params.WorkshopID != 0 {
|
if params.WorkshopId != "" {
|
||||||
db = db.Where("workshop_id=?", params.WorkshopID)
|
db = db.Where("workshop_id in (?)", strings.Split(params.WorkshopId, ","))
|
||||||
}
|
}
|
||||||
var list schema.EnvMonitorDevices
|
var list schema.EnvMonitorDevices
|
||||||
pageResult, err := util.WrapPageQuery(ctx, db, params.PaginationParam, opt.QueryOptions, &list)
|
pageResult, err := util.WrapPageQuery(ctx, db, params.PaginationParam, opt.QueryOptions, &list)
|
||||||
|
@ -35,7 +35,7 @@ type EnvMonitorDeviceQueryParam struct {
|
|||||||
util.PaginationParam
|
util.PaginationParam
|
||||||
DeviceName string `form:"device_name"`
|
DeviceName string `form:"device_name"`
|
||||||
Type *int `form:"type"`
|
Type *int `form:"type"`
|
||||||
WorkshopID int64 `form:"workshop_id"`
|
WorkshopId string `form:"workshop_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Defining the query options for the `EnvMonitorDevice` struct.
|
// Defining the query options for the `EnvMonitorDevice` struct.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user