管理员

This commit is contained in:
2025-09-06 11:46:13 +08:00
parent ff4db34e2a
commit 374a03b83d
2 changed files with 12 additions and 10 deletions

View File

@ -5,8 +5,6 @@ import com.fuyuanshen.app.domain.vo.AppDeviceShareVo;
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
import com.fuyuanshen.common.web.core.BaseController;
import com.fuyuanshen.equipment.domain.bo.DeviceAlarmBo;
import com.fuyuanshen.equipment.domain.vo.DeviceAlarmVo;
import com.fuyuanshen.web.service.DeviceShareService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;

View File

@ -53,6 +53,7 @@ public class DeviceLogServiceImpl implements IDeviceLogService {
return baseMapper.selectVoById(id);
}
/**
* 分页查询设备日志列表
*
@ -62,13 +63,12 @@ public class DeviceLogServiceImpl implements IDeviceLogService {
*/
@Override
public TableDataInfo<DeviceLogVo> queryPageList(DeviceLogBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<DeviceLog> lqw = buildQueryWrapper(bo);
Page<DeviceLogVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
/**
* 查询符合条件的设备日志列表
*
@ -83,13 +83,17 @@ public class DeviceLogServiceImpl implements IDeviceLogService {
private LambdaQueryWrapper<DeviceLog> buildQueryWrapper(DeviceLogBo bo) {
Long userId = LoginHelper.getUserId();
List<DeviceAssignments> assignments = deviceAssignmentsMapper.selectList(new QueryWrapper<DeviceAssignments>().eq("assignee_id", userId));
List<Long> deviceIds = assignments.stream().map(DeviceAssignments::getDeviceId).collect(Collectors.toList());
if (deviceIds.isEmpty()) {
deviceIds.add(-1L);
// 管理员
String username = LoginHelper.getUsername();
if (!username.equals("admin")) {
Long userId = LoginHelper.getUserId();
List<DeviceAssignments> assignments = deviceAssignmentsMapper.selectList(new QueryWrapper<DeviceAssignments>().eq("assignee_id", userId));
List<Long> deviceIds = assignments.stream().map(DeviceAssignments::getDeviceId).collect(Collectors.toList());
if (deviceIds.isEmpty()) {
deviceIds.add(-1L);
}
bo.setDeviceIds(deviceIds);
}
bo.setDeviceIds(deviceIds);
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<DeviceLog> lqw = Wrappers.lambdaQuery();