mapper文件中写SQL语句提示tag name expected ,原因是因为xml不识别“<”号,需要用特定转移符来表示小于号。
<if test="endTime !=null and endTime !=''>
and create < #{endTime,jdbcType=VARCHAR}
</if>
改为
<if test="endTime !=null and endTime !=''>
and create < #{endTime,jdbcType=VARCHAR}
</if>
在xml中,一些字符拥有特殊的意义
如果将字符"<"放入xml元素中,会发生错误,这是因为解析器会把它当做新元素的开始。这样会产生xml错误
为避免这个错误,用实体引用来代替"<”字符。
在xml中,有5个预定义的实体引用
< | < | 小于 |
> | > | 大于 |
& | & | 与 |
' | ' | 省略 |
" | " | 引号 |
注:在xml中,只有字符"<"和“&”是非法的,大于号是合法的