|
@@ -4,6 +4,7 @@ import (
|
|
|
"eta/eta_api/global"
|
|
|
"eta/eta_api/utils"
|
|
|
"fmt"
|
|
|
+ "gorm.io/gorm"
|
|
|
"time"
|
|
|
|
|
|
"github.com/rdlucklib/rdluck_tools/paging"
|
|
@@ -51,6 +52,21 @@ type BaseFromMtjhIndexItem struct {
|
|
|
ModifyTime string `description:"修改时间"`
|
|
|
}
|
|
|
|
|
|
+func (obj *BaseFromMtjhIndexItem) 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
|
|
|
+}
|
|
|
+
|
|
|
// 查询指标
|
|
|
func GetBaseFromMtjhMapping() (items []*BaseFromMtjhMapping, err error) {
|
|
|
o := global.DbMap[utils.DbNameMaster]
|
|
@@ -121,6 +137,14 @@ type BaseFromMtjhMappingItem struct {
|
|
|
Frequency string `description:"频率"`
|
|
|
}
|
|
|
|
|
|
+func (obj *BaseFromMtjhMappingItem) AfterFind(tx *gorm.DB) (err error) {
|
|
|
+ if utils.NeedDateOrTimeFormat(utils.DbDriverName) {
|
|
|
+ if obj.CreateTime != "" {
|
|
|
+ obj.CreateTime = utils.GormDateStrToDateTimeStr(obj.CreateTime)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
func GetMtjhMapping(condition string, pars []interface{}) (items []*BaseFromMtjhMappingItem, err error) {
|
|
|
o := global.DbMap[utils.DbNameIndex]
|
|
|
sql := ` SELECT * FROM base_from_mtjh_mapping WHERE 1=1 `
|
|
@@ -234,6 +258,11 @@ func GetMtjhIndexLatestDate(indexCode string) (ModifyTime string, err error) {
|
|
|
o := global.DbMap[utils.DbNameIndex]
|
|
|
sql := ` SELECT modify_time FROM base_from_mtjh_index WHERE index_code=? ORDER BY modify_time DESC limit 1 `
|
|
|
err = o.Raw(sql, indexCode).Scan(&ModifyTime).Error
|
|
|
+ if utils.NeedDateOrTimeFormat(utils.DbDriverName) {
|
|
|
+ if ModifyTime != "" {
|
|
|
+ ModifyTime = utils.GormDateStrToDateTimeStr(ModifyTime)
|
|
|
+ }
|
|
|
+ }
|
|
|
return
|
|
|
}
|
|
|
|