MybatisPlusConfiguration
/** * 租户处理器 */ @Bean @ConditionalOnMissingBean(TenantLineHandler.class) public TenantLineHandler tenantLineHandler() { return new TenantLineHandler() { @Override public Expression getTenantId() { return new StringValue(Func.toStr(AuthUtil.getTenantId(), BladeConstant.ADMIN_TENANT_ID)); } @Override public boolean ignoreTable(String tableName) { return true; } }; } /** * 租户拦截器 */ @Bean @ConditionalOnMissingBean(TenantLineInnerInterceptor.class) public TenantLineInnerInterceptor tenantLineInnerInterceptor(TenantLineHandler tenantHandler) { return new TenantLineInnerInterceptor(tenantHandler); }
TenantConfiguration
/** * 自定义多租户处理器 * * @param tenantProperties 多租户配置类 * @return TenantHandler */ @Bean @ConditionalOnMissingBean(TenantLineHandler.class) public TenantLineHandler bladeTenantHandler(BladeTenantProperties tenantProperties) { return new BladeTenantHandler(tenantProperties); } /** * 自定义租户拦截器 * * @param tenantHandler 多租户处理器 * @param tenantProperties 多租户配置类 * @return BladeTenantInterceptor */ @Bean @ConditionalOnMissingBean(TenantLineInnerInterceptor.class) public TenantLineInnerInterceptor tenantLineInnerInterceptor(TenantLineHandler tenantHandler, BladeTenantProperties tenantProperties) { BladeTenantInterceptor tenantInterceptor = new BladeTenantInterceptor(); tenantInterceptor.setTenantLineHandler(tenantHandler); tenantInterceptor.setTenantProperties(tenantProperties); return tenantInterceptor; }
这二个加载过程是是否有冲突 导致其中一个失效
TenantLineInnerInterceptor TenantLineHandler
扫一扫访问 Blade技术社区 移动端