gas_cylinder_spec.go 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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 GasCylinderSpecGetPageReq struct {
  8. dto.Pagination `search:"-"`
  9. Name string `form:"name" search:"type:contains;column:name;table:gas_cylinder_spec"` // 钢瓶规格名称
  10. GasCylinderSpecOrder
  11. }
  12. type GasCylinderSpecOrder struct {
  13. CreatedAtOrder string `search:"type:order;column:created_at;table:gas_cylinder_spec" form:"createdAtOrder" default:"desc"`
  14. }
  15. func (m *GasCylinderSpecGetPageReq) GetNeedSearch() interface{} {
  16. return *m
  17. }
  18. type GasCylinderSpecInsertReq struct {
  19. Id int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  20. Name string `json:"name" vd:"len($)>0;msg:'钢瓶规格名称不能为空'"` // 钢瓶规格名称
  21. Remark string `json:"remark"` // 备注
  22. common.ControlBy `swaggerignore:"true"`
  23. common.DeptBy `swaggerignore:"true"`
  24. }
  25. func (s *GasCylinderSpecInsertReq) Generate(model *model.GasCylinderSpec) {
  26. if s.Id != 0 {
  27. model.Id = s.Id
  28. }
  29. model.Name = s.Name
  30. model.Remark = s.Remark
  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 *GasCylinderSpecInsertReq) GetId() interface{} {
  42. return s.Id
  43. }
  44. type GasCylinderSpecUpdateReq struct {
  45. Id int `json:"id" comment:"编码"` // 编码
  46. Name string `json:"name" vd:"len($)>0;msg:'钢瓶规格名称不能为空'"` // 钢瓶规格名称
  47. Remark string `json:"remark"` // 备注
  48. common.ControlBy `swaggerignore:"true"`
  49. }
  50. func (s *GasCylinderSpecUpdateReq) Generate(model *model.GasCylinderSpec) {
  51. if s.Id != 0 {
  52. model.Id = s.Id
  53. }
  54. model.Name = s.Name
  55. model.Remark = s.Remark
  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 *GasCylinderSpecUpdateReq) GetId() interface{} {
  64. return s.Id
  65. }
  66. type GasCylinderSpecGetReq struct {
  67. Id int `uri:"id" vd:"$>0;msg:'id不能为空'"`
  68. }
  69. func (s *GasCylinderSpecGetReq) GetId() interface{} {
  70. return s.Id
  71. }
  72. type GasCylinderSpecDeleteReq struct {
  73. Id int `json:"id" vd:"$>0;msg:'id不能为空'"`
  74. common.ControlBy `swaggerignore:"true"`
  75. }
  76. func (s *GasCylinderSpecDeleteReq) GetId() interface{} {
  77. return s.Id
  78. }
  79. type AppletGasCylinderSpecGetPageReq struct {
  80. dto.Pagination `search:"-"`
  81. StoreId int `form:"storeId" search:"type:exact;column:dept_id;table:gas_cylinder_spec" vd:"$>0;msg:'门店id不能为空'"`
  82. Name string `form:"name" search:"type:contains;column:name;table:gas_cylinder_spec"` // 钢瓶规格名称
  83. GasCylinderSpecOrder
  84. }
  85. func (m *AppletGasCylinderSpecGetPageReq) GetNeedSearch() interface{} {
  86. return *m
  87. }