config_calving_level.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. package model
  2. import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
  3. type ConfigCalvingLevel struct {
  4. Id int32 `json:"id"`
  5. PastureId int64 `json:"pastureId"`
  6. Kind pasturePb.CalvingLevel_Kind `json:"kind"`
  7. Zh string `json:"zh"`
  8. En string `json:"en"`
  9. Remarks string `json:"remarks"`
  10. IsShow pasturePb.IsShow_Kind `json:"is_show"`
  11. CreatedAt int64 `json:"created_at"`
  12. UpdatedAt int64 `json:"updated_at"`
  13. }
  14. func (c *ConfigCalvingLevel) TableName() string {
  15. return "config_calving_level"
  16. }
  17. type ConfigCalvingLevelSlice []*ConfigCalvingLevel
  18. func (c ConfigCalvingLevelSlice) ToPB(lang string) []*pasturePb.ConfigOptionsList {
  19. res := make([]*pasturePb.ConfigOptionsList, 0)
  20. for _, v := range c {
  21. label := v.Zh
  22. if lang == "en" {
  23. label = v.En
  24. }
  25. res = append(res, &pasturePb.ConfigOptionsList{
  26. Value: int32(v.Kind),
  27. Label: label,
  28. Disabled: true,
  29. })
  30. }
  31. return res
  32. }