neck_ring_bind_log.go 974 B

1234567891011121314151617181920212223242526272829303132333435
  1. package model
  2. import "time"
  3. type NeckRingBindLog struct {
  4. Id int64 `json:"id"`
  5. PastureId int64 `json:"pastureId"`
  6. NeckRingNumber string `json:"neckRingNumber"`
  7. CowId int64 `json:"cowId"`
  8. BindAt int64 `json:"bindAt"`
  9. UnBindAt int64 `json:"unBindAt"`
  10. OperationId int64 `json:"operationId"`
  11. OperationName string `json:"operationName"`
  12. CreatedAt int64 `json:"createdAt"`
  13. UpdatedAt int64 `json:"updatedAt"`
  14. }
  15. func (n *NeckRingBindLog) TableName() string {
  16. return "neck_ring_bind_log"
  17. }
  18. func NewNeckRingBindLog(pastureId int64, cowInfo *Cow, operationUser *SystemUser) *NeckRingBindLog {
  19. return &NeckRingBindLog{
  20. PastureId: pastureId,
  21. NeckRingNumber: cowInfo.NeckRingNumber,
  22. BindAt: time.Now().Unix(),
  23. CowId: cowInfo.Id,
  24. OperationId: operationUser.Id,
  25. OperationName: operationUser.Name,
  26. }
  27. }
  28. func (n *NeckRingBindLog) UnBind() {
  29. n.UnBindAt = time.Now().Unix()
  30. }