cooler_box.go 5.5 KB

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