Mapper 文件中SQL不等于的写法
时间:2020-02-15 16:26:57
收藏:0
阅读:2208
Mybatis中的mapper文件中不等于的几种写法
在XML文件中是不可以直接使用 < 、>、&的,语法检查会报错误。如需使用,需要将其转义为对应的实体。
预期执行SQL效果:select t.name form tablenme t where t.code <> 1;
第一种:转义
< < (小于) > > (大于) <> <> (不等于)
mapper文件写法:
select t.name form tablenme t where t.code <> 1;
第二种:<![CDATA[]]>
<![CDATA[]]>这个标记所包含的内容将表示为纯文本。
mapper文件写法:
select t.name form tablenme t where t.code <![CDATA[<>]]> 1;
原文:https://www.cnblogs.com/toSeeMyDream/p/12312145.html
评论(0)