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;


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM