cooler_box.go 2.9 KB

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