浏览代码

批量修改

kobe6258 1 月之前
父节点
当前提交
33da783538

+ 16 - 0
models/data_manage/future_good/future_good_edb_info_data.go

@@ -4,6 +4,7 @@ import (
 	"eta/eta_api/global"
 	"eta/eta_api/utils"
 	"github.com/rdlucklib/rdluck_tools/paging"
+	"gorm.io/gorm"
 	"time"
 )
 
@@ -54,6 +55,21 @@ type FutureGoodEdbDataItem struct {
 	CreateTime          string
 }
 
+func (m *FutureGoodEdbDataItem) AfterFind(db *gorm.DB) (err error) {
+	if utils.NeedDateOrTimeFormat(utils.DbDriverName) {
+		if m.CreateTime != "" {
+			m.CreateTime = utils.GormDateStrToDateTimeStr(m.CreateTime)
+		}
+		if m.ModifyTime != "" {
+			m.ModifyTime = utils.GormDateStrToDateTimeStr(m.ModifyTime)
+		}
+		if m.DataTime != "" {
+			m.DataTime = utils.GormDateStrToDateStr(m.DataTime)
+		}
+	}
+	return
+}
+
 // GetFutureGoodEdbDataListCount 获取期货指标数据汇总数
 func GetFutureGoodEdbDataListCount(condition string, pars []interface{}) (count int, err error) {
 	sql := `SELECT COUNT(1) AS count FROM future_good_edb_data WHERE 1=1 `

+ 1 - 1
models/data_manage/gl_data.go

@@ -9,7 +9,7 @@ import (
 )
 
 type GlClassify struct {
-	BreedShortName string `orm:"column(BREED_SHORT_NAME)" description:"分类名称"`
+	BreedShortName string `gorm:"column:BREED_SHORT_NAME" description:"分类名称"`
 }
 
 func GetGlSurveyClassify() (items []*GlClassify, err error) {

+ 23 - 13
models/data_manage/lz_data.go

@@ -1,6 +1,7 @@
 package data_manage
 
 import (
+	"gorm.io/gorm"
 	"time"
 
 	"eta/eta_api/global"
@@ -69,19 +70,19 @@ func GetLongzhongSurveyProduct(breedId, frequency int) (items []*LongzhongSurvey
 }
 
 type LzProductList struct {
-	SurveyProductId int             `gorm:"column:survey_product_id;primaryKey"`
-	BreedName       string          `gorm:"column:breed_name" description:"品种名称"`
-	QuotaName       string          `gorm:"column:quota_name" description:"指标名称"`
-	UnitName        string          `gorm:"column:unit_name" description:"单位"`
-	SampleType      int64           `gorm:"column:sample_type" description:"样本类型 0-空 1-企业 2-港口 3-运距 4-区域/国家 99-不确定"`
-	SampleName      string          `gorm:"column:sample_name" description:"样本名称"`
-	Device          string          `gorm:"column:device" description:"设备"`
-	Frequency       int64           `gorm:"column:frequency" description:"频度"`
-	Custom          string          `gorm:"column:custom" description:"扩展字段"`
-	StartDate       string          `gorm:"column:start_date" description:"开始日期"`
-	EndDate         string          `gorm:"column:end_date" description:"结束日期"`
-	ModifyTime      string          `gorm:"column:modify_time" description:"修改时间"`
-	LzCode          string          `gorm:"column:lz_code" description:"指标编码"`
+	SurveyProductId int              `gorm:"column:survey_product_id;primaryKey"`
+	BreedName       string           `gorm:"column:breed_name" description:"品种名称"`
+	QuotaName       string           `gorm:"column:quota_name" description:"指标名称"`
+	UnitName        string           `gorm:"column:unit_name" description:"单位"`
+	SampleType      int64            `gorm:"column:sample_type" description:"样本类型 0-空 1-企业 2-港口 3-运距 4-区域/国家 99-不确定"`
+	SampleName      string           `gorm:"column:sample_name" description:"样本名称"`
+	Device          string           `gorm:"column:device" description:"设备"`
+	Frequency       int64            `gorm:"column:frequency" description:"频度"`
+	Custom          string           `gorm:"column:custom" description:"扩展字段"`
+	StartDate       string           `gorm:"column:start_date" description:"开始日期"`
+	EndDate         string           `gorm:"column:end_date" description:"结束日期"`
+	ModifyTime      string           `gorm:"column:modify_time" description:"修改时间"`
+	LzCode          string           `gorm:"column:lz_code" description:"指标编码"`
 	DataList        []*LzProductData `gorm:"-"`
 }
 
@@ -90,6 +91,15 @@ type LzProductData struct {
 	DataTime   string `description:"值"`
 }
 
+func (m *LzProductData) AfterFind(db *gorm.DB) (err error) {
+	if utils.NeedDateOrTimeFormat(utils.DbDriverName) {
+		if m.DataTime != "" {
+			m.DataTime = utils.GormDateStrToDateStr(m.DataTime)
+		}
+	}
+	return
+}
+
 func GetLongzhongSurveyProductData(surveyProductId int) (items []*LzProductData, err error) {
 	sql := `SELECT * FROM longzhong_survey_data WHERE survey_product_id=? ORDER BY data_time DESC`
 	o := global.DbMap[utils.DbNameManualIndex]