zoukankan      html  css  js  c++  java
  • mybatis sql语句配置 符号不兼容 大于号 小于号

    在mybatis中对sql语句中涉及到大于号,小于号,如何操作:

    方法一、

    将其放入到<![CDATA[  ]]>标签中

    如:

    [html] view plain copy
     
    1. <![CDATA[ 
    2.        and mm.ttime > to_date(#{startDateTime},'yyyy-mm-dd hh24:mi:ss') 
    3.        and mm.ttime <= to_date(#{endDateTime},'yyyy-mm-dd hh24:mi:ss') 
    4. ]]>  

    方法二、

    如果是在动态语句中,则需要转换

    如:

    [html] view plain copy
     
    1. <if test="startDateTime!=null"> and mm.ttime &gt; to_date(#{startDateTime},'yyyy-mm-dd hh24:mi:ss')</if>  
    2. <if test="endDateTime!=null"> and mm.ttime &lt;= to_date(#{endDateTime},'yyyy-mm-dd hh24:mi:ss')</if>  

    符号:

        &lt;          < 
        &gt;          >  
        &lt;&gt;   <>
        &amp;      & 
        &apos;      '
        &quot;      "

  • 相关阅读:
    研究下线程投递
    IOCP笔记
    线程同步之mutex和Semaphore
    线程同步之mutex和event区别
    MyStack
    unix环境高级编程 读书笔记
    binary search tree study
    技术博客地址搜集
    select收数据
    奇怪的问题
  • 原文地址:https://www.cnblogs.com/tanzq/p/8424713.html
Copyright © 2011-2022 走看看