select *where 1=1
http://blog.sina.com.cn/s/blog_757b0e130101f95d.html
不确定后面是否还有条件的时候,加上这个恒等条件where 1=1,这主要是保证直接在后面添加其他的条件时不会出错。
这么写select * from table where 1=1 and id=#{id,jdbcType=INTEGER}and name=#{name,jdbcType=VARCHAR} ....1=1是为了防止后面的条件都为空时不出错