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

3.5.2

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

项目进行依赖升级由3.4.2 -> 3.5.2 自定义了service + mapper 进行扩展; 例: interface ICustomService extends IService ; interface CustomBaseMapper extends BaseMapper; 通过 sevice 层调用无法匹配到对应的 Statement MyBatis-Plus 【3.5.2】currentMapperClass() 方法获取不到正确的 Mapper.class ,导致匹配 Statement 异常 两个版本 currentMapperClass 方法获取到的 mapper 不一致 3.4.2: protected Class<M> currentMapperClass() { return (Class<M>) ReflectionKit.getSuperClassGenericType(getClass(), 0); } 3.5.2: protected Class<M> currentMapperClass() { return (Class<M>) ReflectionKit.getSuperClassGenericType(this.getClass(), ServiceImpl.class, 0); }

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

通过 sevice 层调调用方法即可复现

报错信息

Error updating database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.yt.bi.common.mybatisplus.mapper.CustomBaseMapper.insert

Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.yt.bi.common.mybatisplus.mapper.CustomBaseMapper.insert

问题

有没有什么简单的方案能进行修改?目前我们通过重写 ServiceImpl 改动代码来实现 protected Class<M> currentMapperClass() { return (Class<M>) ReflectionKit.getSuperClassGenericType(this.getClass(), CustomServiceImpl.class, 0); }

Comment From: Zhuqi95

大佬快来看看,有没有方案

Comment From: huayanYu

没有,service一套都可以自己重写