向动态表中插入数据,其中表名称是动态的,需要通过map集合进行传参。需要插入的数据时通过list封装的实体类,然后把list集合放入到map中作为参数传递。
sql语句的写法:
<insert id = "insertData" parameterType = "hashmap" >
insert into ${tableName} (tableName为自己需要插入的表的名称)
(uuid,temp1,temp2)
values
<foreach collection="list" separator="," index ="index" item="item">
(
#( item.uuid,jdbcType=VARCHAR),
#( item.temp1,jdbcType=VARCHAR),
#( item.temp2,jdbcType=VARCHAR)
)
</foreach>
</insert>