在实际使用过程中,可能会出现如下报错:
org.apache.ibatis.binding.BindingException:
Invalid bound statement (not found): xxx.xxx.xxx.insertBatchSomeColumn
自定义的SqlInjector:
public class MySqlInjector extends DefaultSqlInjector {
@Override
public List<AbstractMethod> getMethodList(Class<?> mapperClass) {
List<AbstractMethod> methodList = super.getMethodList(mapperClass);
// 例: 不要指定了 update 填充的字段
methodList.add(new InsertBatchSomeColumn(i -> i.getFieldFill() != FieldFill.UPDATE));
return methodList;
}
}
需要手动设置SqlInjector
/**
* MP配置
*/
@Configuration
public class MybatisplusConfig {
@Bean
public PaginationInterceptor paginationInterceptor() {
PaginationInterceptor paginationInterceptor=new PaginationInterceptor();
paginationInterceptor.setLimit(-1);
return paginationInterceptor;
}
@Bean
public MySqlInjector sqlInjector() {
return new MySqlInjector();
}