无关风月
2026-02-24 32063e565deaf03a0cc8abf1fafd146cc4e4d421
xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/controller/XpOperationsUserNotificationController.java
@@ -1,9 +1,17 @@
package com.xiaopeng.account.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import com.xiaopeng.account.model.query.XpOperationsUserNotificationPageQuery;
import com.xiaopeng.account.service.IXpOperationsUserNotificationService;
import com.xiaopeng.api.model.account.XpOperationsUserNotification;
import com.xiaopeng.common.core.domain.R;
import com.xiaopeng.common.core.web.page.PageInfo;
import com.xiaopeng.common.security.service.TokenService;
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;
/**
 * <p>
@@ -13,8 +21,38 @@
 * @author mitao
 * @since 2026-02-03
 */
@Controller
@RequestMapping("/xp-operations-user-notification")
@Slf4j
@RestController
public class XpOperationsUserNotificationController {
    @Autowired
    private IXpOperationsUserNotificationService notificationService;
    @Autowired
    private TokenService tokenService;
    /**
     * 根据当前登录用户获取通知分页列表(运维APP接口)
     */
    @PostMapping("/api/v1/notification/list")
    @ApiOperation(value = "获取通知分页列表", tags = {"运维APP-消息通知"})
    public R<PageInfo<XpOperationsUserNotification>> getNotificationList(
            @RequestBody XpOperationsUserNotificationPageQuery query) {
        log.info("查询通知分页列表, pageNum={}, pageSize={}",
            query.getPageNum(), query.getPageSize());
        // 从Token中获取当前登录用户ID
        Long currentUserId = tokenService.getLoginOperationUser().getId();
        query.setOperationsUserId(currentUserId);
        // 查询分页列表
        PageInfo<XpOperationsUserNotification> pageInfo =
            notificationService.selectNotificationPageByUserId(query);
        log.info("查询通知分页列表成功, userId={}, total={}",
            currentUserId, pageInfo.getTotal());
        return R.ok(pageInfo);
    }
}