插入的值最好声明类型,否则可能出现些奇怪的错误。
<if test="list !=null and list.size()>0">
INSERT INTO b_prehour_event_count (
id,
team_id,
period,
short_period,
amount,
create_time,
del_flag
)
<foreach collection="list" index="index" item="item" separator="union all">
SELECT
#{item.id,jdbcType=VARCHAR},
#{item.teamId,jdbcType=VARCHAR},
#{item.period,jdbcType=VARCHAR},
#{item.shortPeriod,jdbcType=VARCHAR},
#{item.total,jdbcType=VARCHAR},
sysdate,
0
FROM dual
</foreach>
</if>
来源:oschina
链接:https://my.oschina.net/u/2831993/blog/1836605