gas_cylinder_status.go 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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 GasCylinderStatusGetPageReq struct {
  8. dto.Pagination `search:"-"`
  9. UserId int `form:"userId" search:"-"`
  10. CompanyId string `form:"companyId" search:"-"`
  11. InnerCode string `form:"inner_code" search:"type:contains;column:inner_code;table:gas_cylinder_status"` // 1单位内编号
  12. Status string `form:"status" search:"-"` // 1-重瓶区 2-空瓶区 3-不合格瓶区
  13. GasCylinderStatusOrder
  14. }
  15. type GasCylinderStatusOrder struct {
  16. CreatedAtOrder string `search:"type:order;column:created_at;table:gas_cylinder_status" form:"createdAtOrder" default:"desc"`
  17. }
  18. func (m *GasCylinderStatusGetPageReq) GetNeedSearch() interface{} {
  19. return *m
  20. }
  21. type GasCylinderStatusInsertReq struct {
  22. Id int `json:"id" comment:"编码"` // 编码
  23. InnerCodeList []string `json:"innerCodeList" vd:"len($)>0;msg:'单位内编码不能为空'"`
  24. Status string `json:"status" vd:"len($)>0;msg:'钢瓶状态不能为空'"` // 钢瓶状态
  25. Remark string `json:"remark"` // 备注
  26. common.ControlBy `swaggerignore:"true"`
  27. common.DeptBy `swaggerignore:"true"`
  28. }
  29. func (s *GasCylinderStatusInsertReq) Generate(innerCode string, model *model.GasCylinderStatus) {
  30. if s.Id != 0 {
  31. model.Id = s.Id
  32. }
  33. model.InnerCode = innerCode
  34. model.Status = s.Status
  35. model.CompanyId = s.DeptId
  36. if s.ControlBy.UpdateBy != 0 {
  37. model.UpdateBy = s.UpdateBy
  38. }
  39. if s.ControlBy.CreateBy != 0 {
  40. model.CreateBy = s.CreateBy
  41. }
  42. if s.DeptBy.DeptId != 0 {
  43. model.DeptId = s.DeptId
  44. }
  45. }
  46. func (s *GasCylinderStatusInsertReq) GetId() interface{} {
  47. return s.Id
  48. }
  49. type GasCylinderStatusGetReq struct {
  50. Id int `uri:"id" vd:"$>0;msg:'id不能为空'"`
  51. }
  52. func (s *GasCylinderStatusGetReq) GetId() interface{} {
  53. return s.Id
  54. }
  55. type GasCylinderStatusDeleteReq struct {
  56. Id int `json:"id" vd:"$>0;msg:'id不能为空'"`
  57. common.ControlBy `swaggerignore:"true"`
  58. }
  59. func (s *GasCylinderStatusDeleteReq) GetId() interface{} {
  60. return s.Id
  61. }
  62. type GasCylinderStatusUpdateReq struct {
  63. InnerCodeList []string `json:"innerCodeList" vd:"len($)>0;msg:'单位内编码不能为空'"`
  64. Status string `json:"status" vd:"len($)>0;msg:'钢瓶状态不能为空'"` // 钢瓶状态
  65. Remark string `json:"remark"` // 备注
  66. common.ControlBy `swaggerignore:"true"`
  67. common.DeptBy `swaggerignore:"true"`
  68. }
  69. func (s *GasCylinderStatusUpdateReq) Generate(innerCode string, model *model.GasCylinderStatus) {
  70. model.InnerCode = innerCode
  71. model.Status = s.Status
  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. if s.DeptBy.DeptId != 0 {
  79. model.DeptId = s.DeptId
  80. }
  81. }