warehouse.go 3.4 KB

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