mybatis动态拼接参数的几种方式
第一种:
1 | <if test="proName !=null and proName !='null'"> |
第二种:
1 | <if test="proName !=null and proName !='null'"> |
第三种:
1 | <if test="proName !=null and proName !='null'"> |
第四种:
1 | <if test="proName !=null and proName !='null'"> |
如果写成 “%#{xxx}%” ,#{xxx}就成了字符串的一部分,就变成 %xxx的内容% 这是个字符串
要写成: “%”#{xxx}”%”,#{xxx} 不能被字符串括起来,再前后加上%
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 ls!
评论