1、if...else...的写法
<choose>
<when test="name != null and name != ''">
</when>
<otherwise>
</otherwise>
</choose>
2、比较日期大小时,敏感字符语句转字符串
<![CDATA[
]]>
3、if中字符串比较可以使用toString()
<if test="test_id != null and test_id != '' and test_id != '0'.toString()">
</if>
4、使用foreach标签进行批量新增
<insert id="batchInsert" parameterType="java.util.List">
INSERT INTO table_name (column1, column2) VALUES
<foreach collection="list" item="item" separator=",">
(#{item.property1}, #{item.property2})
</foreach>
</insert>
文章介绍了在XML配置中使用if...else...的逻辑结构,以及处理敏感字符的方法,如使用CDATA。同时,展示了在Java或类似的环境中,如何使用toString()方法进行字符串比较。此外,还详细说明了利用foreach标签进行批量数据插入数据库的操作方式。
1175

被折叠的 条评论
为什么被折叠?



