01-.ReflectionException 反射异常
@Insert("insert into mall_goods_brand
(name,first_letter)
values (#{mallGoodsBrand.name},#{mallGoodsBrand.firstLetter})")
上面一行 代码执行添加 报出如下错误 反射异常
org.apache.ibatis.reflection.ReflectionException:
There is no getter for property named
'mallGoodsBrand' in 'class com.fengmi.entity.MallGoodsBrand'
需要将代码改为下面一行即可
@Insert("insert into mall_goods_brand
(name,first_letter)
values (#{name},#{firstLetter})")
02-NumberFormatException: null 数字格式异常
@RequestMapping("delete")
@ApiOperation("删除商品品牌")
public ResultVO delete(@ApiParam("要删除商品的id") String GoodsId){
int i = goodsBrandService.deleteGoodsById(GoodsId);
if(i == 0){
return new ResultVO(false,"删除失败");
}
return new ResultVO(true,"success");
}
java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Integer.java:542) ~[na:1.8.0_91]
at java.lang.Integer.parseInt(Integer.java:615) ~[na:1.8.0_91]
@RequestBody
@RequestMapping("delete")
@ApiOperation("删除商品品牌")
public ResultVO delete(@ApiParam("要删除商品的id") @RequestBody String GoodsId){
int i = goodsBrandService.deleteGoodsById(GoodsId);
if(i == 0){
return new ResultVO(false,"删除失败");
}
return new ResultVO(true,"success");
}
@ResponseBody
作用:@ResponseBody注解用于将Controller的方法返回的对象,通过springmvc提供的HttpMessageConverter接口转换为指定格式的数据如:json,xml等,通过Response响应给客户端。
@RequestBody
作用:@RequestBody注解用于读取http请求的内容(字符串),通过springmvc提供的HttpMessageConverter接口将读到的内容(json数据)转换为java对象并绑定到Controller方法的参数上。