Mybatis参数传递记录
2014-12-19 14:09
239 查看
当对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)
#{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)
相关文章推荐
- mybatis传递多种参数
- Mybatis传递多个参数
- MyBatis多参数传递之Map方式示例
- mybatis多参数传递
- MyBatis多参数传递之Map方式示例——MyBatis学习笔记之十三
- [VB.NET]点net写client程序传递参数给mssql存储过程insert,为什么要反复执行客户端代码才能成功insert,怎么才能使客户端插入记录操作变得稳定呢?
- mybatis 参数传递之默认命名
- mybatis传递多个参数的问题
- mybatis多参数传递小结
- AX 2009 父窗体参数记录传递
- MyBatis多参数传递之注解方式示例——MyBatis学习笔记之十一 推荐
- Mybatis传递多个参数
- mybatis 之参数传递
- mybatis.net - 4 ISqlMapper 传递参数
- Mybatis传递多个参数
- 记录一个异常:传递参数时带加号,结果取的值没有“+“,成了连接符!
- MyBatis多参数传递之Map方式示例——MyBatis学习笔记之十三 推荐
- mybatis传递参数
- “传递/转发”可变参数并通过printf记录程序日志,彻底告别vsnprintf
- Mybatis使用注解版传递两个参数时如果保证传参数正确