当我们后端接口的参数涉及到数字之类的基本数据类型最好不要用基本数据类型。
@ResponseBody
@ApiOperation("获取oa发起的陈列活动所有条目")
@RequestMapping(value = "/items",method = RequestMethod.GET)
public Object getDisPlayItems(@RequestParam Integer storeID,@RequestParam int p,int s){
String customer = sfaUfFxclService.getCustomerByStoreID(storeID);
// 展示所有oa发起的陈列活动,权限是客户下的。
List<Map<String, Object>> oaDisplayItems = sfaUfFxclService.getOADisplayItems(customer);
return toResult(oaDisplayItems);
}
当前端那个值忘了传值,除非也可以使用@RequestParam注解使参数比传,会默认传null过来,此时基本数据类型是接收不了的,就会报以下的错,建议我们定义为对应的包装类就可以接收null了。
"Optional int parameter 's' is present but cannot be translated into a null value due to being declared as a primitive type. Consider declaring it as object wrapper for the corresponding primitive type."