|
@@ -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]
|