config_disease_type.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package model
  2. import (
  3. pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
  4. )
  5. type ConfigDiseaseType struct {
  6. Id int64 `json:"id"`
  7. Name string `json:"name"`
  8. Remarks string `json:"remarks"`
  9. IsShow pasturePb.IsShow_Kind `json:"is_show"`
  10. CreatedAt int64 `json:"created_at"`
  11. UpdatedAt int64 `json:"updated_at"`
  12. }
  13. func (c *ConfigDiseaseType) TableName() string {
  14. return "config_disease_type"
  15. }
  16. type ConfigDiseaseTypeSlice []*ConfigDiseaseType
  17. func (c ConfigDiseaseTypeSlice) ToPB() []*pasturePb.SearchBaseConfigList {
  18. res := make([]*pasturePb.SearchBaseConfigList, len(c))
  19. for i, d := range c {
  20. res[i] = &pasturePb.SearchBaseConfigList{
  21. Id: int32(d.Id),
  22. Name: d.Name,
  23. Remarks: d.Remarks,
  24. IsShow: d.IsShow,
  25. CreatedAt: int32(d.CreatedAt),
  26. UpdatedAt: int32(d.UpdatedAt),
  27. }
  28. }
  29. return res
  30. }
  31. func (c ConfigDiseaseTypeSlice) ToPB2() []*pasturePb.ConfigOptionsList {
  32. res := make([]*pasturePb.ConfigOptionsList, len(c))
  33. for i, d := range c {
  34. res[i] = &pasturePb.ConfigOptionsList{
  35. Value: int32(d.Id),
  36. Label: d.Name,
  37. Disabled: true,
  38. }
  39. }
  40. return res
  41. }