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 进行接收
推荐阅读
-
Optional long parameter 'id' is present but cannot be translated into a null value due to being decl
-
Optional int parameter 'xx' is present but cannot be translated into a null value
-
Optional int parameter 'xx' is present but cannot be translated into a null value
-
Optional int parameter ‘productId‘ is present but cannot be translated into a null value
-
Optional int parameter ‘isApply‘ is present but cannot be translated into a null value已解决