package dto import ( "cold-delivery/app/admin/model" "cold-delivery/common/dto" common "cold-delivery/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"` // 冷链3.0key ParentId int `json:"parentId" example:"0" vd:"?"` //上级公司 IsIceReleaseCold bool `json:"isIceReleaseCold" gorm:"type:boolean;default:false"` //冰排是否释冷 IsCoolerReleaseCold bool `json:"isCoolerReleaseCold" gorm:"type:boolean;default:false"` //保温箱是否释冷 IsOutStorage bool `json:"isOutStorage" gorm:"type:boolean;default:false"` //是否出库 CompanyAddress string `json:"companyAddress"` //公司地址 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 = s.ParentId model.Remark = s.Remark model.ColdKey = s.ColdKey model.CompanyAddress = s.CompanyAddress model.IsIceReleaseCold = s.IsIceReleaseCold model.IsCoolerReleaseCold = s.IsCoolerReleaseCold model.IsOutStorage = s.IsOutStorage } // GetId 获取数据对应的ID func (s *CompanyInsertReq) GetId() interface{} { return s.Id } type CompanyUpdateReq struct { Id int `json:"id" comment:"编码"` // 编码 Name string `json:"name" example:"名称"` //名称 Remark string `json:"remark"` // 备注 ColdKey string `json:"coldKey"` // 冷链3.0key IsIceReleaseCold bool `json:"isIceReleaseCold"` //冰排是否释冷 IsCoolerReleaseCold bool `json:"isCoolerReleaseCold"` //保温箱是否释冷 IsOutStorage bool `json:"isOutStorage" gorm:"type:boolean;default:false"` //保温箱是否释冷 IsCoolerShow bool `json:"isCoolerShow"` //保温箱是否展示开始使用时间 CompanyAddress string `json:"companyAddress"` //公司地址 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 model.CompanyAddress = s.CompanyAddress model.IsIceReleaseCold = s.IsIceReleaseCold model.IsCoolerReleaseCold = s.IsCoolerReleaseCold model.IsCoolerShow = s.IsCoolerShow model.IsOutStorage = s.IsOutStorage } // GetId 获取数据对应的ID func (s *CompanyUpdateReq) 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 } type DeptLabel struct { Id int `gorm:"-" json:"id"` Label string `gorm:"-" json:"label"` Children []DeptLabel `gorm:"-" json:"children"` }