123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type EdbInfo struct {
- EdbInfoId int `orm:"column(edb_info_id);pk"`
- EdbInfoType int `description:"指标类型,0:普通指标,1:预测指标"`
- SourceName string `description:"来源名称"`
- Source int `description:"来源id"`
- EdbCode string `description:"指标编码"`
- EdbName string `description:"指标名称"`
- EdbNameEn string `description:"英文指标名称"`
- EdbNameSource string `description:"指标名称来源"`
- Frequency string `description:"频率"`
- Unit string `description:"单位"`
- UnitEn string `description:"英文单位"`
- StartDate string `description:"起始日期"`
- EndDate string `description:"终止日期"`
- ClassifyId int `description:"分类id"`
- SysUserId int
- SysUserRealName string
- UniqueCode string `description:"指标唯一编码"`
- CreateTime time.Time
- ModifyTime time.Time
- MinValue float64 `description:"指标最小值"`
- MaxValue float64 `description:"指标最大值"`
- CalculateFormula string `description:"计算公式"`
- EdbType int `description:"指标类型:1:基础指标,2:计算指标"`
- IsUpdate int `description:"当天是否已更新,1:未更新,2:已更新"`
- Sort int `description:"排序字段"`
- LatestDate string `description:"数据最新日期"`
- LatestValue float64 `description:"数据最新值"`
- MoveType int `description:"移动方式:1:领先(默认),2:滞后"`
- MoveFrequency string `description:"移动频度"`
- NoUpdate int8 `description:"是否停止更新,0:继续更新;1:停止更新"`
- ServerUrl string `description:"服务器地址"`
- ChartImage string `description:"图表图片"`
- Calendar string `description:"公历/农历" orm:"default(公历);"`
- DataDateType string `orm:"column(data_date_type);size(255);null;default(交易日)"`
- }
- type EdbInfoView struct {
- EdbInfoId int `orm:"column(edb_info_id);pk"`
- EdbInfoType int `description:"指标类型,0:普通指标,1:预测指标"`
- SourceName string `description:"来源名称"`
- Source int `description:"来源id"`
- EdbCode string `description:"指标编码"`
- EdbName string `description:"指标名称"`
- EdbNameEn string `description:"英文指标名称"`
- EdbNameSource string `description:"指标名称来源"`
- Frequency string `description:"频率"`
- Unit string `description:"单位"`
- UnitEn string `description:"英文单位"`
- StartDate string `description:"起始日期"`
- EndDate string `description:"终止日期"`
- ClassifyId int `description:"分类id"`
- SysUserId int
- SysUserRealName string
- UniqueCode string `description:"指标唯一编码"`
- CreateTime time.Time
- ModifyTime time.Time
- MinValue float64 `description:"指标最小值"`
- MaxValue float64 `description:"指标最大值"`
- CalculateFormula string `description:"计算公式"`
- EdbType int `description:"指标类型:1:基础指标,2:计算指标"`
- Sort int `description:"排序字段"`
- LatestDate string `description:"数据最新日期"`
- LatestValue float64 `description:"数据最新值"`
- MoveType int `description:"移动方式:1:领先(默认),2:滞后"`
- MoveFrequency string `description:"移动频度"`
- NoUpdate int8 `description:"是否停止更新,0:继续更新;1:停止更新"`
- ServerUrl string `description:"服务器地址"`
- ChartImage string `description:"图表图片"`
- Calendar string `description:"公历/农历" orm:"default(公历);"`
- DataDateType string `orm:"column(data_date_type);size(255);null;default(交易日)"`
- CalculateList []*EdbInfoCalculateMappingDetail
- }
- func GetEdbInfoByEdbCode(edbCode string) (item *EdbInfoView, err error) {
- o := orm.NewOrm()
- sql := ` SELECT * FROM edb_info WHERE edb_code=? `
- err = o.Raw(sql, edbCode).QueryRow(&item)
- return
- }
- type EdbInfoDetailReq struct {
- EdbCode string `description:"指标编码"`
- }
- type EdbInfoCalculateMappingDetail struct {
- EdbCode string `description:"指标编码"`
- BaseEdbInfoCode []*EdbInfoCalculateBaseEdbInfo `description:"依赖的基础指标编码"`
- }
- func GetEdbInfoCalculateMapping(edbCode string) (items []*EdbInfoCalculateMappingDetail, err error) {
- o := orm.NewOrm()
- sql := ` SELECT edb_code FROM edb_info_calculate_mapping AS a
- WHERE a.from_edb_code=?
- ORDER BY a.edb_info_calculate_mapping_id ASC `
- _, err = o.Raw(sql, edbCode).QueryRows(&items)
- return
- }
- type EdbInfoCalculateBaseEdbInfo struct {
- FromEdbCode string `description:"指标编码"`
- }
- func GetEdbInfoCalculateBaseEdbInfo(edbCode string) (items []*EdbInfoCalculateBaseEdbInfo, err error) {
- o := orm.NewOrm()
- sql := ` SELECT a.from_edb_code FROM edb_info_calculate_mapping AS a
- WHERE a.edb_code=?
- ORDER BY a.edb_info_calculate_mapping_id ASC `
- _, err = o.Raw(sql, edbCode).QueryRows(&items)
- return
- }
- func GetEdbInfoItemByEdbCode(edbCode string) (item *EdbInfo, err error) {
- o := orm.NewOrm()
- sql := ` SELECT * FROM edb_info WHERE edb_code=? `
- err = o.Raw(sql, edbCode).QueryRow(&item)
- return
- }
|