今天在写代码时,因为业务,需要在mybatis中,使用到大于号,小于号,所以就在sql中直接使用了。 select * from test where 1 = 1 and start_date = current_date and end_date = current_date 可是,在执行时,总报错误: error creating document instance.
今天在写代码时,因为业务,需要在mybatis中,使用到大于号,小于号,所以就在sql中直接使用了。
select * from test where 1 = 1 and start_date = current_date
可是,在执行时,总报错误:
error creating document instance. cause: org.xml.sax.saxparseexception; linenumber: 74; columnnumber: 17; 元素内容必须由格式正确的字符数据或标记组成。
把and start_date >= current_date and end_date 于是就想到了特殊符号,于是用了转义字符把>和select * from test where 1 = 1 and start_date <= current_date and end_date >= current_date 附:xml转义字符
< 大于号
& & 和
' ' 单引号
双引号