1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- package models
- import (
- "eta_gn/eta_index_lib/global"
- "eta_gn/eta_index_lib/utils"
- "time"
- )
- // AddPredictEdbInfoReq 添加预测指标请求
- type AddPredictEdbInfoReq struct {
- EdbInfoId int `description:"指标ID"`
- ClassifyId int `description:"分类id"`
- AdminId int `description:"添加人id"`
- AdminName string `description:"添加人名称"`
- SourceEdbInfoId int `description:"来源指标id"`
- EdbName string `description:"指标名称"`
- RuleList []RuleConfig `description:"配置规则列表"`
- MaxValue float64 `description:"最大值"`
- MinValue float64 `description:"最小值"`
- DataDateType string `description:"日期类型,枚举值:交易日、自然日"`
- }
- // RuleConfig 预测规则配置
- type RuleConfig struct {
- RuleType int `description:"预测规则,1:最新,2:固定值,3:同比,4:同差,5:环比,6:环差,7:N期移动均值,8:N期段线性外推值,9:动态环差"`
- Value string `description:"值/计算公式"`
- EmptyType int `description:"空值处理类型(0查找前后35天,1不计算,2前值填充,3后值填充,4等于0)"`
- MaxEmptyType int `description:"MAX、MIN公式空值处理类型(1、等于0;2、跳过空值)"`
- EndDate string `description:"截止日期"`
- EdbInfoIdArr []EdbInfoFromTag `description:"指标信息"`
- }
- // EditPredictEdbInfoReq 编辑预测指标请求
- type EditPredictEdbInfoReq struct {
- EdbInfoId int `description:"指标ID"`
- ClassifyId int `description:"分类id"`
- EdbName string `description:"指标名称"`
- RuleList []RuleConfig `description:"配置规则列表"`
- }
- type PredictEdbConf struct {
- ConfigId int `gorm:"primaryKey;autoIncrement;column:config_id" description:"规则id"`
- PredictEdbInfoId int `description:"预测指标id"`
- SourceEdbInfoId int `description:"来源指标id"`
- RuleType int `description:"预测规则,1:最新,2:固定值,3:同比,4:同差,5:环比,6:环差,7:N期移动均值,8:N期段线性外推值"`
- FixedValue float64 `description:"固定值"`
- Value string `description:"配置的值"`
- EmptyType int `description:"空值处理类型(0查找前后35天,1不计算,2前值填充,3后值填充,4等于0)"`
- MaxEmptyType int `description:"MAX、MIN公式空值处理类型(1、等于0;2、跳过空值)"`
- EndDate time.Time `description:"截止日期"`
- ModifyTime time.Time `description:"修改时间"`
- CreateTime time.Time `description:"添加时间"`
- }
- // PredictEdbConfAndData 预测规则和其对应的动态数据
- type PredictEdbConfAndData struct {
- ConfigId int `gorm:"primaryKey;autoIncrement;column:config_id" description:"规则id"`
- PredictEdbInfoId int `orm:"column(predict_edb_info_id)" description:"预测指标id"`
- SourceEdbInfoId int `description:"来源指标id"`
- RuleType int `description:"预测规则,1:最新,2:固定值,3:同比,4:同差,5:环比,6:环差,7:N期移动均值,8:N期段线性外推值,9:动态环差"`
- FixedValue float64 `description:"固定值"`
- Value string `description:"配置的值"`
- EmptyType int `description:"空值处理类型(0查找前后35天,1不计算,2前值填充,3后值填充,4等于0)"`
- MaxEmptyType int `description:"MAX、MIN公式空值处理类型(1、等于0;2、跳过空值)"`
- EndDate time.Time `description:"截止日期"`
- ModifyTime time.Time `description:"修改时间"`
- CreateTime time.Time `description:"添加时间"`
- DataList []*EdbInfoSearchData `description:"动态数据" gorm:"-"`
- }
- // GetPredictEdbConfListById 根据预测指标id获取预测指标配置信息列表
- func GetPredictEdbConfListById(edbInfoId int) (items []*PredictEdbConf, err error) {
- sql := ` SELECT * FROM predict_edb_conf WHERE predict_edb_info_id=? ORDER BY config_id ASC`
- err = global.DEFAULT_DmSQL.Raw(sql, edbInfoId).Scan(&items).Error
- return
- }
- // GetPredictEdbConfAndDataListById 根据预测指标id获取预测指标配置信息列表
- func GetPredictEdbConfAndDataListById(edbInfoId int) (items []*PredictEdbConfAndData, err error) {
- sql := ` SELECT * FROM predict_edb_conf WHERE predict_edb_info_id=? ORDER BY config_id ASC`
- err = global.DEFAULT_DmSQL.Raw(sql, edbInfoId).Scan(&items).Error
- return
- }
- // GetPredictEdbConfListByConfigIdList 根据预测指标id列表获取预测指标配置信息列表
- func GetPredictEdbConfListByConfigIdList(configIdList []int) (items []*PredictEdbConf, err error) {
- num := len(configIdList)
- if num <= 0 {
- return
- }
- sql := ` SELECT * FROM predict_edb_conf WHERE config_id in (` + utils.GetOrmInReplace(num) + `) ORDER BY config_id ASC`
- err = global.DEFAULT_DmSQL.Raw(sql, configIdList).Scan(&items).Error
- return
- }
|