欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Optional int parameter ‘productId‘ is present but cannot be translated into a null value

程序员文章站 2022-04-21 15:43:20
...
    @RequestMapping("/selectProductEdition")
    public TmyResultSet selectProductEdition(int productId){
        TmyResultSet tmyResultSet = editionService.selectProductEdition(productId);
        return tmyResultSet;
    }
```代码如上:
当前端不传值时,会默认     productId==null     
 但是int类型  不传值时默认为零 
 解决方法用  integer  进行接收