cooler_box.go 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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. ColdSpots string `json:"cold_spots"` //遇冷地点
  28. ColdTemperatures string `json:"cold_temperatures"` //遇冷温度
  29. common.ControlBy `swaggerignore:"true"`
  30. common.DeptBy `swaggerignore:"true"`
  31. }
  32. func (s *CoolerBoxInsertReq) Generate(model *model.CoolerBox) {
  33. if s.Id != 0 {
  34. model.Id = s.Id
  35. }
  36. model.Name = s.Name
  37. model.Sn = strings.TrimSpace(s.Sn)
  38. model.Status = s.Status
  39. model.ColdSpots = s.ColdSpots
  40. model.ColdTemperatures = s.ColdTemperatures
  41. if s.ControlBy.UpdateBy != 0 {
  42. model.UpdateBy = s.UpdateBy
  43. }
  44. if s.ControlBy.CreateBy != 0 {
  45. model.CreateBy = s.CreateBy
  46. }
  47. if s.DeptBy.DeptId != 0 {
  48. model.DeptId = s.DeptId
  49. }
  50. }
  51. func (s *CoolerBoxInsertReq) GetId() interface{} {
  52. return s.Id
  53. }
  54. type CoolerBoxUpdateReq struct {
  55. Id int `json:"id" comment:"编码"` // 编码
  56. Name string `json:"name"` // 保温箱名称
  57. Sn string `json:"sn"` // sn
  58. Status string `json:"status"` // 1-停用 2-正常
  59. ColdSpots string `json:"cold_spots"` //遇冷地点
  60. ColdTemperatures string `json:"cold_temperatures"`
  61. common.ControlBy `swaggerignore:"true"`
  62. }
  63. func (s *CoolerBoxUpdateReq) Generate(model *model.CoolerBox) {
  64. if s.Id != 0 {
  65. model.Id = s.Id
  66. }
  67. model.Name = s.Name
  68. model.Sn = strings.TrimSpace(s.Sn)
  69. model.Status = s.Status
  70. model.ColdSpots = s.ColdSpots
  71. model.ColdTemperatures = s.ColdTemperatures
  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. }
  79. func (s *CoolerBoxUpdateReq) GetId() interface{} {
  80. return s.Id
  81. }
  82. type CoolerBoxGetReq struct {
  83. Id int `uri:"id"`
  84. }
  85. func (s *CoolerBoxGetReq) GetId() interface{} {
  86. return s.Id
  87. }
  88. type CoolerBoxDeleteReq struct {
  89. Id int `json:"id"`
  90. common.ControlBy `swaggerignore:"true"`
  91. }
  92. func (s *CoolerBoxDeleteReq) GetId() interface{} {
  93. return s.Id
  94. }
  95. type CoolerBoxBatchInsertReq struct {
  96. List []CoolerBoxInsertReq
  97. Status string `json:"status"` // 1-停用 2-正常
  98. common.ControlBy `swaggerignore:"true"`
  99. common.DeptBy `swaggerignore:"true"`
  100. }
  101. type CoolerBoxBatchReqSN struct {
  102. Id int `json:"id"`
  103. Page int `json:"page"`
  104. PageZ int `json:"page_z"`
  105. }
  106. type CoolerBoxBatchReq struct {
  107. SnId string `json:"sn"`
  108. T_id string `json:"t_id"`
  109. StartTime string `json:"start_time"`
  110. EndTime string `json:"end_time"`
  111. Page int `json:"page"`
  112. PageZ int `json:"page_z"`
  113. }
  114. type CoolerBoxReq struct {
  115. T_sn string `json:"T_sn"`
  116. Id string `json:"T_id"`
  117. }
  118. type HistoricalData struct {
  119. Sn string `json:"sn"` //设备Sn
  120. StartTime string `json:"start_time"` //开始时间
  121. EndTime string `json:"end_time"` //结束时间
  122. CompanyName string `json:"company_name"` //公司名称
  123. Driver string `json:"driver"` //配送员,司机
  124. T_id string `json:"t_id"`
  125. }
  126. type GetCoolerBoxIce struct {
  127. dto.Pagination `search:"-"`
  128. CoolerBoxId int `form:"cooler_box_id"`
  129. }
  130. type GetCoolerBoxIceAll struct {
  131. dto.Pagination `search:"-"`
  132. StartTime string `form:"startTime" search:"-"` // 开始时间
  133. EndTime string `form:"endTime" search:"-"` // 结束时间
  134. CoolerBoxId string `form:"coolerBoxId" search:"type:contains;column:cooler_box_id;table:cooler_box_record"` // 保温箱id
  135. }
  136. func (m *GetCoolerBoxIceAll) GetNeedSearch() interface{} {
  137. return *m
  138. }