123456789101112131415161718192021222324252627282930313233343536373839 |
- package data_manage
- import (
- "fmt"
- "github.com/beego/beego/v2/client/orm"
- )
- type IcpiData struct {
- InputValue string `orm:"column(DATA_VALUE)" description:"日期"`
- DataTime string `orm:"column(DATA_DATE)" description:"值"`
- }
- func GetEdbDataIcpiMaxOrMinDate(edbCode string) (minDate, maxDate string, err error) {
- o := orm.NewOrmUsingDB("data")
- sql := ` SELECT MIN(data_time) AS minDate,MAX(data_time) AS maxDate FROM edb_data_icpi WHERE edb_code=? `
- err = o.Raw(sql, edbCode).QueryRow(&minDate, &maxDate)
- return
- }
- type IcpiIndexView struct {
- BaseFromTradeGuangzhouIndexId int `description:"指标id"`
- BaseFromTradeGuangzhouClassifyId int `description:"分类id"`
- IndexCode string `description:"指标编码"`
- IndexName string `description:"指标名称"`
- Frequency string `description:"频率"`
- Unit string `description:"单位"`
- StartDate string `description:"开始日期"`
- EndDate string `description:"结束日期"`
- Value float64 `description:"数据"`
- }
- // GetBaseInfoFromShByIndexCode 获取指标信息
- func GetBaseInfoFromIcpiByIndexCode(indexCode string) (item *IcpiIndexView, err error) {
- o := orm.NewOrmUsingDB("data")
- sql := `SELECT * FROM base_from_icpi_index WHERE index_code=? `
- sql = fmt.Sprintf(sql)
- err = o.Raw(sql, indexCode).QueryRow(&item)
- return
- }
|