ice_locker.go 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. func (m *IceLockerGetPageReq) GetNeedSearch() interface{} {
  21. return *m
  22. }
  23. type IceLockerInsertReq struct {
  24. Id int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  25. Name string `json:"name" vd:"len($)>0;msg:'冷冻柜不能为空'"` // 冷冻柜名称
  26. Sn string `json:"sn"` // sn
  27. Status string `json:"status"` // 1-停用 2-正常
  28. common.ControlBy `swaggerignore:"true"`
  29. common.DeptBy `swaggerignore:"true"`
  30. }
  31. func (s *IceLockerInsertReq) Generate(model *model.IceLocker) {
  32. if s.Id != 0 {
  33. model.Id = s.Id
  34. }
  35. model.Name = s.Name
  36. model.Sn = strings.TrimSpace(s.Sn)
  37. model.Status = s.Status
  38. if s.ControlBy.UpdateBy != 0 {
  39. model.UpdateBy = s.UpdateBy
  40. }
  41. if s.ControlBy.CreateBy != 0 {
  42. model.CreateBy = s.CreateBy
  43. }
  44. if s.DeptBy.DeptId != 0 {
  45. model.DeptId = s.DeptId
  46. }
  47. }
  48. func (s *IceLockerInsertReq) GetId() interface{} {
  49. return s.Id
  50. }
  51. type IceLockerUpdateReq struct {
  52. Id int `json:"id" comment:"编码"` // 编码
  53. Name string `json:"name" vd:"len($)>0;msg:'冷冻柜名称不能为空'"` // 冷冻柜名称
  54. Sn string `json:"sn"` // sn
  55. Status string `json:"status"` // 1-停用 2-正常
  56. common.ControlBy `swaggerignore:"true"`
  57. }
  58. func (s *IceLockerUpdateReq) Generate(model *model.IceLocker) {
  59. if s.Id != 0 {
  60. model.Id = s.Id
  61. }
  62. model.Name = s.Name
  63. model.Sn = strings.TrimSpace(s.Sn)
  64. model.Status = s.Status
  65. if s.ControlBy.UpdateBy != 0 {
  66. model.UpdateBy = s.UpdateBy
  67. }
  68. if s.ControlBy.CreateBy != 0 {
  69. model.CreateBy = s.CreateBy
  70. }
  71. }
  72. func (s *IceLockerUpdateReq) GetId() interface{} {
  73. return s.Id
  74. }
  75. type IceLockerGetReq struct {
  76. Id int `uri:"id"`
  77. }
  78. func (s *IceLockerGetReq) GetId() interface{} {
  79. return s.Id
  80. }
  81. type IceLockerDeleteReq struct {
  82. Id int `json:"id"`
  83. common.ControlBy `swaggerignore:"true"`
  84. }
  85. func (s *IceLockerDeleteReq) GetId() interface{} {
  86. return s.Id
  87. }
  88. type IceLockerBatchInsertReq struct {
  89. List []IceLockerInsertReq
  90. Status string `json:"status"` // 1-停用 2-正常
  91. common.ControlBy `swaggerignore:"true"`
  92. common.DeptBy `swaggerignore:"true"`
  93. }