composeIds method

  1. @override
String composeIds(
  1. List<Object?>? datas
)
override

组装Ids

Implementation

@override
String composeIds(List<Object?>? datas) {
  if (datas == null || datas.isEmpty) return "";
  StringBuffer buffer = StringBuffer();
  if (datas is List<String> || datas is List<String?>) {
    for (var id in datas) {
      if (id == null) continue;
      if (id.contains("'")) {
        buffer.write('"$id"');
      } else {
        buffer.write('\'$id\'');
      }
      buffer.write(',');
    }
    String ids = buffer.toString();
    ids = ids.substring(0, ids.length - 1);
    return ids;
  } else if (datas is List<num>) {
    return datas.join(",");
  }
  return "";
}