方法定义:
@Transactional(readOnly = false,propagation = Propagation.REQUIRED,rollbackFor=Exception.class)//事务
public void addOrgStaffs(@Param("orgstafflist")List<OrgStaff> orgStaffList);
XML中SQL:
<insert id="addOrgStaffs" parameterType="gov.charity.domain.OrgStaff">
insert into orgstaff
{
ID,
NAME
}
<foreach collection="orgstafflist" item="staffitem" index="index" separator="union">
select #{staffitem.id},#{staffitem.name,jdbcType=VARCHAR} from dual
</foreach>
</insert>