warehouse.go 2.2 KB

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