Browse Source

批量修改

kobe6258 3 weeks ago
parent
commit
5b6cfbf5c9

+ 9 - 9
models/data_manage/baiinfo_data.go

@@ -37,9 +37,9 @@ type BaiinfoIndex struct {
 	Name                   string
 	IndexCode              string
 	IndexName              string
-	Type1                  string `orm:"column(type_1)"`
-	Type2                  string `orm:"column(type_2)"`
-	Type3                  string `orm:"column(type_3)"`
+	Type1                  string `gorm:"column:type_1"`
+	Type2                  string `gorm:"column:type_2"`
+	Type3                  string `gorm:"column:type_3"`
 	Frequency              string
 	Unit                   string
 	ApiStartTime           string
@@ -88,9 +88,9 @@ type BaiinfoExportIndex struct {
 	TypeName   string
 	IndexCode  string
 	IndexName  string
-	Type1      string `orm:"column(type_1)"`
-	Type2      string `orm:"column(type_2)"`
-	Type3      string `orm:"column(type_3)"`
+	Type1      string `gorm:"column:type_1"`
+	Type2      string `gorm:"column:type_2"`
+	Type3      string `gorm:"column:type_3"`
 	Frequency  string
 	Unit       string
 	ModifyTime string
@@ -123,9 +123,9 @@ type BaiinfoIndexList struct {
 	Name                   string
 	IndexCode              string
 	IndexName              string
-	Type1                  string `orm:"column(type_1)"`
-	Type2                  string `orm:"column(type_2)"`
-	Type3                  string `orm:"column(type_3)"`
+	Type1                  string `gorm:"column:type_1"`
+	Type2                  string `gorm:"column:type_2"`
+	Type3                  string `gorm:"column:type_3"`
 	Frequency              string
 	Unit                   string
 	ApiStartTime           string

+ 5 - 5
models/data_manage/base_from_baiinfo.go

@@ -17,9 +17,9 @@ type BaseFromBaiinfo struct {
 	ApiUpdateType     string
 	ApiType           int
 	ApiTypeAll        string
-	Type1             string `orm:"column(type_1)"`
-	Type2             string `orm:"column(type_2)"`
-	Type3             string `orm:"column(type_3)"`
+	Type1             string `gorm:"column:type_1"`
+	Type2             string `gorm:"column:type_2"`
+	Type3             string `gorm:"column:type_3"`
 	ApiStartTime      string
 	ApiUpdateTime     string
 	StartTime         string
@@ -194,8 +194,8 @@ func GetBaseFromBaiinfoIndexMinSortByClassifyId(classifyId int) (sort int, err e
 }
 
 type BaseFromBaiinfoIndexType struct {
-	Type2 string `orm:"column(type_2)"`
-	Type3 string `orm:"column(type_3)"`
+	Type2 string `gorm:"column:type_2"`
+	Type3 string `gorm:"column:type_3"`
 }
 
 // GetBaseFromBaiinfoIndexType 获取历史指标信息类型

+ 2 - 2
models/data_manage/base_from_gpr_risk.go

@@ -277,8 +277,8 @@ func GetBaseFromGprRiskIndexByIndexCode(indexCode string) (list *BaseFromGprRisk
 }
 
 type BaseFromGprRiskIndexType struct {
-	Type2 string `orm:"column(type_2)"`
-	Type3 string `orm:"column(type_3)"`
+	Type2 string `gorm:"column:type_2"`
+	Type3 string `gorm:"column:type_3"`
 }
 
 // Update 更新GprRisk指标基础信息

+ 6 - 7
models/data_manage/base_from_sci.go

@@ -10,7 +10,7 @@ import (
 )
 
 type BaseFromSci struct {
-	BaseFromSciId int `orm:"column(base_from_sci_id);pk" gorm:"primaryKey"`
+	BaseFromSciId int `gorm:"column:base_from_sci_id;primaryKey"`
 	Aid           int
 	Name          string
 	Interface     string
@@ -18,9 +18,9 @@ type BaseFromSci struct {
 	ApiUpdateType string
 	ApiType       int
 	ApiTypeAll    string
-	Type1         string `orm:"column(type_1)"`
-	Type2         string `orm:"column(type_2)"`
-	Type3         string `orm:"column(type_3)"`
+	Type1         string `gorm:"column:type_1"`
+	Type2         string `gorm:"column:type_2"`
+	Type3         string `gorm:"column:type_3"`
 	ApiStartTime  string
 	ApiUpdateTime string
 	StartTime     string
@@ -74,7 +74,6 @@ type BaseFromSciIndex struct {
 	TerminalCode       string `description:"终端编码"`
 }
 
-
 func AddBaseFromSciIndex(item *BaseFromSciIndex) (lastId int64, err error) {
 	o := global.DbMap[utils.DbNameIndex]
 	err = o.Create(item).Error
@@ -223,8 +222,8 @@ func GetBaseFromSciIndexMinSortByClassifyId(classifyId int) (sort int, err error
 }
 
 type BaseFromSciIndexType struct {
-	Type2 string `orm:"column(type_2)"`
-	Type3 string `orm:"column(type_3)"`
+	Type2 string `gorm:"column:type_2"`
+	Type3 string `gorm:"column:type_3"`
 }
 
 // GetBaseFromSciIndexType 获取历史指标信息类型

+ 5 - 5
models/data_manage/base_from_smm.go

@@ -19,9 +19,9 @@ type BaseFromSmm struct {
 	ApiUpdateType string
 	ApiType       int
 	ApiTypeAll    string
-	Type1         string `orm:"column(type_1)"`
-	Type2         string `orm:"column(type_2)"`
-	Type3         string `orm:"column(type_3)"`
+	Type1         string `gorm:"column:type_1"`
+	Type2         string `gorm:"column:type_2"`
+	Type3         string `gorm:"column:type_3"`
 	ApiStartTime  string
 	ApiUpdateTime string
 	StartTime     string
@@ -254,8 +254,8 @@ func GetBaseFromSmmIndexMinSortByClassifyId(classifyId int) (sort int, err error
 }
 
 type BaseFromSmmIndexType struct {
-	Type2 string `orm:"column(type_2)"`
-	Type3 string `orm:"column(type_3)"`
+	Type2 string `gorm:"column:type_2"`
+	Type3 string `gorm:"column:type_3"`
 }
 
 // GetBaseFromSmmIndexType 获取历史指标信息类型

+ 2 - 2
models/data_manage/base_from_usda_fas.go

@@ -286,8 +286,8 @@ func GetBaseFromUsdaFasIndexByIndexCode(indexCode string) (list *BaseFromUsdaFas
 }
 
 type BaseFromUsdaFasIndexType struct {
-	Type2 string `orm:"column(type_2)"`
-	Type3 string `orm:"column(type_3)"`
+	Type2 string `gorm:"column:type_2"`
+	Type3 string `gorm:"column:type_3"`
 }
 
 // Update 更新UsdaFas指标基础信息

+ 4 - 4
models/data_manage/base_from_yongyi.go

@@ -138,14 +138,14 @@ func GetYongyiDataDataTimeByIndexId(indexIdList []int) (items []string, err erro
 }
 
 type BaseFromYongyiData struct {
-	YongyiDataId  int    `orm:"column(yongyi_data_id);pk" gorm:"primaryKey"`
+	YongyiDataId  int `orm:"column(yongyi_data_id);pk" gorm:"primaryKey"`
 	YongyiIndexId int
 	IndexCode     string
 	DataTime      string
 	Value         string
 	CreateTime    string
 	ModifyTime    string
-	DataTimestamp int64  `gorm:"column:data_timestamp"`
+	DataTimestamp int64 `gorm:"column:data_timestamp"`
 }
 
 type BaseFromYongyiIndexSearchItem struct {
@@ -182,8 +182,8 @@ func GetBaseFromYongyiIndexByIndexCode(indexCode string) (list *BaseFromYongyiIn
 }
 
 type BaseFromYongyiIndexType struct {
-	Type2 string `orm:"column(type_2)"`
-	Type3 string `orm:"column(type_3)"`
+	Type2 string `gorm:"column:type_2"`
+	Type3 string `gorm:"column:type_3"`
 }
 
 // Update 更新Yongyi指标基础信息

+ 15 - 5
models/data_manage/mysteel_chemical_index.go

@@ -4,6 +4,7 @@ import (
 	"eta/eta_api/global"
 	"eta/eta_api/utils"
 	"fmt"
+	"gorm.io/gorm"
 	"strings"
 	"time"
 
@@ -180,22 +181,31 @@ func GetMysteelChemicalFrequency(condition string, pars []interface{}) (items []
 
 // MysteelChemicalList 钢联化工指标列表
 type MysteelChemicalList struct {
-	Id                                int                    `orm:"column(base_from_mysteel_chemical_index_id)"`
-	BaseFromMysteelChemicalClassifyId int                    `orm:"column(base_from_mysteel_chemical_classify_id)" description:"钢联化工指标分类id"`
+	Id                                int                    `gorm:"column:base_from_mysteel_chemical_index_id"`
+	BaseFromMysteelChemicalClassifyId int                    `gorm:"column:base_from_mysteel_chemical_classify_id" description:"钢联化工指标分类id"`
 	ParentClassifyId                  int                    `description:"钢联化工指标父级分类id"`
 	IndexCode                         string                 `description:"指标编码"`
 	IndexName                         string                 `description:"指标名称"`
-	UnitName                          string                 `orm:"column(unit)"`
+	UnitName                          string                 `gorm:"column:unit"`
 	UniqueCode                        string                 `description:"唯一编码"`
-	FrequencyName                     string                 `orm:"column(frequency)"`
+	FrequencyName                     string                 `gorm:"column:frequency"`
 	EdbInfoId                         int                    `description:"指标库的id"`
-	UpdateTime                        string                 `orm:"column(modify_time)"`
+	UpdateTime                        string                 `grom:"column:modify_time"`
 	IsStop                            int                    `description:"是否停更:1:停更,0:未停更"`
 	IsSupplierStop                    int                    `description:"是否供应商停更:1:停更,0:未停更"`
 	Paging                            *paging.PagingItem     `description:"分页数据" gorm:"-"`
 	DataList                          []*MysteelChemicalData `gorm:"-"`
 }
 
+func (m *MysteelChemicalList) AfterFind(tx *gorm.DB) (err error) {
+	if utils.NeedDateOrTimeFormat(utils.DbDriverName) {
+		if m.UpdateTime != "" {
+			m.UpdateTime = utils.GormDateStrToDateTimeStr(m.UpdateTime)
+		}
+	}
+	return
+}
+
 // MysteelChemicalData 钢联化工数据列表
 type MysteelChemicalData struct {
 	InputValue string `orm:"column(value)" description:"值"`

+ 9 - 9
models/data_manage/sci_data.go

@@ -37,9 +37,9 @@ type SciIndex struct {
 	Name               string
 	IndexCode          string
 	IndexName          string
-	Type1              string `orm:"column(type_1)"`
-	Type2              string `orm:"column(type_2)"`
-	Type3              string `orm:"column(type_3)"`
+	Type1              string `gorm:"column:type_1"`
+	Type2              string `gorm:"column:type_2"`
+	Type3              string `gorm:"column:type_3"`
 	Frequency          string
 	Unit               string
 	ApiStartTime       string
@@ -88,9 +88,9 @@ type SciExportIndex struct {
 	TypeName   string
 	IndexCode  string
 	IndexName  string
-	Type1      string `orm:"column(type_1)"`
-	Type2      string `orm:"column(type_2)"`
-	Type3      string `orm:"column(type_3)"`
+	Type1      string `gorm:"column:type_1"`
+	Type2      string `gorm:"column:type_2"`
+	Type3      string `gorm:"column:type_3"`
 	Frequency  string
 	Unit       string
 	ModifyTime string
@@ -126,9 +126,9 @@ type SciIndexList struct {
 	Name               string
 	IndexCode          string
 	IndexName          string
-	Type1              string `orm:"column(type_1)"`
-	Type2              string `orm:"column(type_2)"`
-	Type3              string `orm:"column(type_3)"`
+	Type1              string `gorm:"column:type_1"`
+	Type2              string `gorm:"column:type_2"`
+	Type3              string `gorm:"column:type_3"`
 	Frequency          string
 	Unit               string
 	ApiStartTime       string

+ 6 - 6
models/data_manage/smm_data.go

@@ -130,9 +130,9 @@ type SmmExportIndex struct {
 	TypeName   string
 	IndexCode  string
 	IndexName  string
-	Type1      string `orm:"column(type_1)"`
-	Type2      string `orm:"column(type_2)"`
-	Type3      string `orm:"column(type_3)"`
+	Type1      string `gorm:"column:type_1"`
+	Type2      string `gorm:"column:type_2"`
+	Type3      string `gorm:"column:type_3"`
 	Frequency  string
 	Unit       string
 	ModifyTime string
@@ -168,9 +168,9 @@ type SmmIndexList struct {
 	Name               string
 	IndexCode          string
 	IndexName          string
-	Type1              string `orm:"column(type_1)"`
-	Type2              string `orm:"column(type_2)"`
-	Type3              string `orm:"column(type_3)"`
+	Type1              string `gorm:"column:type_1"`
+	Type2              string `gorm:"column:type_2"`
+	Type3              string `gorm:"column:type_3"`
 	Frequency          string
 	Unit               string
 	ApiStartTime       string