特殊字符 | xml中代替符号 | <![CDATA[]]> |
---|---|---|
& | & | |
< | < | a<![CDATA[<]]>b |
> | > | a<![CDATA[>]]>b |
" | " | |
’ | &apos | |
a<=b | a<=b | a<![CDATA[<=]]>b |
a>=b | a>=b | a<![CDATA[>=]]>b |
a!=b | a!=b | a<![CDATA[<>]]>b 或者a<![CDATA[!=]]>b |
案例
@Select("<script> SELECT * from " + ALARM_TABLE_NAME +
"<where>" +
"<if test='item.name != null'> name like '%" + "${item.name}" + "%'</if>" +
"<if test='item.levelListStr != null'> AND level in ${item.levelListStr} </if>" +
"<if test='item.alarmStateList != null'> AND CONCAT(confirmState,handState) in ${item.alarmStateListStr} </if>" +
"<if test='item.handStartTime != null' > AND handTime <![CDATA[>=]]> #{item.handStartTime}</if>" +
"<if test='item.handEndTime != null' > AND handTime <![CDATA[<=]]> #{item.handEndTime}</if>" +
"</where> ORDER BY id DESC </script>")
List<Alarm> searchListByName(@Param("item") SearchCurrentAlarmQuery searchQuery);
版权说明 : 本文为转载文章, 版权归原作者所有 版权申明
原文链接 : https://blog.csdn.net/weixin_43296313/article/details/120363484
内容来源于网络,如有侵权,请联系作者删除!