package model import ( "time" pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow" ) type ImmunizationPlanCow struct { Id int64 `json:"id"` CowId int64 `json:"cowId"` ImmunizationPlanId int64 `json:"immunizationPlanId"` ImmunizationPlanName string `json:"immunizationPlanName"` PlanStartTime string `json:"planStartTime"` RealityTime string `json:"realityTime"` Status pasturePb.IsShow_Kind `json:"status"` OperationId int64 `json:"operationId"` OperationName string `json:"operationName"` DrugsId int64 `json:"drugsId"` Unit pasturePb.Unit_Kind `json:"unit"` Usage string `json:"usage"` Remarks string `json:"remarks"` CreateAt int64 `json:"createAt"` UpdateAt int64 `json:"updateAt"` } func (i *ImmunizationPlanCow) TableName() string { return "immunization_plan_cow" } func NewImmunizationPlanCow(cowId int64, immunizationPlan *ImmunizationPlan) *ImmunizationPlanCow { return &ImmunizationPlanCow{ CowId: cowId, ImmunizationPlanId: immunizationPlan.Id, ImmunizationPlanName: immunizationPlan.Name, PlanStartTime: time.Now().Format(LayoutDate2), Status: pasturePb.IsShow_No, } } func NewImmunizationPlanCowList(cowList []*Cow, immunizationPlan *ImmunizationPlan) []*ImmunizationPlanCow { immunizationPlanCowList := make([]*ImmunizationPlanCow, len(cowList)) for i, v := range cowList { immunizationPlanCowList[i] = NewImmunizationPlanCow(v.Id, immunizationPlan) } return immunizationPlanCowList }