diff --git a/mybatis-flex-test/mybatis-flex-native-test/src/main/java/com/mybatisflex/test/TenantAccount.java b/mybatis-flex-test/mybatis-flex-native-test/src/main/java/com/mybatisflex/test/TenantAccount.java index 58b0bbdf..3e94a6d4 100644 --- a/mybatis-flex-test/mybatis-flex-native-test/src/main/java/com/mybatisflex/test/TenantAccount.java +++ b/mybatis-flex-test/mybatis-flex-native-test/src/main/java/com/mybatisflex/test/TenantAccount.java @@ -16,6 +16,7 @@ package com.mybatisflex.test; +import com.mybatisflex.annotation.Column; import com.mybatisflex.annotation.ColumnMask; import com.mybatisflex.annotation.Id; import com.mybatisflex.annotation.KeyType; @@ -37,7 +38,7 @@ public class TenantAccount { private Date birthday; -// @Column(tenantId = true) + @Column(tenantId = true) private Long tenantId; public Long getId() { diff --git a/mybatis-flex-test/mybatis-flex-native-test/src/main/java/com/mybatisflex/test/TenantManagerTester.java b/mybatis-flex-test/mybatis-flex-native-test/src/main/java/com/mybatisflex/test/TenantManagerTester.java index 14c51a8d..6fa6038c 100644 --- a/mybatis-flex-test/mybatis-flex-native-test/src/main/java/com/mybatisflex/test/TenantManagerTester.java +++ b/mybatis-flex-test/mybatis-flex-native-test/src/main/java/com/mybatisflex/test/TenantManagerTester.java @@ -17,16 +17,13 @@ package com.mybatisflex.test; import com.mybatisflex.core.MybatisFlexBootstrap; -import com.mybatisflex.core.audit.AuditManager; -import com.mybatisflex.core.audit.ConsoleMessageCollector; -import com.mybatisflex.core.tenant.TenantFactory; import com.mybatisflex.core.tenant.TenantManager; import com.mybatisflex.mapper.TenantAccountMapper; +import org.apache.ibatis.logging.stdout.StdOutImpl; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; import javax.sql.DataSource; -import java.util.List; public class TenantManagerTester { @@ -40,18 +37,16 @@ public class TenantManagerTester { MybatisFlexBootstrap.getInstance() .setDataSource(dataSource) .addMapper(TenantAccountMapper.class) + .setLogImpl(StdOutImpl.class) .start(); - //输出日志 - AuditManager.setAuditEnable(true); - AuditManager.setMessageCollector(new ConsoleMessageCollector()); - - //配置 tenantFactory + // 配置 tenantFactory TenantManager.setTenantFactory(() -> new Object[]{1}); - TenantAccountMapper mapper = MybatisFlexBootstrap.getInstance().getMapper(TenantAccountMapper.class); - List tenantAccounts = TenantManager.withoutTenantCondition(mapper::selectAll); - System.out.println(tenantAccounts); + MybatisFlexBootstrap.getInstance() + .getMapper(TenantAccountMapper.class) + .selectAll() + .forEach(System.out::println); } }