How to use the parameters ${} and #{} in the SQL statement table name in Mybatis


Use the ${} symbol to take effect #{} is invalid

insert into prefix_${
    
    table_name} (a, b, c) values (#{
    
    a}, #{
    
    b}, #{
    
    c})

${} means using literal value directly
#{} means this is a parameter.
If table_name is "ABC"
then ${table_name} is ABC
#{table_name} is "ABC"

Guess you like

Origin blog.csdn.net/My_Way666/article/details/112280015