|
@@ -233,8 +233,8 @@ func (m *BaseFromCCFIndex) Update(updateCols []string) (err error) {
|
|
|
|
|
|
func (m *BaseFromCCFIndex) ModifyIndexMaxAndMinDate(indexCode string, item *EdbInfoMaxAndMinInfo) (err error) {
|
|
|
o := orm.NewOrm()
|
|
|
- sql := ` UPDATE base_from_ccf_index SET start_date=?,end_date=?,modify_time=NOW() WHERE index_code=? `
|
|
|
- _, err = o.Raw(sql, item.MinDate, item.MaxDate, indexCode).Exec()
|
|
|
+ sql := ` UPDATE base_from_ccf_index SET start_date=?,end_date=?,latest_value=?,modify_time=NOW() WHERE index_code=? `
|
|
|
+ _, err = o.Raw(sql, item.MinDate, item.MaxDate, item.LatestValue, indexCode).Exec()
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -320,6 +320,11 @@ func (m *BaseFromCCFData) GetMaxAndMinDateByIndexCode(indexCode string) (item *E
|
|
|
o := orm.NewOrm()
|
|
|
sql := ` SELECT MIN(data_time) AS min_date,MAX(data_time) AS max_date,MIN(value) AS min_value,MAX(value) AS max_value FROM base_from_ccf_data WHERE index_code=? `
|
|
|
err = o.Raw(sql, indexCode).QueryRow(&item)
|
|
|
+
|
|
|
+ var latest_value float64
|
|
|
+ sql = ` SELECT value AS latest_value FROM base_from_ccf_data WHERE index_code=? ORDER BY data_time DESC LIMIT 1 `
|
|
|
+ err = o.Raw(sql, indexCode).QueryRow(&latest_value)
|
|
|
+ item.LatestValue = latest_value
|
|
|
return
|
|
|
}
|
|
|
|