Skip to content

修改@RequestParam values指,不会触发更新 #210

@LiHanGod

Description

@LiHanGod

描述bug内容
修改@RequestParam values指,不会触发更新

package com.lihan.controller;

import com.lihan.entity.po.NewsCommentary;
import com.lihan.entity.res.Res;
import com.lihan.service.INewsCommentaryService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 新闻评论 前端控制器
 * </p>
 *
 * @author LiHan
 * @since 2025-10-15
 */
@RestController
@RequestMapping("/newsCommentary")
public class NewsCommentaryController {

    /**
     * 新闻评论
     */
    private final INewsCommentaryService newsCommentaryService;

    public NewsCommentaryController(INewsCommentaryService newsCommentaryService) {
        this.newsCommentaryService = newsCommentaryService;
    }

    /**
     * 添加评论ID
     * @param newsCommentary 评论信息
     */
    @RequestMapping("/addNewsComment")
    public Res<?> addNewsComment(@RequestBody NewsCommentary newsCommentary) {
        newsCommentaryService.save(newsCommentary);
        return Res.ResSucessMsgNoData("保存成功");
    }

    /**
     * 根据新闻ID查询评论信息
     * @param newsId 新闻ID
     * @return 评论信息列表
     */
    @RequestMapping("/listNewsCommentary")
    public Res<?> listNewsCommentary(@RequestParam("newsIds") String newsId) {
        return Res.ResSucessMsg("请求成功", newsCommentaryService.listNewsCommentaryByNewsId(newsId));
    }

    /**
     * 根据新闻ID查询评论数量
     * @param newsId 新闻ID
     * @return 评论数量
     */
    @RequestMapping("/countNewsCommentary")
    public Res<?> countNewsCommentary(@RequestParam("newsId") String newsId) {
        return Res.ResSucessMsg("请求成功", newsCommentaryService.countNewsCommentaryByNewsId(newsId));
    }
}

@RequestParam("newsId") 修改为 @RequestParam("newsIds") 不会触发更新

版本信息

  • DebugTools版本: 4.5.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    Status

    main

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions