代码拉取完成,页面将自动刷新
防转义
-- 其中xxx可以包含特殊字符,不会被xml转义
<![CDATA[xxx]]>
如果不想用防转义处理的话,你可以这样写
字符 | xml中的写法 |
---|---|
< |
< |
<if test="paramId != null">
AND u.id = #{paramId}
</if>
判断不为empty
<if test="paramName != null and paramName != ''">
AND u.name = #{paramName}
</if>
判断不为blank
<if test="paramName != null and paramName.trim() != ''">
AND u.name = #{paramName}
</if>
<if test="stateSet != null and stateSet.size() > 0">
and u.state in
<foreach collection="stateSet" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
-- 按顺序, 只会进第一个满足条件的when, 所有when都不满足的话, 进otherwise
<choose>
<when test="sum == '1'.toString()">
u.rank='第一名'
</when>
<when test="sum == '2'.toString()">
u.rank='第二名'
</when>
<when test="sum == '3'.toString()">
u.rank='第三名'
</when>
<otherwise>
u.rank='路人'
</otherwise>
</choose>
u.`name` like CONCAT(#{paramName}, '%')
<if test="gender != null gender.name() == 'MALE'">
AND u.gender = 1
</if>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。