问题:
2021-04-29 15:06:16.795 ERROR 30460 --- [io-12000-exec-1] c.y.w.c.GlobalControllerExceptionHandler : Exception: Required request body is missing: public org.springframework.ui.ModelMap cn.yihuazt.cols.controller.CardTypeController.deleteCardType(long)
原因:
方法参数不能用@RequestBody
public ModelMap deleteCardType(@RequestBody long id){}
解决:
@DeleteMapping("/deleteCardType/{id}")
@ApiPermission
public ModelMap deleteCardType(@PathVariable long id){
ModelMap modelMap = new ModelMap();
try{
CardType cardType1 = cardTypeService.getById(id);
if (cardType1!=null){
cardTypeService.delete(id);
modelMap.addAttribute(FishConstant.SUCCESS,true);
}else{
modelMap.addAttribute(FishConstant.SUCCESS,false);
modelMap.addAttribute(FishConstant.ERROR_MSG,"删除失败");
}
}catch (Exception e){
logger.error("删除失败:"+e.getMessage());
modelMap.addAttribute(FishConstant.SUCCESS,false);
modelMap.addAttribute(FishConstant.ERROR_MSG,"删除失败");
}
return modelMap;
}
报错,Exception: Required request body is missing: public org.springframework.ui.ModelMap cn.yihuazt.co
最新推荐文章于 2024-08-20 20:23:25 发布