package dto import ( "cold-logistics/app/admin/model" "cold-logistics/common/dto" common "cold-logistics/common/model" ) // SysDeptGetPageReq 列表或者搜索使用结构体 type CompanyGetPageReq struct { dto.Pagination `search:"-"` Name string `form:"name" search:"type:contains;column:name;table:sys_dept" example:"公司名称"` //公司名称 CompanyOrder } type CompanyGetAllReq struct { Name string `form:"name" search:"type:contains;column:name;table:sys_dept" example:"公司名称"` //公司名称 CompanyOrder } type CompanyOrder struct { SortOrder string `search:"type:order;column:sort;table:sys_dept" form:"sort" default:"asc"` //排序 ASC 升序 DESC 降序 } func (m *CompanyGetPageReq) GetNeedSearch() interface{} { return *m } func (m *CompanyGetAllReq) GetNeedSearch() interface{} { return *m } type CompanyInsertReq struct { Id int `json:"id" swaggerignore:"true"` Name string `json:"name" example:"名称" vd:"len($)>0;msg:'公司名称不能为空'"` //名称 Remark string `json:"remark"` // 备注 ColdKey string `json:"coldKey" vd:"len($)>0;msg:'公司秘钥不能为空'"` // 冷链3.0key common.ControlBy `swaggerignore:"true"` } func (s *CompanyInsertReq) Generate(model *model.SysDept) { if s.Id != 0 { model.Id = s.Id } model.Name = s.Name model.ParentId = 0 model.Remark = s.Remark model.ColdKey = s.ColdKey } // GetId 获取数据对应的ID func (s *CompanyInsertReq) GetId() interface{} { return s.Id } type CompanyUpdateReq struct { Id int `json:"id" comment:"编码"` // 编码 Name string `json:"name" example:"名称" vd:"len($)>0;msg:'公司名称不能为空'"` //名称 Remark string `json:"remark"` // 备注 ColdKey string `json:"coldKey" vd:"len($)>0;msg:'公司秘钥不能为空'"` // 冷链3.0key common.ControlBy `swaggerignore:"true"` } // Generate 结构体数据转化 从 SysDeptControl 至 SysDept 对应的模型 func (s *CompanyUpdateReq) Generate(model *model.SysDept) { if s.Id != 0 { model.Id = s.Id } model.Name = s.Name model.Remark = s.Remark model.ColdKey = s.ColdKey } // GetId 获取数据对应的ID func (s *CompanyUpdateReq) GetId() interface{} { return s.Id } type MyCompanyUpdateReq struct { Id int `json:"id" comment:"编码"` // 编码 Logo string `json:"logo" example:"https://xxxx.jpg"` // logo Seal string `json:"seal" example:"https://xxxx.jpg"` // 公章 PrintIntercept bool `json:"printIntercept"` // 备注 common.ControlBy `swaggerignore:"true"` } // Generate 结构体数据转化 从 SysDeptControl 至 SysDept 对应的模型 func (s *MyCompanyUpdateReq) Generate(model *model.SysDept) { if s.Id != 0 { model.Id = s.Id } model.Logo = s.Logo model.Seal = s.Seal model.PrintIntercept = s.PrintIntercept } // GetId 获取数据对应的ID func (s *MyCompanyUpdateReq) GetId() interface{} { return s.Id } type CompanyGetReq struct { Id int `uri:"id"` } func (s *CompanyGetReq) GetId() interface{} { return s.Id } type CompanyDeleteReq struct { Id int `json:"id"` } func (s *CompanyDeleteReq) GetId() interface{} { return s.Id } type CompanyEnterReq struct { Id int `json:"id"` } func (s *CompanyEnterReq) GetId() interface{} { return s.Id } // SysDeptGetPageReq 列表或者搜索使用结构体 type AppletCompanyGetPageReq struct { Name string `form:"name" search:"type:contains;column:name;table:sys_dept" example:"部门名称"` //公司名称 District string `form:"district" search:"-" example:"520100"` //所在地市 City string `form:"city" search:"-" example:"520115"` //所在区县 Type int `form:"type" search:"type:exact;column:type;table:sys_dept" swaggerignore:"true"` //公司类型 CompanyOrder } func (m *AppletCompanyGetPageReq) GetNeedSearch() interface{} { return *m }