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;

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM