cooler_box.go 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. package dto
  2. import (
  3. "cold-logistics/app/admin/model"
  4. "cold-logistics/common/dto"
  5. common "cold-logistics/common/model"
  6. )
  7. type CoolerBoxGetPageReq struct {
  8. dto.Pagination `search:"-"`
  9. Name string `form:"name" search:"type:contains;column:name;table:cooler_box"` // 保温箱
  10. Sn string `form:"sn" search:"type:contains;column:sn;table:cooler_box"` // sn
  11. Status string `form:"status" search:"type:exact;column:status;table:cooler_box"` // 1-停用 2-启用
  12. CoolerBoxOrder
  13. }
  14. type CoolerBoxOrder struct {
  15. CreatedAtOrder string `search:"type:order;column:created_at;table:cooler_box" form:"createdAtOrder" default:"desc"`
  16. }
  17. func (m *CoolerBoxGetPageReq) GetNeedSearch() interface{} {
  18. return *m
  19. }
  20. type CoolerBoxInsertReq struct {
  21. Id int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  22. Name string `json:"name"` // 保温箱名称
  23. Sn string `json:"sn"` // sn
  24. Status string `json:"status"` // 1-停用 2-启用
  25. common.ControlBy `swaggerignore:"true"`
  26. common.DeptBy `swaggerignore:"true"`
  27. }
  28. func (s *CoolerBoxInsertReq) Generate(model *model.CoolerBox) {
  29. if s.Id != 0 {
  30. model.Id = s.Id
  31. }
  32. model.Name = s.Name
  33. model.Sn = s.Sn
  34. model.Status = s.Status
  35. if s.ControlBy.UpdateBy != 0 {
  36. model.UpdateBy = s.UpdateBy
  37. }
  38. if s.ControlBy.CreateBy != 0 {
  39. model.CreateBy = s.CreateBy
  40. }
  41. if s.DeptBy.DeptId != 0 {
  42. model.DeptId = s.DeptId
  43. }
  44. }
  45. func (s *CoolerBoxInsertReq) GetId() interface{} {
  46. return s.Id
  47. }
  48. type CoolerBoxUpdateReq struct {
  49. Id int `json:"id" comment:"编码"` // 编码
  50. Name string `json:"Name"` // 保温箱名称
  51. Sn string `json:"sn"` // sn
  52. Status string `json:"status"` // 1-停用 2-启用
  53. common.ControlBy `swaggerignore:"true"`
  54. }
  55. func (s *CoolerBoxUpdateReq) Generate(model *model.CoolerBox) {
  56. if s.Id != 0 {
  57. model.Id = s.Id
  58. }
  59. model.Name = s.Name
  60. model.Sn = s.Sn
  61. model.Status = s.Status
  62. if s.ControlBy.UpdateBy != 0 {
  63. model.UpdateBy = s.UpdateBy
  64. }
  65. if s.ControlBy.CreateBy != 0 {
  66. model.CreateBy = s.CreateBy
  67. }
  68. }
  69. func (s *CoolerBoxUpdateReq) GetId() interface{} {
  70. return s.Id
  71. }
  72. type CoolerBoxGetReq struct {
  73. Id int `uri:"id"`
  74. }
  75. func (s *CoolerBoxGetReq) GetId() interface{} {
  76. return s.Id
  77. }
  78. type CoolerBoxDeleteReq struct {
  79. Id int `json:"id"`
  80. common.ControlBy `swaggerignore:"true"`
  81. }
  82. func (s *CoolerBoxDeleteReq) GetId() interface{} {
  83. return s.Id
  84. }
  85. type DeviceGetPageReq struct {
  86. dto.Pagination `search:"-"`
  87. Name string `form:"name" search:"-"`
  88. }
  89. type CoolerBoxBatchInsertReq struct {
  90. List []CoolerBoxInsertReq
  91. Status string `json:"status"` // 1-停用 2-启用
  92. common.ControlBy `swaggerignore:"true"`
  93. common.DeptBy `swaggerignore:"true"`
  94. }