// Package data_manage // @Author gmy 2024/8/7 9:26:00 package data_manage import "github.com/beego/beego/v2/client/orm" type BaseFromLyClassify struct { BaseFromLyClassifyId int `orm:"column(base_from_ly_classify_id);pk" description:"分类ID"` CreateTime string `orm:"column(create_time)" description:"创建时间"` ModifyTime string `orm:"column(modify_time)" description:"修改时间"` ClassifyName string `orm:"column(classify_name)" description:"分类名称"` ParentId int `orm:"column(parent_id)" description:"上级id"` Sort int `orm:"column(sort)" description:"排序字段,越小越靠前"` ClassifyNameEn string `orm:"column(classify_name_en)" description:"英文分类名称"` } type BaseFromLyClassifyAndIndexInfo struct { BaseFromLyClassifyId int `orm:"column(base_from_ly_classify_id);pk" description:"分类ID"` CreateTime string `orm:"column(create_time)" description:"创建时间"` ModifyTime string `orm:"column(modify_time)" description:"修改时间"` ClassifyName string `orm:"column(classify_name)" description:"分类名称"` ParentId int `orm:"column(parent_id)" description:"上级id"` Sort int `orm:"column(sort)" description:"排序字段,越小越靠前"` ClassifyNameEn string `orm:"column(classify_name_en)" description:"英文分类名称"` IndexId int `orm:"column(base_from_ly_index_id)" description:"指标id"` IndexCode string `orm:"column(index_code)" description:"指标编码"` IndexName string `orm:"column(index_name)" description:"指标名称"` } func init() { orm.RegisterModel(new(BaseFromLyClassify)) } // GetAllLyClassify 查询所有分类 func GetAllLyClassify() (items []*BaseFromLyClassify, err error) { o := orm.NewOrmUsingDB("data") sql := `SELECT * FROM base_from_ly_classify ORDER BY sort asc` _, err = o.Raw(sql).QueryRows(&items) return } // GetLyClassifyById 根据分类id查询 func GetLyClassifyById(classifyId int) (item *BaseFromLyClassify, err error) { o := orm.NewOrmUsingDB("data") sql := `SELECT * FROM base_from_ly_classify WHERE base_from_ly_classify_id=?` err = o.Raw(sql, classifyId).QueryRow(&item) return }