From cf9ae64ca48619cdd68effa790bd62b30a09999e Mon Sep 17 00:00:00 2001 From: dev02 Date: Fri, 15 Mar 2024 11:06:46 +0800 Subject: [PATCH 1/2] =?UTF-8?q?[=E5=BE=8C=E7=AB=AF]=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=B7=A8=E8=BC=AFdevice=5Fitem=20is=5Fshow=5Fhistory=E7=9A=84?= =?UTF-8?q?=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Implement/NiagaraDataSynchronizeRepository.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs b/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs index 184c25b..ba53b85 100644 --- a/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs +++ b/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs @@ -941,16 +941,17 @@ namespace Repository.BackendRepository.Implement sb.Append($@" SET SQL_SAFE_UPDATES = 0; UPDATE device_item d LEFT JOIN ( - SELECT m.device_system_tag, m.device_name_tag, m.device_point_name, m.full_name, device_building_tag + SELECT m.device_system_tag, m.device_name_tag, m.device_point_name, m.full_name, device_building_tag, date(created_at) as created_at FROM import_niagara_item m - WHERE (m.is_history = 1) + WHERE m.is_history = 1 LIMIT 100000 -- Specify your desired limit here ) AS subquery ON d.device_system_tag = subquery.device_system_tag AND d.device_name_tag = subquery.device_name_tag AND d.points = subquery.device_point_name AND d.device_building_tag = subquery.device_building_tag - SET d.is_show_history = CASE WHEN subquery.device_point_name IS NULL THEN 0 ELSE 1 END;"); + SET d.is_show_history = CASE WHEN subquery.device_point_name IS NULL THEN 0 ELSE 1 END + where date(d.created_at) = subquery.created_at;"); using (TransactionScope scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled)) { From 540113668f763c498c0d5b7d1b1db5fec3df2420 Mon Sep 17 00:00:00 2001 From: dev02 Date: Fri, 15 Mar 2024 14:31:34 +0800 Subject: [PATCH 2/2] =?UTF-8?q?[=E5=BE=8C=E7=AB=AF]=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E9=BB=9E=E4=BD=8Dis=5Fhistory=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/NiagaraDataSynchronizeController.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Backend/Controllers/NiagaraDataSynchronizeController.cs b/Backend/Controllers/NiagaraDataSynchronizeController.cs index 83c80db..6fb01fb 100644 --- a/Backend/Controllers/NiagaraDataSynchronizeController.cs +++ b/Backend/Controllers/NiagaraDataSynchronizeController.cs @@ -314,11 +314,11 @@ namespace Backend.Controllers stopwatchSection.Stop(); await niagaraDataSynchronizeRepository.KeepTimeLog("ItemCheckFullNameEmptyReplaceByDeviceName", stopwatchSection.ElapsedMilliseconds); - stopwatchSection = new Stopwatch(); - stopwatchSection.Start(); - await niagaraDataSynchronizeRepository.CheckItemIsShowHistory(); - stopwatchSection.Stop(); - await niagaraDataSynchronizeRepository.KeepTimeLog("CheckItemIsShowHistory", stopwatchSection.ElapsedMilliseconds); + //stopwatchSection = new Stopwatch(); + //stopwatchSection.Start(); + //await niagaraDataSynchronizeRepository.CheckItemIsShowHistory(); + //stopwatchSection.Stop(); + //await niagaraDataSynchronizeRepository.KeepTimeLog("CheckItemIsShowHistory", stopwatchSection.ElapsedMilliseconds); if (isFirstAsync) isFirstAsync = false;