Home > Back-end > Mybatis dynamic table name of problem, took a long time didn't solve it
Mybatis dynamic table name of problem, took a long time didn't solve it
Time:09-20
Mybatis in realizing dynamic table name to participate, you can use ${tableName} to implement, but it will happen the problem of SQL injection, and if we use # {tableName} will more quotes, SQL error caused for dynamic table name and bosses have a solution of a problem?
CodePudding user response:
Directly write a Mybatis plug-in tableName replaced the line not line, the SQL statements.
CodePudding user response:
${tableName} can be done with this, oneself to filter, the parameters are not allowed to have a special symbol as a tableName the value of the parameter is ok,