提交 01d694d0 编写于 作者: J Jason

接口修改

上级 d321af3d
......@@ -25,8 +25,10 @@ func Open() error {
//同步表
return Engine.Sync2(
models.Tunnel{}, models.Link{}, models.Device{}, models.Plugin{},
models.Project{}, models.ProjectJob{}, models.ProjectStrategy{},
models.Tunnel{}, models.Link{},
models.Device{}, models.Location{},
models.Plugin{},
models.Project{}, models.ProjectElement{}, models.ProjectJob{}, models.ProjectStrategy{},
models.Element{}, models.ElementVariable{}, models.ElementBatch{},
)
}
......@@ -30,11 +30,11 @@ func curdApiList(mod reflect.Type) gin.HandlerFunc {
op := db.Engine.Limit(body.Length, body.Offset)
for _, filter := range body.Filters {
if len(filter.Value) > 0 {
if len(filter.Value) == 1 {
op.And(filter.Key+"=?", filter.Value[0])
if len(filter.Values) > 0 {
if len(filter.Values) == 1 {
op.And(filter.Key+"=?", filter.Values[0])
} else {
op.In(filter.Key, filter.Value)
op.In(filter.Key, filter.Values)
}
}
}
......
......@@ -10,8 +10,8 @@ import (
)
type paramFilter struct {
Key string `form:"key"`
Value []string `form:"value"`
Key string `form:"key"`
Values []string `form:"value"`
}
type paramSearch struct {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册