package com.gyee.wisdom.adapter.common.util; import com.gyee.wisdom.adapter.model.adapter.ToData; import java.util.Collection; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; public abstract class DataUtil { private DataUtil() { } public static List convertDataList(Collection> toDataList) { return toDataList.stream().map(ToData::toData).collect(Collectors.toList()); } public static T getData(ToData data) { return Optional.ofNullable(data).isPresent() ? data.toData() : null; } public static String convertStringToSql(String ...content){ if (content == null) return null; StringBuilder sb = new StringBuilder(); for (String data : content){ sb.append("'").append(data).append("',"); } String sql = sb.toString(); return sql.substring(0, sql.length() - 1); } }