|
@@ -3,6 +3,7 @@ package data_manage
|
|
|
import (
|
|
|
"eta/eta_api/global"
|
|
|
"eta/eta_api/utils"
|
|
|
+ "gorm.io/gorm"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
@@ -42,6 +43,24 @@ type BaseFromSciHqIndexView struct {
|
|
|
ModifyTime string
|
|
|
}
|
|
|
|
|
|
+func (b *BaseFromSciHqIndexView) AfterFind(db *gorm.DB) (err error) {
|
|
|
+ if utils.NeedDateOrTimeFormat(utils.DbDriverName) {
|
|
|
+ if b.LatestDate != "" {
|
|
|
+ b.LatestDate = utils.GormDateStrToDateStr(b.LatestDate)
|
|
|
+ }
|
|
|
+ if b.StartDate != "" {
|
|
|
+ b.StartDate = utils.GormDateStrToDateStr(b.StartDate)
|
|
|
+ }
|
|
|
+ if b.EndDate != "" {
|
|
|
+ b.EndDate = utils.GormDateStrToDateStr(b.EndDate)
|
|
|
+ }
|
|
|
+ if b.ModifyTime != "" {
|
|
|
+ b.ModifyTime = utils.GormDateStrToDateTimeStr(b.ModifyTime)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return
|
|
|
+}
|
|
|
func (b *BaseFromSciHqIndex) Update(cols []string) (err error) {
|
|
|
o := global.DbMap[utils.DbNameIndex]
|
|
|
err = o.Model(b).Select(cols).Updates(b).Error
|