package models import ( "github.com/beego/beego/v2/client/orm" "time" ) // ClassifyMenu 报告分类-子目录表 type ClassifyMenu struct { MenuId int `orm:"column(menu_id);pk"` MenuName string `description:"子目录名称"` ClassifyId int `description:"一级分类ID"` Sort int `description:"排序"` CreateTime time.Time `description:"创建时间"` ModifyTime time.Time `description:"更新时间"` } // GetClassifyMenuById 主键获取子目录 func GetClassifyMenuById(id int) (item *ClassifyMenu, err error) { o := orm.NewOrmUsingDB("rddp") sql := `SELECT * FROM classify_menu WHERE menu_id = ? LIMIT 1` err = o.Raw(sql, id).QueryRow(&item) return } // GetClassifyMenuList 获取子目录列表 func GetClassifyMenuList(condition string, pars []interface{}) (list []*ClassifyMenu, err error) { o := orm.NewOrmUsingDB("rddp") sql := `SELECT * FROM classify_menu WHERE 1 = 1 ` sql += condition sql += ` ORDER BY sort ASC, create_time ASC` _, err = o.Raw(sql, pars).QueryRows(&list) return }