第一句:#{}传过去的值会自动加上引号(“”),而${}则是直接将传值。
//例如:int id = 5;
select * form A where id=#{id}--其打印sql为select * from A where id=“5”
select * form A where id=${id}--其打印sql为select * from A where id=5
第二句:#{}在很大程度上防止sql注入。
Mybatis中的 #{}与${}的区别
最新推荐文章于 2024-05-22 01:54:13 发布