mybatis本身的说明:

${} 类似于通过替换后生成sql 语句,Statement
#{} 可以绑定变量,可以防止sql 注入***PreparedStatement

String Substitution

By default, using the #{} syntax will cause MyBatis to generate PreparedStatement properties and set the values safely against the PreparedStatement parameters (e.g. ?). While this is safer,
faster and almost always preferred, sometimes you just want to directly inject a string unmodified into the SQL Statement.


For example, for ORDER BY, you might use something like this:
ORDER BY ${columnName}
Here MyBatis won't modify or escape the string.

NOTE It's not safe to accept input from a user and supply it to a statement unmodified in this way. This leads to potential SQL Injection attacks and therefore you should either disallow user input in these fields,
or always perform your own escapes and checks.