我在xml中写了如下sql
<if test="date!=null and date =='2'">
//要执行的sql
</if>
当传值date为2的时候并不执行这个if里的sql(date为String类型)
原因:test中字符串比较要用" ",而不是' '.sql改为:
<if test='date!=null and date =="2"'>
//要执行的sql
</if>
我在xml中写了如下sql
<if test="date!=null and date =='2'">
//要执行的sql
</if>
原因:test中字符串比较要用" ",而不是' '.sql改为:
<if test='date!=null and date =="2"'>
//要执行的sql
</if>