#(常用)
select id,name,age from student where id =#{id}
传入数值为1,会解析成字符串格式
select id,name,age from student where id ='1'
常用于参数传递
#{}: 解析为一个 JDBC 预编译语句(prepared statement)的参数标记符,一个 #{ } 被解析为一个参数占位符 。
$
select id,name,age from student where id =${id}
传入数值为1,会解析成sql语句
select id,name,age from student where id =1
可用于数据表字段
${}: 仅仅为一个纯碎的 string 替换,在动态 SQL 解析阶段将会进行变量替换。