variety_plant.go 2.2 KB

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