zoukankan      html  css  js  c++  java
  • xml中处理大于号小于号的方法(Mybati中大于、小于)

    xml中处理大于号小于号的方法(Mybati中大于、小于)

    1. 使用转义字符

    &lt; < 小于号
    &gt; > 大于号
    &amp; &
    &apos; 单引号
    &quot; " 双引号
    <if test="searchTimeBegin != null and searchTimeBegin != ''">
        AND tcci.consume_time &gt;= CONCAT(#{searchTimeBegin},' 00:00:00')
    </if>
    <if test="searchTimeEnd != null and searchTimeEnd != ''">
        AND tcci.consume_time &lt;= CONCAT(#{searchTimeEnd},' 23:59:59')
    </if>
    

    2. 使用<![CDATA[ ]]>符号

    在XML文件中的<![CDATA[ ]]>这里面的内容将不被解析

        <if test="beginTime!=null">
          AND DATE (os.show_start_time) >= DATE(#{beginTime})
        </if>
        <if test="endTime!=null">
          AND DATE (os.show_start_time) <![CDATA[<=]]> DATE(#{endTime})
        </if>
    
  • 相关阅读:
    org.springframework.beans.factory.BeanCreationException
    线程浅谈
    第五次作业
    第四次作业
    第三次作业
    第二次作业
    第一次作业
    第五次作业
    第三次作业
    第二次作业
  • 原文地址:https://www.cnblogs.com/cuianbing/p/14774010.html
Copyright © 2011-2022 走看看