1, when the MyBatis parameter is list, check whether the list is empty
2. The difference between MyBatis ${} and #{}
In short, #{} is a placeholder? can prevent SQL injection, such as the printed statement select * FROM table where id=?
However, ${} is a statement that cannot prevent SQL injection from being printed out of a select * from table where id=2 is a real parameter.
The simplest difference is that the ${} parse passes through the parameter values without single quotes, #{} parse passes over the parameters with single quotes.
Finally summarize the case that you must use the $ reference parameter, which is the int of the parameter, you must use the $ reference.
3. Mybatis SQL in
Parameter Pass List
1 <SelectID= "Findbyidsmap"Resultmap= "Baseresultmap"> 2 Select3 <includerefID= "Base_column_list" /> 4 From Jria where ID in5 <foreachItem= "Item"Index= "Index"Collection= "List"Open="("Separator=","Close=")"> 6 #{item}7 </foreach> 8 </Select>
When the MyBatis parameter is list, verifies that the list is empty, MyBatis ${} differs from #{}, MyBatis SQL in