mybatis-plus配置逻辑删除
第一数据库表中要有is_deleted字段
例如:
接下来配置类
@EnableTransactionManagement @Configuration @MapperScan("com.atguigu.eduservice.mapper") public class Config { /** * 逻辑删除插件 */ @Bean public ISqlInjector sqlInjector() { return new LogicSqlInjector(); } }
最重要的一定要在实体类的字段上加注解
@ApiModelProperty(value = "逻辑删除 1(true)已删除, 0(false)未删除")
//重要 @TableLogic private Integer isDeleted;