ListDeviceCommandLogs
This commit is contained in:
@@ -7,20 +7,28 @@ import (
|
||||
|
||||
// MonitorService 定义了监控相关的业务逻辑服务
|
||||
type MonitorService struct {
|
||||
sensorDataRepo repository.SensorDataRepository
|
||||
sensorDataRepo repository.SensorDataRepository
|
||||
deviceCommandLogRepo repository.DeviceCommandLogRepository
|
||||
// 在这里可以添加其他超表模型的仓库依赖
|
||||
}
|
||||
|
||||
// NewMonitorService 创建一个新的 MonitorService 实例
|
||||
func NewMonitorService(sensorDataRepo repository.SensorDataRepository) *MonitorService {
|
||||
func NewMonitorService(
|
||||
sensorDataRepo repository.SensorDataRepository,
|
||||
deviceCommandLogRepo repository.DeviceCommandLogRepository,
|
||||
) *MonitorService {
|
||||
return &MonitorService{
|
||||
sensorDataRepo: sensorDataRepo,
|
||||
sensorDataRepo: sensorDataRepo,
|
||||
deviceCommandLogRepo: deviceCommandLogRepo,
|
||||
}
|
||||
}
|
||||
|
||||
// ListSensorData 负责处理查询传感器数据列表的业务逻辑
|
||||
func (s *MonitorService) ListSensorData(opts repository.SensorDataListOptions, page, pageSize int) ([]models.SensorData, int64, error) {
|
||||
// 目前业务逻辑只是简单地将请求透传给仓库层。
|
||||
// 未来任何与查询传感器数据相关的业务规则(如权限校验、数据聚合等)都应在此处实现。
|
||||
return s.sensorDataRepo.List(opts, page, pageSize)
|
||||
}
|
||||
|
||||
// ListDeviceCommandLogs 负责处理查询设备命令日志列表的业务逻辑
|
||||
func (s *MonitorService) ListDeviceCommandLogs(opts repository.DeviceCommandLogListOptions, page, pageSize int) ([]models.DeviceCommandLog, int64, error) {
|
||||
return s.deviceCommandLogRepo.List(opts, page, pageSize)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user