当前使用版本(必填,否则不予处理)
3.4.0
该问题是如何引起的?(确定最新版也有问题再提!!!)
项目使用多数据源,配置了Mysql和Oracle,普通SQL可以正常使用。分页默认配置的是MYSQL,调用Oracle含有@DS分页service时报错,应该是分页插件默认配置的是Mysql,语法自动配置的limit。mybatisPlusInterceptor 换成 DbType.ORACLE。oracle分页时正常的,但是mysql也是同样的问题。
请问下 3.4.0 版本是否支持 Interceptor 配置两个数据库的数据库方言动态方式,还是我这边只能 Oracle 分页,使用自定义或者使用 Pagehelper分页插件实现?
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
return interceptor;
}
@Override
public IPage<Map<String, Object>> getMapPage(Map<String, Object> paramMap){
IPage<Map<String, Object>> iPageMap = PageUtils.getPage(new HashMap<String, Object>(), paramMap);
List<Map<String, Object>> mapList = acWmITransMapper.getMapPage(iPageMap, paramMap);
return iPageMap.setRecords(mapList);
}
重现步骤(如果有就写完整)
无
报错信息
bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: ORA-00933: SQL 命令未正确结束
Comment From: miemieYaho
不能,不指定dbtype即可
Comment From: lemoncy
好的,收到,非常感谢。
Comment From: magicsgxie
不指定dbtype报错,版本3.4.3 Error creating bean with name 'com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration$$EnhancerBySpringCGLIB$$8f296674]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'paginationInterceptor' defined in class path resource [cn/dreamtech/cat/common/data/mybatis/MybatisPlusConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor]: Factory method 'paginationInterceptor' threw exception; nested exception is java.lang.NullPointerException
Comment From: magicsgxie
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.H2)); 不指定DbTye报错