Mybatis中mapper.xml文件判斷語句中的單雙引號問題


    //外面是雙引號,里面就是單引號  

   <if test="contactPhone != null and contactPhone!= '' ">  

   contact_phone = #{contactPhone}  

   </if>  

   //外面是單引號,里面就是雙引號  

   <if test='contactPhone != null and contactPhone != "" '

   contact_phone = #{contactPhone}  

   </if>  

   //判斷字符串等於某個值是需要使用外面單引號,里面雙引號  

   <if test='contactPhone == "abc" '>  

   contact_phone = #{contactPhone}  

    </if>   


免責聲明!

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



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