后端接收前端传来的数据 id,进行批量删除,报错如下:
错误一
removeByIds(ids)
com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: java.lang.IllegalArgumentException: argument type mismatch
at com.baomidou.mybatisplus.core.toolkit.ExceptionUtils.mpe(ExceptionUtils.java:59)
at com.baomidou.mybatisplus.extension.toolkit.SqlHelper.executeBatch(SqlHelper.java:197)
at com.baomidou.mybatisplus.extension.toolkit.SqlHelper.executeBatch(SqlHelper.java:217)
at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.executeBatch(ServiceImpl.java:240)
at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.removeBatchByIds(ServiceImpl.java:303)
at com.baomidou.mybatisplus.extension.service.IService.removeBatchByIds(IService.java:205)
at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.removeByIds(ServiceImpl.java:273)
错误二
没有发现问题继续修改为单个删除 报错如下:
removeById(id)
java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.reflection.invoker.MethodInvoker.invoke(MethodInvoker.java:44)
at com.baomidou.mybatisplus.core.metadata.TableInfo.setPropertyValue(TableInfo.java:546)
at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.removeById(ServiceImpl.java:284)
at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.removeById(ServiceImpl.java:260)
问题出现在了id的类型,后端定义的为long,前端传值为string,分享一下引以为戒!!!