config_lact.go 1.1 KB

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