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)