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>   

posted @ 2018-01-08 16:26  像艳遇一样忧伤c  阅读(2983)  评论(0编辑  收藏  举报