datalist中map的顺序需要与lineColumn对应<insert id="insertIndi" parameterType="java.util.HashMap" useGeneratedKeys="false"> <![CDATA[ INSERT INTO TABLEA(${lineColumn}) select results.* from( ]]> <foreach collection="datalist" item="item" index="index" separator="union all" > (select <foreach collection="item.values" index="key" item="_value" separator=","> #{_value} </foreach> from dual) </foreach> <![CDATA[) results]]></insert>
<update id="updataData" parameterType="java.util.HashMap" useGeneratedKeys="false"> <foreach collection="datalist" item="item" index="index" open="begin" close="; end;" separator=";"> update ${tablename} set <foreach collection="item" index="_key" item="_value" separator=","> ${_key} = #{_value} </foreach> where guid = #{item.GUID} </foreach></update>
转载于:https://www.cnblogs.com/sx2zx/p/10832320.html