Mybatis中的mapper文件中不等于的几种写法
第一种:转义 < < (小于) > > (大于)(不等于) mapper文件写法: select t.name form tablenme t where t.code1;第二种: 这个标记所包含的内容将表示为纯文本。 mapper文件写法: select t.name form tablenme t where t.code ]]> 1;...
·
在学习mybatis过程中发现在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;
更多推荐
已为社区贡献1条内容
所有评论(0)