|
|
|
@ -121,14 +121,10 @@ public class TsKvNativeSQL { |
|
|
|
} |
|
|
|
|
|
|
|
public static String sqlSaveProtoTsKv(List<DataProto> protoList, DatabaseType dataType) { |
|
|
|
|
|
|
|
// 使用Stream API和Collectors.toMap来去重 |
|
|
|
List<DataProto> distinctStudentFile = protoList.stream() |
|
|
|
.collect(Collectors.collectingAndThen( |
|
|
|
Collectors.toCollection(() -> |
|
|
|
new TreeSet<>(Comparator.comparing(o -> o.getTskvProto().getThingCode() + ";" + o.getTskvProto().getKey()+ ";" + o.getTskvProto().getVal()+ ";" + o.getTskvProto().getTs()))), ArrayList::new)); |
|
|
|
|
|
|
|
|
|
|
|
new TreeSet<>(Comparator.comparing(o -> o.getTskvProto().getThingCode() + ";" + o.getTskvProto().getKey()+ ";" + Double.valueOf(o.getTskvProto().getVal())+ ";" + o.getTskvProto().getTs()))), ArrayList::new)); |
|
|
|
StringBuilder sql = new StringBuilder(" INSERT INTO ") |
|
|
|
.append(TS_KV).append(" (") |
|
|
|
.append(THING_CODE) |
|
|
|
|