MyBatis在注解SQL中判断字符串类型不为空的正确使用方法

这里要判断类型为String的参数enterprise不为空,这里不能直接使用enterprise!=''和enterprise!=''
必须使用'来表示'
'就是单引号

"<when test='enterprise!=null and enterprise!=&apos;&apos;'>",
"and enterprise = #{enterprise}",
"</when>",

同理,类似的

原符号  替换符号 
 <       &lt; 
 <=    &lt;=
 >      &gt; 
 >=    &gt;=
 &      &amp;
 '        &apos;
 "       &quot;

posted @ 2021-08-17 15:26  夜月薇凉映银弩  阅读(1212)  评论(0编辑  收藏  举报