2021-07-07 错误小点

 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方法的参数上。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值