Home > Back-end >  Create a view in the mybatis how to pass parameters.
Create a view in the mybatis how to pass parameters.

Time:11-12

If the type is an int type can be, if the id is a string type is an error,

For example: & lt; The insert id="crView" & gt;
The create or replace the view as test_view
Select * from tbl_teset where type=${type}


# {id} cannot normal replacement, an exception occurs,

CodePudding user response:

Test # {} can, on the contrary is ${} will string cannot identify problems
The create or replace the view test_view as select * from tbl_teset where name=# {type}

CodePudding user response:

Whether there special characters you type, # {} by value will do some transformation, ${} is directly put into the value of string processing

CodePudding user response:

Type=1 and type='1' is not the same, ${} XXX is directly taking XXX, # {} XXX will escape conversion, is string will help you with single quotation marks
  • Related