在mybatis中对sql语句中涉及到大于号,小于号,如何操作:
方法一、
将其放入到<![CDATA[ ]]>标签中
如:
- <![CDATA[
- and mm.ttime > to_date(#{startDateTime},'yyyy-mm-dd hh24:mi:ss')
- and mm.ttime <= to_date(#{endDateTime},'yyyy-mm-dd hh24:mi:ss')
- ]]>
方法二、
如果是在动态语句中,则需要转换
如:
- <if test="startDateTime!=null"> and mm.ttime > to_date(#{startDateTime},'yyyy-mm-dd hh24:mi:ss')</if>
- <if test="endDateTime!=null"> and mm.ttime <= to_date(#{endDateTime},'yyyy-mm-dd hh24:mi:ss')</if>
符号:
< <
> >
<> <>
& &
' '
" "