From 125696a5d35a05d3ac3dbdc2132029c2261d80c6 Mon Sep 17 00:00:00 2001 From: wanli Date: Sat, 31 Dec 2022 16:59:19 +0800 Subject: [PATCH] =?UTF-8?q?[Backend]=20N4=E5=90=8C=E6=AD=A5:=20device=5Fki?= =?UTF-8?q?nd=E9=87=8D=E8=A4=87=E5=95=8F=E9=A1=8C=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NiagaraDataSynchronizeRepository.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs b/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs index 9522f55..6db5b2e 100644 --- a/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs +++ b/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs @@ -229,6 +229,18 @@ namespace Repository.BackendRepository.Implement //新增至device, is_link = 1 if (result.Count > 0) { + var result2 = result.GroupBy(x => new + { + device_building_tag2 = x.device_building_tag, + device_system_tag2 = x.device_system_tag, + device_name_tag2 = x.device_name_tag + }).Select(x => new Device_item8 + { + device_building_tag = x.Key.device_building_tag2, + device_system_tag = x.Key.device_system_tag2, + device_name_tag = x.Key.device_name_tag2 + }); + foreach (var data in result) { sb.Append($@" insert device(device_guid, deleted, status, priority, is_link, device_area_tag, @@ -246,7 +258,9 @@ namespace Repository.BackendRepository.Implement data.device_serial_tag + "', '" + data.niagara_tags + "', '" + data.device_system_tag + "', now(), now() );"); - + } + foreach (var data in result) + { sb2.Append($@"INSERT device_kind (device_kind_guid, device_building_tag, device_system_tag, device_name_tag, device_normal_flashing, device_close_flashing, device_error_flashing, device_error_independent, created_by, created_at)