package models import ( "github.com/beego/beego/v2/client/orm" "time" ) type EdbdataClassify struct { ClassifyId int `orm:"column(classify_id);pk"` ClassifyName string ParentId int CreateTime time.Time Sort int } func GetEdbdataClassifyByClassifyName(classifyName string) (item *EdbdataClassify, err error) { sql := `SELECT * FROM edbdata_classify WHERE classify_name=? ` o := orm.NewOrmUsingDB("edb") err = o.Raw(sql, classifyName).QueryRow(&item) return } func AddEdbdataClassify(item *EdbdataClassify) (newId int64, err error) { o := orm.NewOrmUsingDB("edb") newId, err = o.Insert(item) return } func GetEdbdataClassifyByParentId(parentId int) (items []*EdbdataClassify, err error) { sql := ` SELECT * FROM edbdata_classify WHERE parent_id=? ` o := orm.NewOrmUsingDB("edb") o.Raw(sql, parentId).QueryRows(&items) return } type LzPriceClassify struct { ProductName string } func GetLzPriceClassify() (items []*LzPriceClassify, err error) { sql := ` SELECT product_name FROM longzhongpriceinfo GROUP BY product_name ORDER BY product_name DESC ` o := orm.NewOrmUsingDB("edb") o.Raw(sql).QueryRows(&items) return }