MyBatis批量插入数据

1.Service
int add(List billManagement);

2.ServiceImpl
public int add(List billManagement) {
    return billManagementMapper.insertBatch(billManagement);
}
  
3.Mapper 
int insertBatch(List billManagement);

4.xml文件


insert into p_bill_management (
  belonging_organization,
  bill_types,
  bill_number,
  create_by,
  create_date)
values

  (#{item.belongingOrganization,jdbcType=VARCHAR},
  #{item.billTypes,jdbcType=INTEGER},
  #{item.billNumber,jdbcType=VARCHAR},
  #{item.createBy,jdbcType=VARCHAR},
  #{item.createDate,jdbcType=TIMESTAMP})

 

你可能感兴趣的:(Java编程)