Mybatis中传递参数时,会加上引号

当参数需要加上引号的时候,用#{}。  

例:select * from user_user where name= #{name}   

SQL:select * from user_user where name= "name"

当参数不需要加上引号的时候,用${}

例:select * from user_user order by ${id} 

 SQL:select * from user_user order by id

猜你喜欢

转载自www.cnblogs.com/WINTER-KING/p/12275131.html