阿超
>
mybatis-plus防止全表更新与删除
宁要好梨一个,不要烂梨一筐。积极肯干和忠心耿耿的人即使只有两三个,也比十个朝气沉沉的人强。——列宁
我们可以如下配置
1 2 3 4 5 6 7 8 9 10 11 12 13
| @Bean public MybatisPlusInterceptor mybatisPlusInterceptor() { MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor(DbType.MYSQL); BlockAttackInnerInterceptor blockAttackInnerInterceptor = new BlockAttackInnerInterceptor(); paginationInnerInterceptor.setOverflow(true); paginationInnerInterceptor.setMaxLimit(200L); interceptor.addInnerInterceptor(paginationInnerInterceptor); interceptor.addInnerInterceptor(blockAttackInnerInterceptor); return interceptor; }
|
主要的是这个BlockAttackInnerInterceptor
然后我们试着全表更新

然后是全表删除

发现都操作不了了