company.go 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. package dto
  2. import (
  3. "cold-delivery/app/admin/model"
  4. "cold-delivery/common/dto"
  5. common "cold-delivery/common/model"
  6. )
  7. // CompanyGetPageReq SysDeptGetPageReq 列表或者搜索使用结构体
  8. type CompanyGetPageReq struct {
  9. dto.Pagination `search:"-"`
  10. Name string `form:"name" search:"type:contains;column:name;table:sys_dept" example:"公司名称"` //公司名称
  11. CompanyOrder
  12. }
  13. type CompanyGetAllReq struct {
  14. Name string `form:"name" search:"type:contains;column:name;table:sys_dept" example:"公司名称"` //公司名称
  15. CompanyOrder
  16. }
  17. type CompanyOrder struct {
  18. SortOrder string `search:"type:order;column:sort;table:sys_dept" form:"sort" default:"asc"` //排序 ASC 升序 DESC 降序
  19. }
  20. func (m *CompanyGetPageReq) GetNeedSearch() interface{} {
  21. return *m
  22. }
  23. func (m *CompanyGetAllReq) GetNeedSearch() interface{} {
  24. return *m
  25. }
  26. type CompanyInsertReq struct {
  27. Id int `json:"id" swaggerignore:"true"`
  28. Name string `json:"name" example:"名称" vd:"len($)>0;msg:'公司名称不能为空'"` //名称
  29. Remark string `json:"remark"` // 备注
  30. ColdKey string `json:"coldKey"` // 冷链3.0key
  31. ParentId int `json:"parentId" example:"0" vd:"?"` //上级公司
  32. IsIceReleaseCold bool `json:"isIceReleaseCold" gorm:"type:boolean;default:false"` //冰排是否释冷
  33. IsCoolerReleaseCold bool `json:"isCoolerReleaseCold" gorm:"type:boolean;default:false"` //保温箱是否释冷
  34. IsOutStorage bool `json:"isOutStorage" gorm:"type:boolean;default:false"` //是否出库
  35. IceRaftManage bool `json:"iceRaftManage"` //冰排管理
  36. CompanyAddress string `json:"companyAddress"` //公司地址
  37. AppName string `json:"appName"` // app名称
  38. CompanyCoordinate string `json:"companyCoordinate"` //坐标地址
  39. common.ControlBy `swaggerignore:"true"`
  40. }
  41. func (s *CompanyInsertReq) Generate(model *model.SysDept) {
  42. if s.Id != 0 {
  43. model.Id = s.Id
  44. }
  45. model.Name = s.Name
  46. model.ParentId = s.ParentId
  47. model.Remark = s.Remark
  48. model.ColdKey = s.ColdKey
  49. model.CompanyAddress = s.CompanyAddress
  50. model.IsIceReleaseCold = s.IsIceReleaseCold
  51. model.IsCoolerReleaseCold = s.IsCoolerReleaseCold
  52. model.IsOutStorage = s.IsOutStorage
  53. model.IceRaftManage = s.IceRaftManage
  54. model.AppName = s.AppName
  55. model.CompanyCoordinate = s.AppName
  56. }
  57. // GetId 获取数据对应的ID
  58. func (s *CompanyInsertReq) GetId() interface{} {
  59. return s.Id
  60. }
  61. type CompanyUpdateReq struct {
  62. Id int `json:"id" comment:"编码"` // 编码
  63. Name string `json:"name" example:"名称"` //名称
  64. Remark string `json:"remark"` // 备注
  65. ColdKey string `json:"coldKey"` // 冷链3.0key
  66. IsIceReleaseCold bool `json:"isIceReleaseCold"` //冰排是否释冷
  67. IsCoolerReleaseCold bool `json:"isCoolerReleaseCold"` //保温箱是否释冷
  68. IsOutStorage bool `json:"isOutStorage" gorm:"type:boolean;default:false"` //保温箱是否释冷
  69. IsCoolerShow bool `json:"isCoolerShow"` //保温箱是否展示开始使用时间
  70. IceRaftManage bool `json:"iceRaftManage"` //冰排管理
  71. CompanyAddress string `json:"companyAddress"` //公司地址
  72. AppName string `json:"appName"` // app名称
  73. CompanyCoordinate string `json:"companyCoordinate"` //坐标地址
  74. common.ControlBy `swaggerignore:"true"`
  75. }
  76. // Generate 结构体数据转化 从 SysDeptControl 至 SysDept 对应的模型
  77. func (s *CompanyUpdateReq) Generate(model *model.SysDept) {
  78. if s.Id != 0 {
  79. model.Id = s.Id
  80. }
  81. model.Name = s.Name
  82. model.Remark = s.Remark
  83. model.ColdKey = s.ColdKey
  84. model.CompanyAddress = s.CompanyAddress
  85. model.IsIceReleaseCold = s.IsIceReleaseCold
  86. model.IsCoolerReleaseCold = s.IsCoolerReleaseCold
  87. model.IsCoolerShow = s.IsCoolerShow
  88. model.IsOutStorage = s.IsOutStorage
  89. model.IceRaftManage = s.IceRaftManage
  90. model.AppName = s.AppName
  91. model.CompanyCoordinate = s.CompanyCoordinate
  92. }
  93. // GetId 获取数据对应的ID
  94. func (s *CompanyUpdateReq) GetId() interface{} {
  95. return s.Id
  96. }
  97. type CompanyGetReq struct {
  98. Id int `uri:"id"`
  99. }
  100. func (s *CompanyGetReq) GetId() interface{} {
  101. return s.Id
  102. }
  103. type CompanyDeleteReq struct {
  104. Id int `json:"id"`
  105. }
  106. func (s *CompanyDeleteReq) GetId() interface{} {
  107. return s.Id
  108. }
  109. type CompanyEnterReq struct {
  110. Id int `json:"id"`
  111. }
  112. func (s *CompanyEnterReq) GetId() interface{} {
  113. return s.Id
  114. }
  115. // SysDeptGetPageReq 列表或者搜索使用结构体
  116. type AppletCompanyGetPageReq struct {
  117. Name string `form:"name" search:"type:contains;column:name;table:sys_dept" example:"部门名称"` //公司名称
  118. District string `form:"district" search:"-" example:"520100"` //所在地市
  119. City string `form:"city" search:"-" example:"520115"` //所在区县
  120. Type int `form:"type" search:"type:exact;column:type;table:sys_dept" swaggerignore:"true"` //公司类型
  121. CompanyOrder
  122. }
  123. func (m *AppletCompanyGetPageReq) GetNeedSearch() interface{} {
  124. return *m
  125. }
  126. type DeptLabel struct {
  127. Id int `gorm:"-" json:"id"`
  128. Label string `gorm:"-" json:"label"`
  129. Children []DeptLabel `gorm:"-" json:"children"`
  130. }