管理员

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.PageQuery;
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo; import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
import com.fuyuanshen.common.web.core.BaseController; 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 com.fuyuanshen.web.service.DeviceShareService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;

View File

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