1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- package data_manage
- import (
- "eta_gn/eta_api/global"
- "time"
- )
- type LzClassify struct {
- BreedId int `description:"分类id"`
- BreedName string `description:"分类名称"`
- }
- func GetLzSurveyClassify() (items []*LzClassify, err error) {
- sql := ` SELECT breed_id,breed_name FROM longzhong_survey_product GROUP BY breed_name ORDER BY breed_name DESC `
- err = global.DmSQL["data"].Raw(sql).Find(&items).Error
- return
- }
- type LzFrequency struct {
- Frequency int `description:"频度:1-日度 2-周度 3-月度 4-季度 5-年度 99-无固定频率"`
- }
- func GetLzFrequencyByClassifyId(breedId int) (items []*LzFrequency, err error) {
- sql := ` SELECT frequency FROM longzhong_survey_product WHERE breed_id=? GROUP BY frequency ORDER BY frequency ASC `
- err = global.DmSQL["data"].Raw(sql, breedId).Find(&items).Error
- return
- }
- type LongzhongSurveyProduct struct {
- SurveyProductId int `orm:"column(survey_product_id);pk" gorm:"primaryKey" `
- ProjectQuotaId int64
- BreedId string
- BreedName string
- QuotaId string
- QuotaName string
- UnitId string
- UnitName string
- SampleType int64
- SampleId string
- SampleName string
- DeviceId string
- Device string
- ProductCraftId string
- ProductCraft string
- ProductLine string
- InputMode int64
- Frequency int64
- InputValue string
- TaskShouldFinishTime int
- CustomId string
- CustomType int64
- Custom string
- QuotaSampleId int64
- StartDate string
- EndDate string
- ModifyTime time.Time
- LzCode string
- }
- func GetLongzhongSurveyProduct(breedId, frequency int) (items []*LongzhongSurveyProduct, err error) {
- sql := ` SELECT * FROM longzhong_survey_product WHERE breed_id=? AND frequency=? ORDER BY survey_product_id ASC `
- err = global.DmSQL["data"].Raw(sql, breedId, frequency).Find(&items).Error
- return
- }
- type LzProductList struct {
- SurveyProductId int `orm:"column(survey_product_id);pk" gorm:"primaryKey" `
- BreedName string `description:"品种名称"`
- QuotaName string `description:"指标名称"`
- UnitName string `description:"单位"`
- SampleType int64 `description:"样本类型 0-空 1-企业 2-港口 3-运距 4-区域/国家 99-不确定"`
- SampleName string `description:"样本名称"`
- Device string `description:"设备"`
- Frequency int64 `description:"频度"`
- Custom string `description:"扩展字段"`
- StartDate string `description:"开始日期"`
- EndDate string `description:"结束日期"`
- ModifyTime string `description:"修改时间"`
- LzCode string `description:"指标编码"`
- DataList []*LzProductData
- }
- type LzProductData struct {
- InputValue string `description:"日期"`
- DataTime string `description:"值"`
- }
- func GetLongzhongSurveyProductData(surveyProductId int) (items []*LzProductData, err error) {
- sql := ` SELECT * FROM longzhong_survey_data WHERE survey_product_id=? ORDER BY data_time DESC `
- err = global.DmSQL["data"].Raw(sql, surveyProductId).Find(&items).Error
- return
- }
- func GetLongzhongSurveyProductByCode(lzCode string) (items *LongzhongSurveyProduct, err error) {
- sql := ` SELECT * FROM longzhong_survey_product WHERE lz_code=? `
- err = global.DmSQL["data"].Raw(sql, lzCode).First(&items).Error
- return
- }
|