当对mybaits进行参数传递时
#{paramter} 表示一个'?'
${paramter}表示替换
例如:
updateid=123
infoids=123,123
select * from test where updateid=#{updateid} and infoids in (#{infoids})
mybaitis打印出来的sql是 select * from test where updateid=? and infoids in (?)
select * from test where updateid=#{updateid} and infoids in (${infoids})
mybaitis打印出来的sql是 select * from test where updateid=? and infoids in (123,123)
上面的2个sql的结果是不一样的
第一个sql可以理解为select * from test where updateid=123 and infoids in (‘123,123’) 123,123作为一个字符串去传递
第二个sql可以理解为select * from test where updateid=123 and infoids in (123,123)