第一數據庫表中要有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;