| | |
| | | |
| | | import java.util.Objects; |
| | | |
| | | import com.ltkj.db.DataSourceContextHolder; |
| | | import com.ltkj.framework.datasource.DynamicDataSourceContextHolder; |
| | | import org.aspectj.lang.ProceedingJoinPoint; |
| | | import org.aspectj.lang.annotation.Around; |
| | |
| | | DataSource dataSource = getDataSource(point); |
| | | |
| | | if (StringUtils.isNotNull(dataSource)) { |
| | | DataSourceContextHolder.setDataSourceKey(dataSource.value().name()); |
| | | DynamicDataSourceContextHolder.setDataSourceType(dataSource.value().name()); |
| | | } |
| | | |
| | | try { |
| | | return point.proceed(); |
| | | } finally { |
| | | // 销毁数据源 在执行方法之后 |
| | | DataSourceContextHolder.clear(); |
| | | DynamicDataSourceContextHolder.clearDataSourceType(); |
| | | } |
| | | } |
| | | |