Search in sources :

Example 1 with TenantDatabaseInterceptor

use of cn.iocoder.yudao.framework.tenant.core.db.TenantDatabaseInterceptor in project ruoyi-vue-pro by YunaiV.

the class YudaoTenantAutoConfiguration method tenantLineInnerInterceptor.

// ========== DB ==========
@Bean
public TenantLineInnerInterceptor tenantLineInnerInterceptor(TenantProperties properties, MybatisPlusInterceptor interceptor) {
    TenantLineInnerInterceptor inner = new TenantLineInnerInterceptor(new TenantDatabaseInterceptor(properties));
    // 添加到 interceptor 中
    // 需要加在首个,主要是为了在分页插件前面。这个是 MyBatis Plus 的规定
    MyBatisUtils.addInterceptor(interceptor, inner, 0);
    return inner;
}
Also used : TenantLineInnerInterceptor(com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor) TenantDatabaseInterceptor(cn.iocoder.yudao.framework.tenant.core.db.TenantDatabaseInterceptor) FilterRegistrationBean(org.springframework.boot.web.servlet.FilterRegistrationBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

TenantDatabaseInterceptor (cn.iocoder.yudao.framework.tenant.core.db.TenantDatabaseInterceptor)1 TenantLineInnerInterceptor (com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor)1 FilterRegistrationBean (org.springframework.boot.web.servlet.FilterRegistrationBean)1 Bean (org.springframework.context.annotation.Bean)1