- ServiceImp报错
‘getBaseMapper()’ in ‘com.baomidou.mybatisplus.extension.service.impl.ServiceImpl’ clashes with ‘getBaseMapper()’ in ‘com.baomidou.mybatisplus.extension.service.IService’; attempting to use incompatible return type
在MyBatis-plus中,一般引用包为
com.baomidou.mybatisplus.core.mapper;
略看源码可知,IService 与其实现类 ServiceImpl 对Mapper的要求都是
<M extends BaseMapper<T>, T>
ServiceImpl<M extends BaseMapper<T>, T> implements IService<T>
问题解决:查看自己定义的xxServiceI中使用的mapper是否是 BaseMapper 的子类,且
Mapper 泛型引用应该与 IService 保持一致。