123456789101112131415161718192021222324252627282930313233343536373839 |
- package supply_analysis
- import (
- "eta_gn/eta_index_lib/global"
- "time"
- )
- // VarietyEdbInfo variety_edb_info 品种指标表
- type VarietyEdbInfo struct {
- VarietyEdbId int `gorm:"primaryKey;autoIncrement;column:variety_edb_id" description:"品种指标ID"`
- VarietyId int `gorm:"column:variety_id" description:"品种id"`
- EdbName string `gorm:"column:edb_name" description:"品种指标名称"`
- Frequency string `gorm:"column:frequency" description:"频度"`
- StartDate time.Time `gorm:"column:start_date" description:"开始日期"`
- EndDate time.Time `gorm:"column:end_date" description:"结束日期"`
- LatestValue float64 `gorm:"column:latest_value" description:"最新值"`
- EdbInfoId int `gorm:"column:edb_info_id" description:"指标id"`
- EdbCode string `gorm:"column:edb_code" description:"品种编码"`
- Source int `gorm:"column:source" description:"来源,1:影响周度产量;2:周度产量变动;3:影响月度产量;4:月度产量变动"`
- ModifyTime time.Time `gorm:"column:modify_time" description:"更新时间"`
- CreateTime time.Time `gorm:"column:create_time" description:"添加时间"`
- }
- // GetAllVarietyEdbInfoByVarietyId 根据品种id获取所有的指标
- func GetAllVarietyEdbInfoByVarietyId(varietyId int) (items []*VarietyEdbInfo, err error) {
- sql := `SELECT * FROM variety_edb_info AS a WHERE a.variety_id = ? ORDER BY a.variety_edb_id ASC `
- err = global.DEFAULT_DmSQL.Raw(sql, varietyId).Scan(&items).Error
- return
- }
- // GetVarietyEdbInfoByEdbInfoId 根据ETA指标库中的指标id获取指标
- func GetVarietyEdbInfoByEdbInfoId(varietyId int) (item *VarietyEdbInfo, err error) {
- sql := `SELECT * FROM variety_edb_info AS a WHERE a.edb_info_id = ? ORDER BY a.variety_edb_id ASC `
- err = global.DEFAULT_DmSQL.Raw(sql, varietyId).First(&item).Error
- return
- }
|