feed_formula_distribute_log.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  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. IsShow operationPb.IsShow_Kind `json:"is_show"`
  8. CreatedAt int64 `json:"created_at"`
  9. UpdatedAt int64 `json:"updated_at"`
  10. }
  11. func (f *FeedFormulaDistributeLog) TableName() string {
  12. return "feed_formula_distribute_log"
  13. }
  14. func NewFeedFormulaDistributeLog(feedFormulaId, pastureId int64, isShow operationPb.IsShow_Kind) *FeedFormulaDistributeLog {
  15. return &FeedFormulaDistributeLog{
  16. FeedFormulaId: feedFormulaId,
  17. PastureId: pastureId,
  18. IsShow: isShow,
  19. }
  20. }
  21. func NewFeedFormulaDistributeLogList(feedFormulaList []*FeedFormula, pastureId int64, isShow operationPb.IsShow_Kind) []*FeedFormulaDistributeLog {
  22. res := make([]*FeedFormulaDistributeLog, 0)
  23. for _, v := range feedFormulaList {
  24. res = append(res, &FeedFormulaDistributeLog{
  25. FeedFormulaId: v.Id,
  26. PastureId: pastureId,
  27. IsShow: isShow,
  28. })
  29. }
  30. return res
  31. }