|
@@ -92,11 +92,11 @@ public class ServiceImpl<M extends BaseMapper<T>, T> implements IService<T> {
|
|
Object target = this.baseMapper;
|
|
Object target = this.baseMapper;
|
|
// 这个检查目前看着来说基本上可以不用判断Aop是不是存在了.
|
|
// 这个检查目前看着来说基本上可以不用判断Aop是不是存在了.
|
|
if (com.baomidou.mybatisplus.extension.toolkit.AopUtils.isLoadSpringAop()) {
|
|
if (com.baomidou.mybatisplus.extension.toolkit.AopUtils.isLoadSpringAop()) {
|
|
- if (AopUtils.isAopProxy(this.baseMapper)) {
|
|
|
|
- target = AopProxyUtils.getSingletonTarget(this.baseMapper);
|
|
|
|
|
|
+ while (AopUtils.isAopProxy(target)) {
|
|
|
|
+ target = AopProxyUtils.getSingletonTarget(target);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (target != null) {
|
|
|
|
|
|
+ if (target instanceof MybatisMapperProxy) {
|
|
MybatisMapperProxy mybatisMapperProxy = (MybatisMapperProxy) Proxy.getInvocationHandler(target);
|
|
MybatisMapperProxy mybatisMapperProxy = (MybatisMapperProxy) Proxy.getInvocationHandler(target);
|
|
SqlSessionTemplate sqlSessionTemplate = (SqlSessionTemplate) mybatisMapperProxy.getSqlSession();
|
|
SqlSessionTemplate sqlSessionTemplate = (SqlSessionTemplate) mybatisMapperProxy.getSqlSession();
|
|
this.sqlSessionFactory = sqlSessionTemplate.getSqlSessionFactory();
|
|
this.sqlSessionFactory = sqlSessionTemplate.getSqlSessionFactory();
|