Mybatis中foreach标签带来的空格 换行 回车问题,不需要替换空格换行编码什么的

报错的写法:

<if test="docIdentifierList !=null and docIdentifierList.size() > 0">
and
<foreach collection="docIdentifierList" item="item" index="index" separator="or" open="(" close=")">
(
bdsi.`system` = #{item.docIdentifierSystem}
and bdsi.`value` = #{item.docIdentifierValue}
)
</foreach>
</if>

正常执行的写法:<foreach>和</foreach>中间不能存在自己手动敲的空格之类的字符

<if test="docIdentifierList !=null and docIdentifierList.size() > 0">
and <foreach collection="docIdentifierList" item="item" index="index" separator="or" open="(" close=")">(bdsi.`system` = #{item.docIdentifierSystem} and bdsi.`value` = #{item.docIdentifierValue})</foreach>
</if>

 

ok

posted @ 2022-02-10 13:32  ジ绯色月下ぎ  阅读(790)  评论(0编辑  收藏  举报