mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-03 16:00:25 +08:00
增加webssh及数据库查询
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"github.com/astaxie/beego/orm"
|
||||
"mayfly-go/base"
|
||||
"mayfly-go/base/model"
|
||||
"mayfly-go/controllers/vo"
|
||||
|
||||
"github.com/beego/beego/v2/client/orm"
|
||||
)
|
||||
|
||||
type Machine struct {
|
||||
base.Model
|
||||
model.Model
|
||||
Name string `orm:"column(name)"`
|
||||
// IP地址
|
||||
Ip string `orm:"column(ip)" json:"ip"`
|
||||
@@ -25,7 +26,7 @@ func init() {
|
||||
func GetMachineById(id uint64) *Machine {
|
||||
machine := new(Machine)
|
||||
machine.Id = id
|
||||
err := base.GetBy(machine)
|
||||
err := model.GetBy(machine)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
@@ -33,13 +34,13 @@ func GetMachineById(id uint64) *Machine {
|
||||
}
|
||||
|
||||
// 分页获取机器信息列表
|
||||
func GetMachineList(pageParam *base.PageParam) base.PageResult {
|
||||
func GetMachineList(pageParam *model.PageParam) model.PageResult {
|
||||
m := new([]Machine)
|
||||
querySetter := base.QuerySetter(new(Machine)).OrderBy("-Id")
|
||||
return base.GetPage(querySetter, pageParam, m, new([]vo.MachineVO))
|
||||
querySetter := model.QuerySetter(new(Machine)).OrderBy("-Id")
|
||||
return model.GetPage(querySetter, pageParam, m, new([]vo.MachineVO))
|
||||
}
|
||||
|
||||
// 获取所有需要监控的机器信息列表
|
||||
func GetNeedMonitorMachine() *[]orm.Params {
|
||||
return base.GetListBySql("SELECT id FROM t_machine WHERE need_monitor = 1")
|
||||
return model.GetListBySql("SELECT id FROM t_machine WHERE need_monitor = 1")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user