请求参数中,针对数组的参数注解(@RequestParam())
@RequestMapping("/list")
public ResponseResult<List<CartVO>> getByIds(
HttpSession session,@RequestParam("ids[]") Integer[] ids){
Integer uid = Integer.parseInt(session.getAttribute("uid").toString());
List<CartVO> data = cartService.getByIds(ids, uid);
return new ResponseResult<List<CartVO>>(SUCCESS, data);
}
......
......
}
给数组添加注解时,格式:@RequestParam("数组名[]"),如@RequestParam("ids[]");
[]中括号切记不能少!