12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- package data_manage
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type BaseFromIcpiIndex struct {
- BaseFromIcpiIndexId int `orm:"column(base_from_icpi_index_id);pk"`
- BaseFromIcpiClassifyId int `description:"分类id"`
- IndexCode string `description:"指标编码"`
- IndexName string `description:"指标名称"`
- Frequency string `description:"频度"`
- StartDate time.Time `description:"开始日期"`
- EndDate time.Time `description:"结束日期"`
- CreateTime time.Time `description:"创建时间"`
- ModifyTime time.Time `description:"修改时间"`
- }
- func GetBaseFromIcpiIndexMaxDate() (max_date time.Time, err error) {
- o := orm.NewOrm()
- sql := ` SELECT max(a.data_time)as max_date FROM base_from_icpi_data as a `
- err = o.Raw(sql).QueryRow(&max_date)
- return
- }
- type IcpiIndexResp struct {
- Ret int
- Msg string
- ErrMsg string
- ErrCode string
- Data []*BaseFromIcpiIndex
- }
- func GetBaseFromIcpiIndexAll(dateStr string) (list []*BaseFromIcpiIndex, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM base_from_icpi_index WHERE end_date>=?`
- _, err = o.Raw(sql, dateStr).QueryRows(&list)
- return
- }
- func (obj *BaseFromIcpiIndex) AddBaseFromIcpiIndex(item *BaseFromIcpiIndex) (lastId int64, err error) {
- o := orm.NewOrm()
- lastId, err = o.Insert(item)
- return
- }
- type BaseFromIcpiClassify struct {
- BaseFromIcpiClassifyId int `orm:"column(base_from_icpi_classify_id);pk"`
- ClassifyName string `description:"分类名称"`
- ClassifyNameEn string `description:"英文名称"`
- ParentId int `description:"上级id"`
- CreateTime string `description:"创建时间"`
- ModifyTime string `description:"修改时间"`
- }
- type IcpiClassifyResp struct {
- Ret int
- Msg string
- ErrMsg string
- ErrCode string
- Data []*BaseFromIcpiClassify
- }
- func GetBaseFromIcpiClassifyAll() (list []*BaseFromIcpiClassify, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM base_from_icpi_classify `
- _, err = o.Raw(sql).QueryRows(&list)
- return
- }
- func AddBaseFromIcpiClassify(item *BaseFromIcpiClassify) (lastId int64, err error) {
- o := orm.NewOrm()
- lastId, err = o.Insert(item)
- return
- }
|