|
@@ -80,6 +80,13 @@ type Edbdata struct {
|
|
|
ModifyTime time.Time `gorm:"column:modify_time" description:"修改时间"`
|
|
|
}
|
|
|
|
|
|
+// AfterFind 在该模型上设置钩子函数,把日期转成正确的string,所以查询函数只能用Find函数,First或者Scan是不会触发该函数的来获取数据
|
|
|
+func (m *Edbdata) AfterFind(db *gorm.DB) (err error) {
|
|
|
+ m.Dt = utils.GormDateStrToDateStr(m.Dt)
|
|
|
+
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
type EdbDataNextDateTime struct {
|
|
|
TradeCode string `gorm:"column:TRADE_CODE;pk" description:"指标编码"`
|
|
|
Dt string `gorm:"column:DT" description:"日期"`
|
|
@@ -89,6 +96,14 @@ type EdbDataNextDateTime struct {
|
|
|
NextDateTime string `description:"下期日期"`
|
|
|
}
|
|
|
|
|
|
+// AfterFind 在该模型上设置钩子函数,把日期转成正确的string,所以查询函数只能用Find函数,First或者Scan是不会触发该函数的来获取数据
|
|
|
+func (m *EdbDataNextDateTime) AfterFind(db *gorm.DB) (err error) {
|
|
|
+ m.Dt = utils.GormDateStrToDateStr(m.Dt)
|
|
|
+ m.NextDateTime = utils.GormDateStrToDateStr(m.NextDateTime)
|
|
|
+
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
func GetDataInfo(tradeCode, creteDate string) (item *Edbdata, err error) {
|
|
|
sql := " SELECT * FROM edbdata WHERE TRADE_CODE=? AND DT=? "
|
|
|
o := global.DbMap[utils.DbNameManualIndex]
|
|
@@ -1336,8 +1351,8 @@ type LongzhongSurveyProduct struct {
|
|
|
}
|
|
|
|
|
|
func (obj *LongzhongSurveyProduct) AfterFind(tx *gorm.DB) (err error) {
|
|
|
- obj.StartDate = utils.GormDateStrToDateStr(obj.StartDate)
|
|
|
- obj.EndDate = utils.GormDateStrToDateStr(obj.EndDate)
|
|
|
+ obj.StartDate = utils.GormDateStrToDateStr(obj.StartDate)
|
|
|
+ obj.EndDate = utils.GormDateStrToDateStr(obj.EndDate)
|
|
|
return
|
|
|
}
|
|
|
func GetLongzhongSurveyProductByClassifyName(productName string) (items []*LongzhongSurveyProduct, err error) {
|
|
@@ -1774,8 +1789,8 @@ type EdbinfoMaxMinDate struct {
|
|
|
}
|
|
|
|
|
|
func (mmDate *EdbinfoMaxMinDate) AfterFind(tx *gorm.DB) (err error) {
|
|
|
- mmDate.MinDate = utils.GormDateStrToDateStr(mmDate.MinDate)
|
|
|
- mmDate.MaxDate = utils.GormDateStrToDateStr(mmDate.MaxDate)
|
|
|
+ mmDate.MinDate = utils.GormDateStrToDateStr(mmDate.MinDate)
|
|
|
+ mmDate.MaxDate = utils.GormDateStrToDateStr(mmDate.MaxDate)
|
|
|
return
|
|
|
}
|
|
|
|