test: 测试逻辑删除默认字段配置。

This commit is contained in:
Suomm 2023-08-10 09:33:44 +08:00
parent 105e5b3d97
commit bb87fc81ce
2 changed files with 10 additions and 1 deletions

View File

@ -49,7 +49,7 @@ public class Account extends BaseEntity implements Serializable, AgeAware {
@Column(typeHandler = Fastjson2TypeHandler.class) @Column(typeHandler = Fastjson2TypeHandler.class)
private Map<String, Object> options; private Map<String, Object> options;
@Column(isLogicDelete = true) // @Column(isLogicDelete = true)
private Boolean isDelete; private Boolean isDelete;
private List<Article> articles; private List<Article> articles;

View File

@ -15,6 +15,7 @@
*/ */
package com.mybatisflex.test; package com.mybatisflex.test;
import com.mybatisflex.core.FlexGlobalConfig;
import com.mybatisflex.core.MybatisFlexBootstrap; import com.mybatisflex.core.MybatisFlexBootstrap;
import com.mybatisflex.core.audit.AuditManager; import com.mybatisflex.core.audit.AuditManager;
import com.mybatisflex.core.audit.ConsoleMessageCollector; import com.mybatisflex.core.audit.ConsoleMessageCollector;
@ -52,6 +53,9 @@ public class AccountTester {
.addScript("data.sql") .addScript("data.sql")
.build(); .build();
FlexGlobalConfig.getDefaultConfig()
.setLogicDeleteColumn("is_delete");
MybatisFlexBootstrap bootstrap = MybatisFlexBootstrap.getInstance() MybatisFlexBootstrap bootstrap = MybatisFlexBootstrap.getInstance()
.setDataSource(dataSource) .setDataSource(dataSource)
.setLogImpl(StdOutImpl.class) .setLogImpl(StdOutImpl.class)
@ -71,6 +75,11 @@ public class AccountTester {
articleMapper = bootstrap.getMapper(ArticleMapper.class); articleMapper = bootstrap.getMapper(ArticleMapper.class);
} }
@Test
public void testLogicDelete() {
accountMapper.selectAll().forEach(System.out::println);
}
@Test @Test
public void testExecutor() { public void testExecutor() {
DbChain.create() DbChain.create()