company.go 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. package dto
  2. import (
  3. "cold-logistics/app/admin/model"
  4. "cold-logistics/common/dto"
  5. common "cold-logistics/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" vd:"len($)>0;msg:'公司秘钥不能为空'"` // 冷链3.0key
  31. common.ControlBy `swaggerignore:"true"`
  32. }
  33. func (s *CompanyInsertReq) Generate(model *model.SysDept) {
  34. if s.Id != 0 {
  35. model.Id = s.Id
  36. }
  37. model.Name = s.Name
  38. model.ParentId = 0
  39. model.Remark = s.Remark
  40. model.ColdKey = s.ColdKey
  41. }
  42. // GetId 获取数据对应的ID
  43. func (s *CompanyInsertReq) GetId() interface{} {
  44. return s.Id
  45. }
  46. type CompanyUpdateReq struct {
  47. Id int `json:"id" comment:"编码"` // 编码
  48. Name string `json:"name" example:"名称" vd:"len($)>0;msg:'公司名称不能为空'"` //名称
  49. Remark string `json:"remark"` // 备注
  50. ColdKey string `json:"coldKey" vd:"len($)>0;msg:'公司秘钥不能为空'"` // 冷链3.0key
  51. common.ControlBy `swaggerignore:"true"`
  52. }
  53. // Generate 结构体数据转化 从 SysDeptControl 至 SysDept 对应的模型
  54. func (s *CompanyUpdateReq) Generate(model *model.SysDept) {
  55. if s.Id != 0 {
  56. model.Id = s.Id
  57. }
  58. model.Name = s.Name
  59. model.Remark = s.Remark
  60. model.ColdKey = s.ColdKey
  61. }
  62. // GetId 获取数据对应的ID
  63. func (s *CompanyUpdateReq) GetId() interface{} {
  64. return s.Id
  65. }
  66. type MyCompanyUpdateReq struct {
  67. Id int `json:"id" comment:"编码"` // 编码
  68. Logo string `json:"logo" example:"https://xxxx.jpg"` // logo
  69. Seal string `json:"seal" example:"https://xxxx.jpg"` // 公章
  70. PrintIntercept bool `json:"printIntercept"` // 备注
  71. common.ControlBy `swaggerignore:"true"`
  72. }
  73. // Generate 结构体数据转化 从 SysDeptControl 至 SysDept 对应的模型
  74. func (s *MyCompanyUpdateReq) Generate(model *model.SysDept) {
  75. if s.Id != 0 {
  76. model.Id = s.Id
  77. }
  78. model.Logo = s.Logo
  79. model.Seal = s.Seal
  80. model.PrintIntercept = s.PrintIntercept
  81. }
  82. // GetId 获取数据对应的ID
  83. func (s *MyCompanyUpdateReq) GetId() interface{} {
  84. return s.Id
  85. }
  86. type CompanyGetReq struct {
  87. Id int `uri:"id"`
  88. }
  89. func (s *CompanyGetReq) GetId() interface{} {
  90. return s.Id
  91. }
  92. type CompanyDeleteReq struct {
  93. Id int `json:"id"`
  94. }
  95. func (s *CompanyDeleteReq) GetId() interface{} {
  96. return s.Id
  97. }
  98. type CompanyEnterReq struct {
  99. Id int `json:"id"`
  100. }
  101. func (s *CompanyEnterReq) GetId() interface{} {
  102. return s.Id
  103. }
  104. // SysDeptGetPageReq 列表或者搜索使用结构体
  105. type AppletCompanyGetPageReq struct {
  106. Name string `form:"name" search:"type:contains;column:name;table:sys_dept" example:"部门名称"` //公司名称
  107. District string `form:"district" search:"-" example:"520100"` //所在地市
  108. City string `form:"city" search:"-" example:"520115"` //所在区县
  109. Type int `form:"type" search:"type:exact;column:type;table:sys_dept" swaggerignore:"true"` //公司类型
  110. CompanyOrder
  111. }
  112. func (m *AppletCompanyGetPageReq) GetNeedSearch() interface{} {
  113. return *m
  114. }