abel533 / Mybatis-Spring

这是一个集成了Mybatis分页插件和通用Mapper的示例项目
941 stars 610 forks source link

deleteByExample,updateByExample的坑 #42

Open ting4937 opened 5 years ago

ting4937 commented 5 years ago

deleteByExample,updateByExample的时候如果Criteria指定的条件为null会忽略该条件,这会导致数据大批量删除或更新,造成很大的安全隐患,相信很多人都不会注意这个问题,建议作者在传入的条件数据为null时不要忽略该条件

dc630638147 commented 5 years ago

你不传默认就是null。。。你传了还是null。。。可以改成空串啊,再说了数据库也不建议用null

dc630638147

邮箱:dc630638147@163.com |

Signature is customized by Netease Mail Master

在2019年07月09日 09:50,Cloud 写道:

deleteByExample,updateByExample的时候如果Criteria指定的条件为null会忽略该条件,这会导致数据大批量删除或更新,造成很大的安全隐患,相信很多人都不会注意这个问题,建议作者在传入的条件数据为null时不要忽略该条件

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

abel533 commented 5 years ago

有两个 safeDelete 和 safeUpdate 参数,可以避免全表操作。