|
|
@@ -91,7 +91,11 @@ public class EventsServiceImpl extends ServiceImpl<EventsMapper, Events> impleme
|
|
|
Optional.ofNullable(params.getEventType())
|
|
|
.ifPresent(type -> queryWrapper.eq(Events::getEventType, type));
|
|
|
|
|
|
- // 3. 用户类型处理
|
|
|
+ // 3. 设备过滤
|
|
|
+ Optional.ofNullable(params.getClientId())
|
|
|
+ .ifPresent(clientId -> queryWrapper.eq(Events::getClientId, clientId));
|
|
|
+
|
|
|
+ // 4. 用户类型处理
|
|
|
if (AdminUserType.getBgManagerTypes().contains(userType)) {
|
|
|
// 后台管理员可选按tenantId过滤
|
|
|
if (params.getTenantId() != null) {
|
|
|
@@ -102,19 +106,19 @@ public class EventsServiceImpl extends ServiceImpl<EventsMapper, Events> impleme
|
|
|
queryWrapper.eq(Events::getTenantId, tenantId);
|
|
|
}
|
|
|
|
|
|
- // 4. 排序
|
|
|
+ // 5. 排序
|
|
|
queryWrapper.orderByDesc(Events::getCreateTime);
|
|
|
|
|
|
- // 5. 分页查询
|
|
|
+ // 6. 分页查询
|
|
|
page = this.baseMapper.selectPage(page, queryWrapper);
|
|
|
|
|
|
- // 6. 转换为 DTO
|
|
|
+ // 7. 转换为 DTO
|
|
|
List<EventsDTO> dtoList = CopyUtils.copyList(page.getRecords(), EventsDTO.class);
|
|
|
|
|
|
- // 7. 填充 devName
|
|
|
+ // 8. 填充 devName
|
|
|
fillDevNames(dtoList);
|
|
|
|
|
|
- // 8. 封装返回
|
|
|
+ // 9. 封装返回
|
|
|
return CopyUtils.copyPage(page, dtoList);
|
|
|
}
|
|
|
|