deleteMulti method
删除多个Id
Implementation
@override
Future<int> deleteMulti(List<Object?>? datas, [String? tableName]) async {
if (datas is List<T>) {
final batch = db.batch();
for (T? c in datas) {
if (c == null) continue;
Map map = c.primaryKeyAndValue();
batch.delete(tableName ?? table, where: "${map.keys.first} = ?", whereArgs: [map.values.first]);
}
await batch.commit(noResult: true);
} else {
String ids = composeIds(datas);
String sql = "delete from $table where $_primaryKey in ($ids)";
try {
return await db.rawDelete(sql);
} catch (e) {
print(e);
}
}
return -1;
}