ice_locker.go 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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 IceLockerGetPageReq struct {
  9. dto.Pagination `search:"-"`
  10. Name string `form:"name" search:"type:contains;column:name;table:ice_locker"` // 冷冻柜名称
  11. Status string `form:"status" search:"type:exact;column:status;table:ice_locker"` // 状态
  12. Sn string `form:"sn" search:"type:contains;column:sn;table:ice_locker"` // sn
  13. ShowTemp bool `form:"showTemp" search:"-"` // 展示最新温度
  14. IceLockerOrder
  15. }
  16. type IceLockerOrder struct {
  17. CreatedAtOrder string `search:"type:order;column:created_at;table:ice_locker" form:"createdAtOrder" default:"desc"`
  18. IdOrder string `search:"type:order;column:id;table:ice_locker" form:"idOrder" default:"desc"`
  19. }
  20. type GetIceLockerReq struct {
  21. dto.Pagination `search:"-"`
  22. Status string `form:"status" search:"type:exact;column:status;table:ice_raft_record"`
  23. Locker int `form:"LockerId" search:"type:exact;column:ice_locker_id;table:ice_raft_record"`
  24. Code string `form:"code" search:"type:contains;column:code;table:ice_raft"` // 冰排名称
  25. }
  26. func (m *GetIceLockerReq) GetNeedSearch() interface{} {
  27. return *m
  28. }
  29. func (m *IceLockerGetPageReq) GetNeedSearch() interface{} {
  30. return *m
  31. }
  32. type IceLockerInsertReq struct {
  33. Id int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  34. Name string `json:"name" vd:"len($)>0;msg:'冷冻柜不能为空'"` // 冷冻柜名称
  35. Sn string `json:"sn"` // sn
  36. Status string `json:"status"` // 1-停用 2-正常
  37. common.ControlBy `swaggerignore:"true"`
  38. common.DeptBy `swaggerignore:"true"`
  39. }
  40. func (s *IceLockerInsertReq) Generate(model *model.IceLocker) {
  41. if s.Id != 0 {
  42. model.Id = s.Id
  43. }
  44. model.Name = s.Name
  45. model.Sn = strings.TrimSpace(s.Sn)
  46. model.Status = s.Status
  47. if s.ControlBy.UpdateBy != 0 {
  48. model.UpdateBy = s.UpdateBy
  49. }
  50. if s.ControlBy.CreateBy != 0 {
  51. model.CreateBy = s.CreateBy
  52. }
  53. if s.DeptBy.DeptId != 0 {
  54. model.DeptId = s.DeptId
  55. }
  56. }
  57. func (s *IceLockerInsertReq) GetId() interface{} {
  58. return s.Id
  59. }
  60. type IceLockerUpdateReq struct {
  61. Id int `json:"id" comment:"编码"` // 编码
  62. Name string `json:"name" vd:"len($)>0;msg:'冷冻柜名称不能为空'"` // 冷冻柜名称
  63. Sn string `json:"sn"` // sn
  64. Status string `json:"status"` // 1-停用 2-正常
  65. common.ControlBy `swaggerignore:"true"`
  66. }
  67. func (s *IceLockerUpdateReq) Generate(model *model.IceLocker) {
  68. if s.Id != 0 {
  69. model.Id = s.Id
  70. }
  71. model.Name = s.Name
  72. model.Sn = strings.TrimSpace(s.Sn)
  73. model.Status = s.Status
  74. if s.ControlBy.UpdateBy != 0 {
  75. model.UpdateBy = s.UpdateBy
  76. }
  77. if s.ControlBy.CreateBy != 0 {
  78. model.CreateBy = s.CreateBy
  79. }
  80. }
  81. func (s *IceLockerUpdateReq) GetId() interface{} {
  82. return s.Id
  83. }
  84. type IceLockerGetReq struct {
  85. Id int `uri:"id"`
  86. }
  87. func (s *IceLockerGetReq) GetId() interface{} {
  88. return s.Id
  89. }
  90. type IceLockerDeleteReq struct {
  91. Id int `json:"id"`
  92. common.ControlBy `swaggerignore:"true"`
  93. }
  94. func (s *IceLockerDeleteReq) GetId() interface{} {
  95. return s.Id
  96. }
  97. type IceLockerBatchInsertReq struct {
  98. List []IceLockerInsertReq
  99. Status string `json:"status"` // 1-停用 2-正常
  100. common.ControlBy `swaggerignore:"true"`
  101. common.DeptBy `swaggerignore:"true"`
  102. }