package dto import ( "Medical_ERP/common/dto" common "Medical_ERP/common/model" "Medical_ERP/models" ) // DosageFormPageReq 列表或者搜索使用结构体 type DosageFormPageReq struct { dto.Pagination `search:"-"` Name string `json:"name" search:"type:contains;column:name;table:dosage_form" example:""` // 名称 } func (m *DosageFormPageReq) GetNeedSearch() interface{} { return *m } // DosageFormInsertReq 增使用的结构体 type DosageFormInsertReq struct { Id int `json:"id" comment:"id" swaggerignore:"true"` Name string `json:"name" example:"剂型" valid:"MinSize(1)"` //剂型 Sort int `json:"sort" example:"0" swaggerignore:"true"` //排序 Remark string `json:"remark" example:"备注" swaggerignore:"true"` //备注 common.ControlBy `swaggerignore:"true"` } func (s *DosageFormInsertReq) Generate(model *models.DosageForm) { model.Name = s.Name model.Sort = s.Sort model.Remark = s.Remark if s.ControlBy.UpdateBy != 0 { model.UpdateBy = s.UpdateBy } if s.ControlBy.CreateBy != 0 { model.CreateBy = s.CreateBy } model.DeptId = s.DeptId } // GetId 获取数据对应的ID func (s *DosageFormInsertReq) GetId() interface{} { return s.Id } // DosageFormUpdateReq 改使用的结构体 type DosageFormUpdateReq struct { Id int `json:"id" example:"1"` Name string `json:"name" example:"剂型"` // 剂型 Sort int `json:"sort" example:"0" swaggerignore:"true"` //排序 Remark string `json:"remark" example:"备注" swaggerignore:"true"` // 备注 common.ControlBy `swaggerignore:"true"` } func (s *DosageFormUpdateReq) Generate(model *models.DosageForm) { model.Id = s.Id model.Name = s.Name model.Sort = s.Sort model.Remark = s.Remark if s.ControlBy.UpdateBy != 0 { model.UpdateBy = s.UpdateBy } if s.ControlBy.CreateBy != 0 { model.CreateBy = s.CreateBy } } func (s *DosageFormUpdateReq) GetId() interface{} { return s.Id } // DosageFormGetReq 获取单个的结构体 type DosageFormGetReq struct { Id int `json:"id"` } func (s *DosageFormGetReq) GetId() interface{} { return s.Id } // DosageFormDeleteReq 删除的结构体 type DosageFormDeleteReq struct { Id int `json:"id"` common.ControlBy `swaggerignore:"true"` } func (s *DosageFormDeleteReq) Generate(model *models.DosageForm) { if s.ControlBy.UpdateBy != 0 { model.UpdateBy = s.UpdateBy } if s.ControlBy.CreateBy != 0 { model.CreateBy = s.CreateBy } } func (s *DosageFormDeleteReq) GetId() interface{} { return s.Id }