package data_manage import ( "eta/eta_api/global" "eta/eta_api/utils" "time" ) type BaseFromBaiinfoDataSimple struct { //BaiinfoDataId int `orm:"column(baiinfo_data_id);pk"` BaiinfoDataId int `gorm:"column:baiinfo_data_id;primaryKey"` BaseFromBaiinfoIndexId int IndexCode string DataTime string Value string } type BaseFromBaiinfoDataDateStruct struct { MinDate time.Time `gorm:"column:min_date"` MaxDate time.Time `gorm:"column:max_date"` } func GetEdbDataBaiinfoMaxAndMinDate(edbCode string) (min_date, max_date string, err error) { //o := orm.NewOrmUsingDB("data") sql := ` SELECT MIN(data_time) AS min_date,MAX(data_time) AS max_date FROM edb_data_baiinfo WHERE edb_code=? ` //err = o.Raw(sql, edbCode).QueryRow(&min_date, &max_date) var ormItem BaseFromBaiinfoDataDateStruct err = global.DbMap[utils.DbNameIndex].Raw(sql, edbCode).Scan(&ormItem).Error if err != nil { return } min_date = ormItem.MinDate.Format(utils.FormatDate) max_date = ormItem.MaxDate.Format(utils.FormatDate) return }