1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- package dto
- import (
- "Medical_ERP/common/dto"
- common "Medical_ERP/common/model"
- "Medical_ERP/models"
- )
- // UnitPageReq 列表或者搜索使用结构体
- type UnitPageReq struct {
- dto.Pagination `search:"-"`
- Name string `json:"name" search:"type:contains;column:name;table:unit" example:""` // 名称
- }
- func (m *UnitPageReq) GetNeedSearch() interface{} {
- return *m
- }
- // UnitInsertReq 增使用的结构体
- type UnitInsertReq 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 *UnitInsertReq) Generate(model *models.Unit) {
- 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 *UnitInsertReq) GetId() interface{} {
- return s.Id
- }
- // UnitUpdateReq 改使用的结构体
- type UnitUpdateReq 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 *UnitUpdateReq) Generate(model *models.Unit) {
- 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 *UnitUpdateReq) GetId() interface{} {
- return s.Id
- }
- // UnitGetReq 获取单个的结构体
- type UnitGetReq struct {
- Id int `json:"id"`
- }
- func (s *UnitGetReq) GetId() interface{} {
- return s.Id
- }
- // UnitDeleteReq 删除的结构体
- type UnitDeleteReq struct {
- Id int `json:"id"`
- common.ControlBy `swaggerignore:"true"`
- }
- func (s *UnitDeleteReq) Generate(model *models.Unit) {
- if s.ControlBy.UpdateBy != 0 {
- model.UpdateBy = s.UpdateBy
- }
- if s.ControlBy.CreateBy != 0 {
- model.CreateBy = s.CreateBy
- }
- }
- func (s *UnitDeleteReq) GetId() interface{} {
- return s.Id
- }
|