bug:修改设备列表参数

This commit is contained in:
qi.zhou 2025-06-16 21:25:26 +08:00
parent 6a8a6c0fff
commit c01f75b003
2 changed files with 4 additions and 3 deletions

View File

@ -2,6 +2,7 @@ package dal
import (
"context"
"strings"
"ifms/internal/consts"
"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 {
db = db.Where("type=?", *params.Type)
}
if params.WorkshopID != 0 {
db = db.Where("workshop_id=?", params.WorkshopID)
if params.WorkshopId != "" {
db = db.Where("workshop_id in (?)", strings.Split(params.WorkshopId, ","))
}
var list schema.EnvMonitorDevices
pageResult, err := util.WrapPageQuery(ctx, db, params.PaginationParam, opt.QueryOptions, &list)

View File

@ -35,7 +35,7 @@ type EnvMonitorDeviceQueryParam struct {
util.PaginationParam
DeviceName string `form:"device_name"`
Type *int `form:"type"`
WorkshopID int64 `form:"workshop_id"`
WorkshopId string `form:"workshop_id"`
}
// Defining the query options for the `EnvMonitorDevice` struct.