package models import ( "time" "github.com/beego/beego/v2/client/orm" ) // BaseFromEiaSteoIndex EiaSteo指标 type BaseFromEiaSteoIndex struct { BaseFromEiaSteoIndexId int `orm:"column(base_from_eia_steo_index_id);pk"` BaseFromEiaSteoClassifyId int `description:"指标分类id"` IndexCode string `description:"指标编码"` IndexName string `description:"指标名称(中文名称)"` IndexNameOriginal string `description:"指标名称(原始名称)"` Frequency string `description:"频度"` Level int `description:"指标层级(原始层级)"` Unit string `description:"单位"` Super string `description:"我也不知道是个啥,反正先存起来,万一用到了呢"` Precision int `description:"精度,我也不知道会不会用到,反正先存起来,万一用到了呢"` LastHistorical string `description:"最近的历史记录,我也不知道会不会用到,反正先存起来,万一用到了呢"` Description string `description:"备注信息,我也不知道会不会用到,反正先存起来,万一用到了呢"` IsMappable int `description:"是否可映射,我也不知道会不会用到,反正先存起来,万一用到了呢"` StartDate string `description:"开始日期"` EndDate string `description:"结束日期"` ModifyTime string `description:"最新更新时间"` CreateTime string `description:"创建时间"` } type BaseFromEiaSteoData struct { BaseFromEiaSteoDataId int `orm:"column(base_from_eia_steo_data_id);pk"` BaseFromEiaSteoIndexId int `description:"指标id"` IndexCode string `description:"指标编码"` DataTime time.Time `description:"数据日期"` Value float64 `description:"数据值"` ModifyTime time.Time `description:"最新更新时间"` CreateTime time.Time `description:"创建时间"` } // BaseFromEiaSteoClassify EiaSteo分类 type BaseFromEiaSteoClassify struct { BaseFromEiaSteoClassifyId int `orm:"column(base_from_eia_steo_classify_id);pk"` ClassifyName string `description:"分类名称(中文名称)"` ClassifyNameOriginal string `description:"分类名称(原始名称)"` ParentId int `description:"父级id"` Level int `description:"层级"` ModifyTime time.Time `description:"最新更新时间"` CreateTime time.Time `description:"创建时间"` } func (obj *BaseFromEiaSteoClassify) GetBaseFromEiaSteoClassifyAll() (list []*BaseFromEiaSteoClassify, err error) { o := orm.NewOrm() sql := `SELECT * FROM base_from_eia_steo_classify ` _, err = o.Raw(sql).QueryRows(&list) return list, err } func GetEiaSteoIndex(startDate, endDate string) (list []*BaseFromEiaSteoIndex, err error) { o := orm.NewOrm() sql := `SELECT * FROM base_from_eia_steo_index WHERE create_time>=? AND create_time<=? ORDER BY create_time ASC ` _, err = o.Raw(sql, startDate, endDate).QueryRows(&list) return } func GetEiaSteoIndexData(indexCode, startDate, endDate string) (list []*BaseFromEiaSteoData, err error) { o := orm.NewOrm() sql := `SELECT * FROM base_from_eia_steo_data WHERE index_code=? AND create_time>=? AND create_time<=? ORDER BY create_time ASC ` _, err = o.Raw(sql, indexCode, startDate, endDate).QueryRows(&list) return }