address.go 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. package dto
  2. import (
  3. "cold-logistics/app/admin/model"
  4. "cold-logistics/common/dto"
  5. common "cold-logistics/common/model"
  6. )
  7. type AddressGetPageReq struct {
  8. dto.Pagination `search:"-"`
  9. Name string `form:"name" search:"-"` // 地址名称
  10. AddressType string `form:"addressType" search:"type:exact;column:address_type;table:address"` // 地址类型:sender-发货人 consignee-收货人
  11. DataType string `form:"dataType" search:"-"` // 我的my 全部all
  12. AddressOrder
  13. }
  14. type AddressOrder struct {
  15. CreatedAtOrder string `search:"type:order;column:created_at;table:address" form:"createdAtOrder" default:"desc"`
  16. }
  17. func (m *AddressGetPageReq) GetNeedSearch() interface{} {
  18. return *m
  19. }
  20. type AddressInsertReq struct {
  21. Id int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  22. Name string `json:"name" vd:"len($)>0;msg:'姓名不能为空'"` // 收货人名称
  23. Phone string `json:"phone" vd:"len($)>0;msg:'手机号不能为空'"` // 联系电话
  24. Address string `json:"address" vd:"len($)>0;msg:'详细地址不能为空'"` // 详细地址
  25. IsDefault bool `json:"isDefault"` // 默认地址
  26. ProvinceId string `json:"provinceId"` // 省Id
  27. ProvinceName string `json:"provinceName"` // 省中文名
  28. CityId string `json:"cityId"` // 市Id
  29. CityName string `json:"cityName"` // 市中文名
  30. RegionId string `json:"regionId"` // 区Id
  31. RegionName string `json:"regionName"` // 区中文名
  32. AddressType string `json:"addressType"` // 地址类型:sender-发货人 consignee-收货人
  33. common.ControlBy `swaggerignore:"true"`
  34. common.DeptBy `swaggerignore:"true"`
  35. }
  36. func (s *AddressInsertReq) Generate(m *model.Address) {
  37. if s.Id != 0 {
  38. m.Id = s.Id
  39. }
  40. m.Name = s.Name
  41. m.Phone = s.Phone
  42. m.Address = s.Address
  43. m.IsDefault = s.IsDefault
  44. m.ProvinceId = s.ProvinceId
  45. m.ProvinceName = s.ProvinceName
  46. m.CityId = s.CityId
  47. m.CityName = s.CityName
  48. m.RegionId = s.RegionId
  49. m.RegionName = s.RegionName
  50. m.AddressType = s.AddressType
  51. if s.ControlBy.UpdateBy != 0 {
  52. m.UpdateBy = s.UpdateBy
  53. }
  54. if s.ControlBy.CreateBy != 0 {
  55. m.CreateBy = s.CreateBy
  56. }
  57. if s.DeptBy.DeptId != 0 {
  58. m.DeptId = s.DeptId
  59. }
  60. }
  61. func (s *AddressInsertReq) GetId() interface{} {
  62. return s.Id
  63. }
  64. type AddressUpdateReq struct {
  65. Id int `json:"id" comment:"编码"` // 编码
  66. Name string `json:"name" vd:"len($)>0;msg:'姓名不能为空'"` // 收货人名称
  67. Phone string `json:"phone" vd:"len($)>0;msg:'手机号不能为空'"` // 联系电话
  68. Address string `json:"address" vd:"len($)>0;msg:'详细地址不能为空'"` // 详细地址
  69. IsDefault bool `json:"isDefault"` // 默认地址
  70. ProvinceId string `json:"provinceId"` // 省Id
  71. ProvinceName string `json:"provinceName"` // 省中文名
  72. CityId string `json:"cityId"` // 市Id
  73. CityName string `json:"cityName"` // 市中文名
  74. RegionId string `json:"regionId"` // 区Id
  75. RegionName string `json:"regionName"` // 区中文名
  76. AddressType string `json:"addressType"` // 地址类型:sender-发货人 consignee-收货人
  77. common.ControlBy `swaggerignore:"true"`
  78. }
  79. func (s *AddressUpdateReq) Generate(m *model.Address) {
  80. if s.Id != 0 {
  81. m.Id = s.Id
  82. }
  83. m.Name = s.Name
  84. m.Phone = s.Phone
  85. m.Address = s.Address
  86. m.IsDefault = s.IsDefault
  87. m.ProvinceId = s.ProvinceId
  88. m.ProvinceName = s.ProvinceName
  89. m.CityId = s.CityId
  90. m.CityName = s.CityName
  91. m.RegionId = s.RegionId
  92. m.RegionName = s.RegionName
  93. m.AddressType = s.AddressType
  94. if s.ControlBy.UpdateBy != 0 {
  95. m.UpdateBy = s.UpdateBy
  96. }
  97. if s.ControlBy.CreateBy != 0 {
  98. m.CreateBy = s.CreateBy
  99. }
  100. }
  101. func (s *AddressUpdateReq) GetId() interface{} {
  102. return s.Id
  103. }
  104. type AddressGetReq struct {
  105. Id int `uri:"id"`
  106. }
  107. func (s *AddressGetReq) GetId() interface{} {
  108. return s.Id
  109. }
  110. type AddressDeleteReq struct {
  111. Id int `json:"id"`
  112. common.ControlBy `swaggerignore:"true"`
  113. }
  114. func (s *AddressDeleteReq) GetId() interface{} {
  115. return s.Id
  116. }