warehouse.go 2.8 KB

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