第一种 XML里面定义好SQL
void updateBatch(List<UserPermission> userPermission);
<insert id="insertBatch" parameterType="java.util.List" >
<selectKey keyProperty="id" order="BEFORE"
resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into user_permission (<include refid="Base_Column_Inserts" />)
values
<foreach collection="list" item="item" index="index" separator=",">
<trim prefix=" (" suffix=")" suffixOverrides="," >
#{item.id,jdbcType=BIGINT},#{item.bid,jdbcType=BIGINT}, #{item.fid,jdbcType=BIGINT},#{item.buttonName,jdbcType=VARCHAR},#{item.buttonState,jdbcType=BIGINT},#{item.effective,jdbcType=BIGINT},#{item.createAt,jdbcType=TIMESTAMP}