config_abortion_reasons.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package model
  2. import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
  3. type ConfigAbortionReasons struct {
  4. Id int32 `json:"id"`
  5. PastureId int64 `json:"pastureId"`
  6. Kind pasturePb.AbortionReasons_Kind `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 *ConfigAbortionReasons) TableName() string {
  16. return "config_abortion_reasons"
  17. }
  18. type ConfigAbortionReasonsSlice []*ConfigAbortionReasons
  19. func (c ConfigAbortionReasonsSlice) 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: int32(v.Kind),
  28. Label: label,
  29. Disabled: true,
  30. })
  31. }
  32. return res
  33. }