company.go 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. package dto
  2. import (
  3. "cold-delivery/app/admin/model"
  4. "cold-delivery/common/dto"
  5. common "cold-delivery/common/model"
  6. )
  7. // 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. common.ControlBy `swaggerignore:"true"`
  33. }
  34. func (s *CompanyInsertReq) Generate(model *model.SysDept) {
  35. if s.Id != 0 {
  36. model.Id = s.Id
  37. }
  38. model.Name = s.Name
  39. model.ParentId = s.ParentId
  40. model.Remark = s.Remark
  41. model.ColdKey = s.ColdKey
  42. }
  43. // GetId 获取数据对应的ID
  44. func (s *CompanyInsertReq) GetId() interface{} {
  45. return s.Id
  46. }
  47. type CompanyUpdateReq struct {
  48. Id int `json:"id" comment:"编码"` // 编码
  49. Name string `json:"name" example:"名称"` //名称
  50. Remark string `json:"remark"` // 备注
  51. ColdKey string `json:"coldKey"` // 冷链3.0key
  52. common.ControlBy `swaggerignore:"true"`
  53. }
  54. // Generate 结构体数据转化 从 SysDeptControl 至 SysDept 对应的模型
  55. func (s *CompanyUpdateReq) Generate(model *model.SysDept) {
  56. if s.Id != 0 {
  57. model.Id = s.Id
  58. }
  59. model.Name = s.Name
  60. model.Remark = s.Remark
  61. model.ColdKey = s.ColdKey
  62. }
  63. // GetId 获取数据对应的ID
  64. func (s *CompanyUpdateReq) GetId() interface{} {
  65. return s.Id
  66. }
  67. type CompanyGetReq struct {
  68. Id int `uri:"id"`
  69. }
  70. func (s *CompanyGetReq) GetId() interface{} {
  71. return s.Id
  72. }
  73. type CompanyDeleteReq struct {
  74. Id int `json:"id"`
  75. }
  76. func (s *CompanyDeleteReq) GetId() interface{} {
  77. return s.Id
  78. }
  79. type CompanyEnterReq struct {
  80. Id int `json:"id"`
  81. }
  82. func (s *CompanyEnterReq) GetId() interface{} {
  83. return s.Id
  84. }
  85. // SysDeptGetPageReq 列表或者搜索使用结构体
  86. type AppletCompanyGetPageReq struct {
  87. Name string `form:"name" search:"type:contains;column:name;table:sys_dept" example:"部门名称"` //公司名称
  88. District string `form:"district" search:"-" example:"520100"` //所在地市
  89. City string `form:"city" search:"-" example:"520115"` //所在区县
  90. Type int `form:"type" search:"type:exact;column:type;table:sys_dept" swaggerignore:"true"` //公司类型
  91. CompanyOrder
  92. }
  93. func (m *AppletCompanyGetPageReq) GetNeedSearch() interface{} {
  94. return *m
  95. }
  96. type DeptLabel struct {
  97. Id int `gorm:"-" json:"id"`
  98. Label string `gorm:"-" json:"label"`
  99. Children []DeptLabel `gorm:"-" json:"children"`
  100. }