mybatis中的一些特殊符号标识(大于,小于,等于,不等于)

x33g5p2x  于12个月前 转载在 其他  
字(1.1k)|赞(0)|评价(0)|浏览(181)
特殊字符xml中代替符号<![CDATA[]]>
&&amp;
<&lt;a<![CDATA[<]]>b
>&gt;a<![CDATA[>]]>b
"&quot;
&apos
a<=ba&lt;=ba<![CDATA[<=]]>b
a>=ba&gt;=ba<![CDATA[>=]]>b
a!=ba!=ba<![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);

相关文章