The difference between MyBatis # {} and $ {}

# {} Is the parameter pre-compilation, the position of the parameter is used? Instead, the parameters are set later.
Advantages: safe, will not be injected by sql

$ {} Is not a parameter precompilation, but is directly spelled with the sql statement. Although it is not safe, there are still usage scenarios, such as dynamically changing the table name, the table name does not support precompilation, only $

Published 21 original articles · liked 0 · visits 721

Guess you like

Origin blog.csdn.net/D1124615130/article/details/104547543