package variety_classify import ( "github.com/beego/beego/v2/client/orm" "time" ) // VarietyClassify 标签库分类表 type VarietyClassify struct { VarietyClassifyId int `orm:"column(variety_classify_id);pk" description:"标签分类ID"` ClassifyName string `json:"classify_name" description:"标签分类名称"` Sort int `json:"sort" description:"排序"` State int `json:"state" description:"显示状态 0-禁用 1-启用"` CreateTime time.Time `json:"create_time" description:"创建时间"` ModifyTime time.Time `json:"modify_time" description:"更新时间"` } // GetVarietyClassifyList 获取标签分类列表 func GetVarietyClassifyList() (list []*VarietyClassify, err error) { o := orm.NewOrm() sql := `SELECT * FROM variety_classify WHERE state = 1 ORDER BY sort` _, err = o.Raw(sql).QueryRows(&list) return } // GetVarietyClassifyById 主键获取分类 func GetVarietyClassifyById(classifyId int) (item *VarietyClassify, err error) { o := orm.NewOrm() sql := `SELECT * FROM variety_classify WHERE variety_classify_id = ? LIMIT 1` err = o.Raw(sql, classifyId).QueryRow(&item) return }