mybatis 配置逻辑删除

第一步:在application.xml 里面配置

mybatis-plus:
mapper-locations: classpath:/mapper/**/*.xml
global-config:
db-config:
id-type: auto
logic-delete-value: 1
logic-not-delete-value: 0

第二步:在实体类中设置

/**
* 是否显示[0-不显示,1显示]
*/
@TableLogic(value = "1",delval = "0")
private Integer showStatus;

 

在mybaits高版本可以不用配置

第三步:在java文件夹中创建config来配置

@MapperScan("com.xbin.mapper")
@Configuration
@EnableTransactionManagement
public class myBatisPlusConfig {

@Bean
public ISqlInjector iSqlInjector(){
return new LogicSqlInjector();
}
}

 

posted @ 2020-11-17 16:04  呆马and鸽子  阅读(397)  评论(0编辑  收藏  举报