warehouse.go 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. package dto
  2. import (
  3. "cold-delivery/app/admin/model"
  4. "cold-delivery/common/dto"
  5. common "cold-delivery/common/model"
  6. )
  7. type WarehouseGetPageReq struct {
  8. dto.Pagination `search:"-"`
  9. //Name string `form:"name" search:"type:contains;column:name;table:warehouse"` // 仓库名称
  10. Name string `form:"name" search:"-"` // 仓库名称
  11. Sn string `form:"sn" search:"type:contains;column:sn;table:warehouse"` // sn
  12. IsBind bool `form:"isBind" search:"-"` // 是否绑定司机
  13. WarehouseOrder
  14. }
  15. type WarehouseOrder struct {
  16. CreatedAtOrder string `search:"type:order;column:created_at;table:warehouse" form:"createdAtOrder" default:"desc"`
  17. }
  18. func (m *WarehouseGetPageReq) GetNeedSearch() interface{} {
  19. return *m
  20. }
  21. type WarehouseInsertReq struct {
  22. Id int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  23. Name string `json:"name"` // 商品名称
  24. Sn string `json:"sn"` // sn
  25. Address string `json:"address"` // 地址
  26. Status string `json:"status"` // 1-停用 2-正启用
  27. UserId int `json:"userId"` // 绑定的用户id
  28. common.ControlBy `swaggerignore:"true"`
  29. common.DeptBy `swaggerignore:"true"`
  30. }
  31. func (s *WarehouseInsertReq) Generate(model *model.Warehouse) {
  32. if s.Id != 0 {
  33. model.Id = s.Id
  34. }
  35. model.Name = s.Name
  36. model.Sn = s.Sn
  37. model.Status = s.Status
  38. model.Address = s.Address
  39. model.UserId = s.UserId
  40. if s.ControlBy.UpdateBy != 0 {
  41. model.UpdateBy = s.UpdateBy
  42. }
  43. if s.ControlBy.CreateBy != 0 {
  44. model.CreateBy = s.CreateBy
  45. }
  46. if s.DeptBy.DeptId != 0 {
  47. model.DeptId = s.DeptId
  48. }
  49. }
  50. func (s *WarehouseInsertReq) GetId() interface{} {
  51. return s.Id
  52. }
  53. type WarehouseUpdateReq struct {
  54. Id int `json:"id" comment:"编码"` // 编码
  55. Name string `json:"name"` // 商品名称
  56. Sn string `json:"sn"` // sn
  57. Address string `json:"address"` // 地址
  58. Status string `json:"status"` // 1-停用 2-正启用
  59. UserId int `json:"userId"` // 绑定的用户id
  60. common.ControlBy `swaggerignore:"true"`
  61. }
  62. func (s *WarehouseUpdateReq) Generate(model *model.Warehouse) {
  63. if s.Id != 0 {
  64. model.Id = s.Id
  65. }
  66. model.Name = s.Name
  67. model.Sn = s.Sn
  68. model.Address = s.Address
  69. model.Status = s.Status
  70. model.UserId = s.UserId
  71. if s.ControlBy.UpdateBy != 0 {
  72. model.UpdateBy = s.UpdateBy
  73. }
  74. if s.ControlBy.CreateBy != 0 {
  75. model.CreateBy = s.CreateBy
  76. }
  77. }
  78. func (s *WarehouseUpdateReq) GetId() interface{} {
  79. return s.Id
  80. }
  81. type WarehouseGetReq struct {
  82. Id int `uri:"id"`
  83. }
  84. func (s *WarehouseGetReq) GetId() interface{} {
  85. return s.Id
  86. }
  87. type WarehouseDeleteReq struct {
  88. Id int `json:"id"`
  89. common.ControlBy `swaggerignore:"true"`
  90. }
  91. func (s *WarehouseDeleteReq) GetId() interface{} {
  92. return s.Id
  93. }