增加webssh及数据库查询

This commit is contained in:
meilin.huang
2021-01-08 15:37:32 +08:00
parent 111612b7f2
commit 4c2e6b6155
60 changed files with 4347 additions and 2222 deletions

26
models/db_sql.go Normal file
View File

@@ -0,0 +1,26 @@
package models
import (
"mayfly-go/base/model"
"github.com/beego/beego/v2/client/orm"
)
type DbSql struct {
model.Model `orm:"-"`
DbId uint64 `orm:"column(db_id)" json:"db_id"`
Type int `orm:"column(type)" json:"type"` // 类型
Sql string `orm:"column(sql)" json:"sql"`
}
func init() {
orm.RegisterModelWithPrefix("t_", new(DbSql))
}
func GetDbSqlByUser(userId uint64, dbId uint64, sqlType int) *Db {
db := new(Db)
query := model.QuerySetter(db).Filter("CreatorId", userId).Filter("DbId", dbId).Filter("Type", sqlType)
model.GetOne(query, db, db)
return db
}