# DB普通添加
添加数据后如果需要返回新增数据的自增主键,可以使用insertGetId方法:
```java
FieldData field_data = new FieldData();
field_data.put("uid",1);
field_data.put("record_id",1);
field_data.put("product_id",1);
field_data.put("status",1);
int re_id = Db.name("dt_record_ext").insertGetId(field_data);
```
批量添加返回添加结果数组
```java
List<FieldData> objects = new ArrayList<>();
FieldData field_data = new FieldData();
field_data.put("uid",1);
field_data.put("record_id",1);
field_data.put("product_id",1);
field_data.put("status",1);
objects.add(field_data);
FieldData field_data2 = new FieldData();
field_data2.put("uid",1);
field_data2.put("record_id",1);
field_data2.put("product_id",2);
field_data2.put("status",1);
objects.add(field_data2);
int[] dt_record_exts = Db.name("dt_record_ext").insertAll(objects);
```