feed_formula_distribute_log.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package model
  2. import operationPb "kpt-tmr-group/proto/go/backend/operation"
  3. type FeedFormulaDistributeLog struct {
  4. Id int64 `json:"id"`
  5. FeedFormulaId int64 `json:"feed_formula_id"`
  6. PastureId int64 `json:"pasture_id"`
  7. PastureName string `json:"pasture_name"`
  8. IsShow operationPb.IsShow_Kind `json:"is_show"`
  9. CreatedAt int64 `json:"created_at"`
  10. UpdatedAt int64 `json:"updated_at"`
  11. }
  12. func (f *FeedFormulaDistributeLog) TableName() string {
  13. return "feed_formula_distribute_log"
  14. }
  15. func NewFeedFormulaDistributeLog(feedFormulaId, pastureId int64, isShow operationPb.IsShow_Kind) *FeedFormulaDistributeLog {
  16. return &FeedFormulaDistributeLog{
  17. FeedFormulaId: feedFormulaId,
  18. PastureId: pastureId,
  19. IsShow: isShow,
  20. }
  21. }
  22. func NewFeedFormulaDistributeLogList(feedFormulaList []*FeedFormula, pastureId int64, pastureName string, isShow operationPb.IsShow_Kind) []*FeedFormulaDistributeLog {
  23. res := make([]*FeedFormulaDistributeLog, 0)
  24. for _, v := range feedFormulaList {
  25. res = append(res, &FeedFormulaDistributeLog{
  26. FeedFormulaId: v.Id,
  27. PastureId: pastureId,
  28. PastureName: pastureName,
  29. IsShow: isShow,
  30. })
  31. }
  32. return res
  33. }