package supply_analysis import ( "eta_gn/eta_index_lib/global" "time" ) // VarietyPlant variety_plant 品种装置表 type VarietyPlant struct { VarietyPlantId int `gorm:"primaryKey;autoIncrement;column:variety_plant_id" description:"品种装置ID"` VarietyId int `gorm:"column:variety_id" description:"品种id"` Province string `gorm:"column:province" description:"所属省份"` City string `gorm:"column:city" description:"所属城市"` FactoryName string `gorm:"column:factory_name" description:"工厂名称"` PlantName string `gorm:"column:plant_name" description:"装置/产线名称"` MaintenanceDate time.Time `gorm:"column:maintenance_date" description:"检修日期"` ResumptionDate time.Time `gorm:"column:resumption_date" description:"复产日期"` AnnualCapacity float64 `gorm:"column:annual_capacity" description:"年产能"` Coefficient float64 `gorm:"column:coefficient" description:"降负系数"` AverageDailyCapacityReduction float64 `gorm:"column:average_daily_capacity_reduction" description:"日均产量减量"` IsStop int `gorm:"column:is_stop" description:"是否停产,0:未停产;1:停产;默认未停产"` Sort int `gorm:"column:sort" description:"排序字段,越小越靠前"` SysUserId int `gorm:"column:sys_user_id" description:"添加人id"` SysUserRealName string `gorm:"column:sys_user_real_name" description:"添加人真实姓名"` ModifyTime time.Time `gorm:"column:modify_time" description:"最近一次更新时间"` CreateTime time.Time `gorm:"column:create_time" description:"添加时间"` } // GetAllVarietyPlantByVarietyId 根据品种id获取所有的装置 func GetAllVarietyPlantByVarietyId(varietyId int) (items []*VarietyPlant, err error) { sql := `SELECT * FROM variety_plant a WHERE variety_id = ? ORDER BY variety_plant_id desc ` err = global.DEFAULT_DmSQL.Raw(sql, varietyId).Scan(&items).Error return }