|
@@ -3,6 +3,7 @@ package data_manage
|
|
|
import (
|
|
|
"eta/eta_api/global"
|
|
|
"eta/eta_api/utils"
|
|
|
+ "gorm.io/gorm"
|
|
|
"time"
|
|
|
|
|
|
"github.com/rdlucklib/rdluck_tools/paging"
|
|
@@ -44,6 +45,26 @@ type BaseFromUsdaFasIndexList struct {
|
|
|
DataList []*BaseFromUsdaFasData `gorm:"-"`
|
|
|
Paging *paging.PagingItem `description:"分页数据" gorm:"-"`
|
|
|
}
|
|
|
+
|
|
|
+func (obj *BaseFromUsdaFasIndexList) AfterFind(db *gorm.DB) (err error) {
|
|
|
+ if utils.NeedDateOrTimeFormat(utils.DbDriverName) {
|
|
|
+ if obj.CreateTime != "" {
|
|
|
+ obj.CreateTime = utils.GormDateStrToDateTimeStr(obj.CreateTime)
|
|
|
+ }
|
|
|
+ if obj.ModifyTime != "" {
|
|
|
+ obj.ModifyTime = utils.GormDateStrToDateTimeStr(obj.ModifyTime)
|
|
|
+ }
|
|
|
+ if obj.StartDate != "" {
|
|
|
+ obj.StartDate = utils.GormDateStrToDateStr(obj.StartDate)
|
|
|
+ }
|
|
|
+
|
|
|
+ if obj.EndDate != "" {
|
|
|
+ obj.EndDate = utils.GormDateStrToDateStr(obj.EndDate)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
type BaseFromUsdaFasIndexSearchList struct {
|
|
|
List []*BaseFromUsdaFasIndexList
|
|
|
Paging *paging.PagingItem `description:"分页数据"`
|
|
@@ -126,6 +147,11 @@ func GetUsdaFasIndexDataTimePageByCodes(indexCodes []string, startSize, pageSize
|
|
|
o := global.DbMap[utils.DbNameIndex]
|
|
|
sql := ` SELECT data_time FROM base_from_usda_fas_data WHERE index_code in (` + utils.GetOrmInReplace(len(indexCodes)) + `) GROUP BY data_time ORDER BY data_time DESC LIMIT ?,? `
|
|
|
err = o.Raw(sql, indexCodes, startSize, pageSize).Scan(&dataTimes).Error
|
|
|
+ if utils.NeedDateOrTimeFormat(utils.DbDriverName) {
|
|
|
+ for i := range dataTimes {
|
|
|
+ dataTimes[i] = utils.GormDateStrToDateStr(dataTimes[i])
|
|
|
+ }
|
|
|
+ }
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -201,6 +227,21 @@ type BaseFromUsdaFasData struct {
|
|
|
DataTimestamp int64
|
|
|
}
|
|
|
|
|
|
+func (obj *BaseFromUsdaFasData) AfterFind(tx *gorm.DB) (err error) {
|
|
|
+ if utils.NeedDateOrTimeFormat(utils.DbDriverName) {
|
|
|
+ if obj.CreateTime != "" {
|
|
|
+ obj.CreateTime = utils.GormDateStrToDateTimeStr(obj.CreateTime)
|
|
|
+ }
|
|
|
+ if obj.ModifyTime != "" {
|
|
|
+ obj.ModifyTime = utils.GormDateStrToDateTimeStr(obj.ModifyTime)
|
|
|
+ }
|
|
|
+ if obj.DataTime != "" {
|
|
|
+ obj.DataTime = utils.GormDateStrToDateStr(obj.DataTime)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
type BaseFromUsdaFasIndexSearchItem struct {
|
|
|
BaseFromUsdaFasIndexId int `orm:"column(base_from_usda_fas_index_id);pk" gorm:"primaryKey"`
|
|
|
ClassifyId int
|