不能和逻辑删除一起配置,不然报错。
逻辑删除的配置:
@Bean
public ISqlInjector sqlInjector(){
return new LogicSqlInjector();
}mySqlInjector的配置:
@Component
public class MySqlinjector extends DefaultSqlInjector {
@Override
public List<AbstractMethod> getMethodList(Class<?> mapperClass) {
//调用super的方法,否则mybatisplus的默认方法都不能用
List<AbstractMethod> methodList = super.getMethodList(mapperClass);
//加入自定义的方法
methodList.add(new RemoveById());
return methodList;
}
}报错:
No qualifying bean of type 'com.baomidou.mybatisplus.core.injector.ISqlInjector' available: expected single matching bean but found 2: mySqlinjector,sqlInjector