warehouse.go 2.0 KB

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