当前使用版本(必填,否则不予处理)

    <dependency>
        <groupId>com.baomidou</groupId>
        <artifactId>mybatis-plus-boot-starter</artifactId>
        <version>3.5.1</version>
    </dependency>

该问题是如何引起的?(确定最新版也有问题再提!!!)

调用service.save()方法正常的,为啥在调用saveBatch()方法时会出现映射不到的问题 MyBatis-Plus 调用service.save()方法正常的,为啥在调用saveBatch()方法时会出现映射不到的问题

重现步骤(如果有就写完整)

提供了demo,可调用接口重现报错 demo.zip

报错信息

2022-01-29 10:15:50.044 ERROR 15408 --- [nio-8080-exec-4] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:

Error updating database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.baomidou.mybatisplus.core.mapper.BaseMapper.insert

Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.baomidou.mybatisplus.core.mapper.BaseMapper.insert] with root cause

java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.baomidou.mybatisplus.core.mapper.BaseMapper.insert at com.baomidou.mybatisplus.core.MybatisConfiguration$StrictMap.get(MybatisConfiguration.java:445) ~[mybatis-plus-core-3.5.1.jar:3.5.1] at com.baomidou.mybatisplus.core.MybatisConfiguration.getMappedStatement(MybatisConfiguration.java:344) ~[mybatis-plus-core-3.5.1.jar:3.5.1] at com.baomidou.mybatisplus.core.MybatisConfiguration.getMappedStatement(MybatisConfiguration.java:336) ~[mybatis-plus-core-3.5.1.jar:3.5.1] at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:193) ~[mybatis-3.5.9.jar:3.5.9] at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:181) ~[mybatis-3.5.9.jar:3.5.9] at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.lambda$saveBatch$0(ServiceImpl.java:136) ~[mybatis-plus-extension-3.5.1.jar:3.5.1] at com.baomidou.mybatisplus.extension.toolkit.SqlHelper.lambda$executeBatch$1(SqlHelper.java:222) ~[mybatis-plus-extension-3.5.1.jar:3.5.1] at com.baomidou.mybatisplus.extension.toolkit.SqlHelper.executeBatch(SqlHelper.java:182) ~[mybatis-plus-extension-3.5.1.jar:3.5.1] at com.baomidou.mybatisplus.extension.toolkit.SqlHelper.executeBatch(SqlHelper.java:217) ~[mybatis-plus-extension-3.5.1.jar:3.5.1] at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.executeBatch(ServiceImpl.java:240) ~[mybatis-plus-extension-3.5.1.jar:3.5.1] at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.saveBatch(ServiceImpl.java:136) ~[mybatis-plus-extension-3.5.1.jar:3.5.1] at com.baomidou.mybatisplus.extension.service.IService.saveBatch(IService.java:73) ~[mybatis-plus-extension-3.5.1.jar:3.5.1] at com.baomidou.mybatisplus.extension.service.IService$$FastClassBySpringCGLIB$$1.invoke() ~[mybatis-plus-extension-3.5.1.jar:3.5.1] at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.3.10.jar:5.3.10] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:779) ~[spring-aop-5.3.10.jar:5.3.10] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.3.10.jar:5.3.10] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750) ~[spring-aop-5.3.10.jar:5.3.10] at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123) ~[spring-tx-5.3.10.jar:5.3.10] at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388) ~[spring-tx-5.3.10.jar:5.3.10] at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119) ~[spring-tx-5.3.10.jar:5.3.10] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.10.jar:5.3.10] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750) ~[spring-aop-5.3.10.jar:5.3.10] at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:692) ~[spring-aop-5.3.10.jar:5.3.10] at com.example.demo.service.impl.AreaSpaceServiceImpl$$EnhancerBySpringCGLIB$$1.saveBatch() ~[classes/:na]

Comment From: Hccake

serviceImpl 的泛型传递错误,没有传递业务 Mapper 的类型,而是传递了 BaseMapper

Comment From: shijinting0321

serviceImpl 的泛型传递错误,没有传递业务 Mapper 的类型,而是传递了 BaseMapper

原来这里写错了。。。感谢!