|
@@ -138,6 +138,27 @@ public class EmotionAlertService {
|
|
|
.stream().map(this::toVO).collect(Collectors.toList());
|
|
.stream().map(this::toVO).collect(Collectors.toList());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 管理员获取所有告警列表(分页)
|
|
|
|
|
+ */
|
|
|
|
|
+ public Map<String, Object> getAdminAlerts(int page, int size, Boolean resolved) {
|
|
|
|
|
+ LambdaQueryWrapper<EmotionAlert> wrapper = new LambdaQueryWrapper<EmotionAlert>()
|
|
|
|
|
+ .eq(resolved != null, EmotionAlert::getResolved, resolved)
|
|
|
|
|
+ .orderByDesc(EmotionAlert::getCreatedAt);
|
|
|
|
|
+ List<EmotionAlert> all = emotionAlertMapper.selectList(wrapper);
|
|
|
|
|
+ int total = all.size();
|
|
|
|
|
+ int fromIndex = (page - 1) * size;
|
|
|
|
|
+ int toIndex = Math.min(fromIndex + size, total);
|
|
|
|
|
+ List<EmotionAlert> pageList = fromIndex >= total ? Collections.emptyList() : all.subList(fromIndex, toIndex);
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
|
|
+ result.put("list", pageList.stream().map(this::toVO).collect(Collectors.toList()));
|
|
|
|
|
+ result.put("total", total);
|
|
|
|
|
+ result.put("page", page);
|
|
|
|
|
+ result.put("size", size);
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public void resolveAlert(Long alertId) {
|
|
public void resolveAlert(Long alertId) {
|
|
|
EmotionAlert alert = emotionAlertMapper.selectById(alertId);
|
|
EmotionAlert alert = emotionAlertMapper.selectById(alertId);
|
|
|
if (alert != null) {
|
|
if (alert != null) {
|