address.go 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. package dto
  2. import (
  3. "gas-cylinder-api/app/admin/model"
  4. "gas-cylinder-api/common/dto"
  5. common "gas-cylinder-api/common/model"
  6. )
  7. type AddressGetPageReq struct {
  8. dto.Pagination `search:"-"`
  9. CustomerId string `form:"customerId" search:"type:contains;column:customer_id;table:address"` // 角色名称
  10. AddressOrder
  11. }
  12. type AddressOrder struct {
  13. CreatedAtOrder string `search:"type:order;column:created_at;table:address" form:"createdAtOrder" default:"desc"`
  14. }
  15. func (m *AddressGetPageReq) GetNeedSearch() interface{} {
  16. return *m
  17. }
  18. type AddressInsertReq struct {
  19. Id int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  20. CustomerId string `json:"customerId" swaggerignore:"true"` // 客户id
  21. Name string `json:"name"` // 收货人名称
  22. Phone string `json:"phone"` // 联系电话
  23. City string `json:"city"` // 所在地市
  24. Area string `json:"area"` // 所属区/县
  25. Address string `json:"address"` // 详细地址
  26. }
  27. func (s *AddressInsertReq) Generate(m *model.Address) {
  28. if s.Id != 0 {
  29. m.Id = s.Id
  30. }
  31. m.CustomerId = s.CustomerId
  32. m.Name = s.Name
  33. m.Phone = s.Phone
  34. m.City = s.City
  35. m.Area = s.Area
  36. m.Address = s.Address
  37. }
  38. func (e *AddressInsertReq) SetCustomerId(CustomerId string) {
  39. e.CustomerId = CustomerId
  40. }
  41. func (s *AddressInsertReq) GetId() interface{} {
  42. return s.Id
  43. }
  44. type AddressUpdateReq struct {
  45. Id int `json:"id" comment:"编码"` // 编码
  46. Name string `json:"name"` // 收货人名称
  47. Phone string `json:"phone"` // 联系电话
  48. City string `json:"city"` // 所在地市
  49. Area string `json:"area"` // 所属区/县
  50. Address string `json:"address"` // 详细地址
  51. common.ControlBy `swaggerignore:"true"`
  52. }
  53. func (s *AddressUpdateReq) Generate(m *model.Address) {
  54. if s.Id != 0 {
  55. m.Id = s.Id
  56. }
  57. m.Name = s.Name
  58. m.Phone = s.Phone
  59. m.City = s.City
  60. m.Area = s.Area
  61. m.Address = s.Address
  62. if s.ControlBy.UpdateBy != 0 {
  63. m.UpdateBy = s.UpdateBy
  64. }
  65. if s.ControlBy.CreateBy != 0 {
  66. m.CreateBy = s.CreateBy
  67. }
  68. }
  69. func (s *AddressUpdateReq) GetId() interface{} {
  70. return s.Id
  71. }
  72. type AddressGetReq struct {
  73. Id int `uri:"id"`
  74. }
  75. func (s *AddressGetReq) GetId() interface{} {
  76. return s.Id
  77. }
  78. type AddressDeleteReq struct {
  79. Id int `json:"id"`
  80. common.ControlBy `swaggerignore:"true"`
  81. }
  82. func (s *AddressDeleteReq) GetId() interface{} {
  83. return s.Id
  84. }