| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | return R.ok(pageInfo); |
| | | } |
| | | |
| | | @GetMapping("/api/v1/notification/unreadCount") |
| | | @ApiOperation(value = "获取未读通知数量", tags = {"运维APP-消息通知"}) |
| | | public R<Long> getUnreadNotificationCount() { |
| | | // 从Token中获取当前登录用户ID |
| | | Long currentUserId = tokenService.getLoginOperationUser().getId(); |
| | | Long count = notificationService.lambdaQuery().eq(XpOperationsUserNotification::getOperationsUserId, currentUserId) |
| | | .eq(XpOperationsUserNotification::getReadStatus, 0).count(); |
| | | return R.ok(count); |
| | | } |
| | | |
| | | @PostMapping("/api/v1/notification/read") |
| | | @ApiOperation(value = "操作已读", tags = "运维APP-消息通知") |
| | | public R<?> readNotification(@RequestParam Long notificationId){ |
| | | notificationService.lambdaUpdate().set(XpOperationsUserNotification::getReadStatus, 1).eq(XpOperationsUserNotification::getId, notificationId).update(); |
| | | return R.ok(); |
| | | } |
| | | } |