package data_manage

import (
	"eta_gn/eta_api/global"
	"time"
)

type ChartSeriesEdbMapping struct {
	ChartSeriesEdbMappingId int       `orm:"column(chart_series_edb_mapping_id);pk" gorm:"primaryKey" `
	ChartSeriesId           int       `description:"系列ID"`
	ChartInfoId             int       `description:"图表ID"`
	EdbInfoId               int       `description:"指标id"`
	DateConfName            string    `description:"引用日期配置名称"`
	DateConfType            int       `description:"日期类型,0指标最新日期, 1引用日期"`
	DateConf                string    `description:"日期配置名称"`
	ModifyTime              time.Time `description:"修改时间"`
	CreateTime              time.Time `description:"创建时间"`
}

func (c *ChartSeriesEdbMapping) TableName() string {
	return "chart_series_edb_mapping"
}

func GetChartSeriesEdbByChartInfoId(chartInfoId int) (items []*ChartSeriesEdbMapping, err error) {
	sql := "SELECT * FROM chart_series_edb_mapping WHERE chart_info_id = ?"
	err = global.DmSQL["data"].Raw(sql, chartInfoId).Find(&items).Error

	return
}