ibatis 中 $与#的区别

ibatis 中 $与#的区别

使用#:

select * from table where id = #id#

如果字段为整型:#id#表示成id

select * from table where id = #id#

如果字段为字符串:#id#表示的就是'id'类型

select * from table where id = #id#

 

使用$:

select * from table where id = $id$

如果字段id为整型,Sql语句就不会出错

select * from table where id = $id$

如果字段为字符串:两侧加上 ‘’

那么Sql语句应该写成 select * from table where id = '$id$'

 

知识点:

  1.   ibatis传入数组或List类型参数小结

  2. MyBatis传入参数为集合 list 数组 map写法
posted @ 2017-11-02 08:34  hcha0  阅读(360)  评论(0编辑  收藏  举报