1234567891011121314151617181920212223242526272829303132333435363738 |
- package stl
- import (
- "time"
- "github.com/beego/beego/v2/client/orm"
- )
- type CalculateStlConfigMapping struct {
- Id int `orm:"pk" description:"主键"`
- CalculateStlConfigId int `description:"stl配置id"`
- EdbInfoId int `description:"edb信息id"`
- StlEdbType int `description:"stl指标类型: 1-Trend, 2-Seasonal, 3-Residual"`
- CreateTime time.Time `description:"创建时间"`
- ModifyTime time.Time `description:"修改时间"`
- }
- func (c *CalculateStlConfigMapping) Insert() (insertId int64, err error) {
- o := orm.NewOrmUsingDB("data")
- insertId, err = o.Insert(c)
- return
- }
- // GetCalculateStlConfigMappingIdByEdbInfoId 获取配置文件id
- func GetCalculateStlConfigMappingIdByEdbInfoId(edbInfoId int) (configId int, err error) {
- o := orm.NewOrmUsingDB("data")
- sql := `SELECT calculate_stl_config_id FROM calculate_stl_config_mapping WHERE edb_info_id=? LIMIT 1`
- err = o.Raw(sql, edbInfoId).QueryRow(&configId)
- return
- }
- // GetCalculateStlConfigMappingByConfigId 根据配置文件id获取配置文件映射信息
- func GetCalculateStlConfigMappingByConfigId(configId int) (items []*CalculateStlConfigMapping, err error) {
- o := orm.NewOrmUsingDB("data")
- sql := `SELECT * FROM calculate_stl_config_mapping WHERE calculate_stl_config_id=?`
- _, err = o.Raw(sql, configId).QueryRows(&items)
- return
- }
|