<insert id="insertManagerInfoBatch" parameterType="java.util.List"> <selectKey resultType="java.math.BigDecimal" order="BEFORE" keyProperty="id"> SELECT XSHTEST.XSHE_BRANCH_OFFICE_SEQ.Nextval as ID from DUAL </selectKey> insert into xshtest.XSHE_CUSTOMER_MANAGER (id,manager_name,manager_no,branch_company_id,contact_phone,status) SELECT XSHTEST.XSHE_BRANCH_OFFICE_SEQ.Nextval ,t.* FROM ( <foreach collection="list" item="item" separator="UNION ALL"> select #{item.managerName}, #{item.managerNo}, #{item.companyId}, #{item.contactPhone}, #{item.status} from dual </foreach> )t </insert>
/** *mapper传参为list **/ int insertManagerInfoBatch(List list);
不要忘记对序列赋权:grant select on XSHE_BRANCH_OFFICE_SEQ to user