forked from dyf/fys-Multi-tenant
开始时间
This commit is contained in:
@ -53,16 +53,21 @@ public interface WEBDeviceService extends IService<Device> {
|
||||
* 设备操作记录
|
||||
*
|
||||
* @param deviceId
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return
|
||||
*/
|
||||
List<DeviceLog> getOperationRecord(Long deviceId);
|
||||
List<DeviceLog> getOperationRecord(Long deviceId, String startTime, String endTime);
|
||||
|
||||
|
||||
/**
|
||||
* 设备告警记录
|
||||
*
|
||||
* @param deviceId
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return
|
||||
*/
|
||||
List<DeviceAlarmVo> getAlarmRecord(Long deviceId);
|
||||
List<DeviceAlarmVo> getAlarmRecord(Long deviceId, String startTime, String endTime);
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.fuyuanshen.web.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@ -129,10 +130,19 @@ public class WEBDeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impl
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<DeviceLog> getOperationRecord(Long deviceId) {
|
||||
public List<DeviceLog> getOperationRecord(Long deviceId, String startTime, String endTime) {
|
||||
QueryWrapper<DeviceLog> queryWrapper = new QueryWrapper<DeviceLog>().eq("device_id", deviceId);
|
||||
|
||||
if (StrUtil.isNotEmpty(startTime)) {
|
||||
queryWrapper.ge("create_time", startTime);
|
||||
}
|
||||
|
||||
if (StrUtil.isNotEmpty(endTime)) {
|
||||
queryWrapper.le("create_time", endTime);
|
||||
}
|
||||
|
||||
List<DeviceLog> logList = deviceLogMapper.selectList(
|
||||
new QueryWrapper<DeviceLog>().eq("device_id", deviceId)
|
||||
.orderByDesc("create_time"));
|
||||
queryWrapper.orderByDesc("create_time"));
|
||||
return logList;
|
||||
}
|
||||
|
||||
@ -144,10 +154,19 @@ public class WEBDeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impl
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<DeviceAlarmVo> getAlarmRecord(Long deviceId) {
|
||||
public List<DeviceAlarmVo> getAlarmRecord(Long deviceId, String startTime, String endTime) {
|
||||
QueryWrapper<DeviceAlarm> queryWrapper = new QueryWrapper<DeviceAlarm>().eq("device_id", deviceId);
|
||||
|
||||
if (StrUtil.isNotEmpty(startTime)) {
|
||||
queryWrapper.ge("create_time", startTime);
|
||||
}
|
||||
|
||||
if (StrUtil.isNotEmpty(endTime)) {
|
||||
queryWrapper.le("create_time", endTime);
|
||||
}
|
||||
|
||||
List<DeviceAlarm> alarmList = deviceAlarmMapper.selectList(
|
||||
new QueryWrapper<DeviceAlarm>().eq("device_id", deviceId)
|
||||
.orderByDesc("create_time"));
|
||||
queryWrapper.orderByDesc("create_time"));
|
||||
List<DeviceAlarmVo> deviceAlarmVoList = BeanUtil.copyToList(alarmList, DeviceAlarmVo.class);
|
||||
return deviceAlarmVoList;
|
||||
}
|
||||
|
Reference in New Issue
Block a user