SpringBoot整合MP过程中报错
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.wjx.demo3_admin.Mapper.EmpMapper.deleteById
at org.apache.ibatis.binding.MapperMethod$SqlCommand.(MapperMethod.java:235) ~[mybatis-3.5.9.jar:3.5.9]
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.(MybatisMapperMethod.java:50) ~[mybatis-plus-core-3.5.1.jar:3.5.1]
at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.lambda$cachedInvoker$0(MybatisMapperProxy.java:111) ~[mybatis-plus-core-3.5.1.jar:3.5.1]
at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660) ~[na:1.8.0_301]
at com.baomidou.mybatisplus.core.toolkit.CollectionUtils.computeIfAbsent(CollectionUtils.java:115) ~[mybatis-plus-core-3.5.1.jar:3.5.1]
...
原因:MP的deleteById根据主键进行删除,如果没有在实体类中用注解@TableId标注主键字段,那么该字段的名称必须为 id
解决1:实体类主键添加@TableId注解
@TableId
private int eid;
解决2:实体类主键字段改名为 id
private int id;
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)