dispatch_cost.go 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 DispatchCostGetPageReq struct {
  8. dto.Pagination `search:"-"`
  9. Name string `form:"name" search:"type:contains;column:name;table:dispatch_cost"` // 商品名称
  10. DispatchCostOrder
  11. }
  12. type DispatchCostOrder struct {
  13. CreatedAtOrder string `search:"type:order;column:created_at;table:dispatch_cost" form:"createdAtOrder" default:"desc"`
  14. }
  15. func (m *DispatchCostGetPageReq) GetNeedSearch() interface{} {
  16. return *m
  17. }
  18. type DispatchCostInsertReq struct {
  19. Id int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  20. Name string `json:"name" vd:"len($)>0;msg:'名称不能为空'"` // 商品名称
  21. Price float64 `json:"price"` // 价格
  22. Remark string `json:"remark"` // 备注
  23. common.ControlBy `swaggerignore:"true"`
  24. common.DeptBy `swaggerignore:"true"`
  25. }
  26. func (s *DispatchCostInsertReq) Generate(model *model.DispatchCost) {
  27. if s.Id != 0 {
  28. model.Id = s.Id
  29. }
  30. model.Name = s.Name
  31. model.Price = s.Price
  32. model.Remark = s.Remark
  33. if s.ControlBy.UpdateBy != 0 {
  34. model.UpdateBy = s.UpdateBy
  35. }
  36. if s.ControlBy.CreateBy != 0 {
  37. model.CreateBy = s.CreateBy
  38. }
  39. if s.DeptBy.DeptId != 0 {
  40. model.DeptId = s.DeptId
  41. }
  42. }
  43. func (s *DispatchCostInsertReq) GetId() interface{} {
  44. return s.Id
  45. }
  46. type DispatchCostUpdateReq struct {
  47. Id int `json:"id" comment:"编码"` // 编码
  48. Name string `json:"name"` // 商品名称
  49. Price float64 `json:"price"` // 价格
  50. Remark string `json:"remark"` // 备注
  51. common.ControlBy `swaggerignore:"true"`
  52. }
  53. func (s *DispatchCostUpdateReq) Generate(model *model.DispatchCost) {
  54. if s.Id != 0 {
  55. model.Id = s.Id
  56. }
  57. model.Name = s.Name
  58. model.Price = s.Price
  59. model.Remark = s.Remark
  60. if s.ControlBy.UpdateBy != 0 {
  61. model.UpdateBy = s.UpdateBy
  62. }
  63. if s.ControlBy.CreateBy != 0 {
  64. model.CreateBy = s.CreateBy
  65. }
  66. }
  67. func (s *DispatchCostUpdateReq) GetId() interface{} {
  68. return s.Id
  69. }
  70. type DispatchCostGetReq struct {
  71. Id int `uri:"id"`
  72. }
  73. func (s *DispatchCostGetReq) GetId() interface{} {
  74. return s.Id
  75. }
  76. type DispatchCostDeleteReq struct {
  77. Id int `json:"id"`
  78. common.ControlBy `swaggerignore:"true"`
  79. }
  80. func (s *DispatchCostDeleteReq) GetId() interface{} {
  81. return s.Id
  82. }