mybatis中我们通常会使用#{}或${}来获取pojo对象的变量值。
select * from books where bookName = #{bookName}
select * from books where bookName = ‘${bookName}’
这两个区别为 :
#{}会在 变量外侧 加上 单引号 如:
select * from books where name = 'Java'
${} 并不会 加单引号
如 select * from books where name = Java
所以使用${}的时候我们需要手动加’ ’