Mybatis plus使用IService会报Invalid bound statement (not found)

我才用这样的方式来使用配置程序

@MapperScan("com.example.spider.domain.mapper")
public class SpiderApplication {
public interface CUserMapper extends IService<CUser> {
}

当我调用cuserMapper.save()方法时,就会抛出Invalid bound statement (not found)异常。
但是如果我的CUserMapper改成继承自BaseMapper<T>就不回有问题,求解?

阅读 10.5k
2 个回答

因为 save 方法就是写在在 BaseMapper接口 中的,你点进去就能看到,然后在一个 Provider 类中被拼接成一个完整的 sql。

而你的IService类应该没有实现 BaseMapper 接口吧,所以找不到 save 方法。

继承了BaseMapper,mybatis plus 帮你实现了sql。没有继承就没有实现sql啊

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题