package data_manage

import (
	"github.com/beego/beego/v2/client/orm"
	"time"
)

// EdbDataCalculateLjztbpj 累计值同比拼接数据结构体
type EdbDataCalculateLjztbpj struct {
	EdbDataId     int `orm:"column(edb_data_id);pk"`
	EdbInfoId     int
	EdbCode       string
	DataTime      string
	Value         float64
	Status        int
	CreateTime    time.Time
	ModifyTime    time.Time
	DataTimestamp int64
}

// GetAllEdbDataCalculateLjztbpjByEdbInfoId 根据指标id获取全部的数据
func GetAllEdbDataCalculateLjztbpjByEdbInfoId(edbInfoId int) (items []*EdbDataCalculateLjztbpj, err error) {
	o := orm.NewOrmUsingDB("data")
	sql := ` SELECT * FROM edb_data_calculate_ljztbpj WHERE edb_info_id=? ORDER BY data_time DESC `
	_, err = o.Raw(sql, edbInfoId).QueryRows(&items)
	return
}
