config_barn_type.go 803 B

1234567891011121314151617181920212223242526272829303132
  1. package model
  2. import (
  3. pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
  4. )
  5. type ConfigBarnType 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 *ConfigBarnType) TableName() string {
  14. return "config_barn_type"
  15. }
  16. type ConfigBarnTypeSlice []*ConfigBarnType
  17. func (c ConfigBarnTypeSlice) ToPB() []*pasturePb.BarnTypeList {
  18. res := make([]*pasturePb.BarnTypeList, len(c))
  19. for i, d := range c {
  20. res[i] = &pasturePb.BarnTypeList{
  21. Value: int32(d.Id),
  22. Label: d.Name,
  23. Disabled: true,
  24. }
  25. }
  26. return res
  27. }