From 6458a10215b2ee49aa848484c950b2966ea9dc15 Mon Sep 17 00:00:00 2001 From: dev02 Date: Fri, 2 Jun 2023 18:02:11 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=90=8E=E5=8F=B0]=20=E4=BF=AE=E6=94=B9niagar?= =?UTF-8?q?a=20=E5=90=8C=E6=AD=A5device=5Fitem=20=E5=90=8C=E6=AD=A5is=5Fli?= =?UTF-8?q?nk,=20is=5Fhistory=20=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Backend/Startup.cs | 12 +++++----- .../NiagaraDataSynchronizeRepository.cs | 24 +++++++++++++++---- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/Backend/Startup.cs b/Backend/Startup.cs index a85040b..b5b000e 100644 --- a/Backend/Startup.cs +++ b/Backend/Startup.cs @@ -170,12 +170,12 @@ namespace Backend ); #endregion - #region ©w®É¨ú±o®ð¶HAPI - services.AddSingleton(); - services.AddSingleton( - new JobSchedule(jobType: typeof(WeatherAPIJob), cronExpression: Configuration.GetValue("BackgroundServiceCron:WeatherAPIJob")) - ); - #endregion + //#region ©w®É¨ú±o®ð¶HAPI + //services.AddSingleton(); + //services.AddSingleton( + //new JobSchedule(jobType: typeof(WeatherAPIJob), cronExpression: Configuration.GetValue("BackgroundServiceCron:WeatherAPIJob")) + //); + //#endregion double loginExpireMinute = this.Configuration.GetValue("LoginExpireMinute"); services.AddSession(options => diff --git a/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs b/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs index d293e89..53e91eb 100644 --- a/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs +++ b/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs @@ -506,11 +506,25 @@ namespace Repository.BackendRepository.Implement //本次有匯入的 isLink 改為 1, 沒有的 isLink = 0 sb.Append($@" SET SQL_SAFE_UPDATES = 0; - UPDATE device_item d LEFT JOIN import_niagara_item m - ON d.device_system_tag = m.device_system_tag and d.device_name_tag = m.device_name_tag and d.points = m.device_point_name and d.full_name = m.full_name and d.is_show_history = m.is_history - SET d.is_link = case when device_point_name is null then 0 else 1 end , - d.is_show_history = case when device_point_name is null then 0 else 1 end - where m.is_history = 1 + update + device_item d + LEFT JOIN import_niagara_item m + ON d.device_system_tag = m.device_system_tag + and d.device_name_tag = m.device_name_tag + and d.points = m.device_point_name + and d.full_name = m.full_name + SET d.is_link = case when device_point_name is null then 0 else 1 end; + + update + device_item d + LEFT JOIN import_niagara_item m + ON d.device_system_tag = m.device_system_tag + and d.device_name_tag = m.device_name_tag + and d.points = m.device_point_name + and d.full_name = m.full_name + and d.is_show_history = m.is_history + SET d.is_show_history = case when device_point_name is null then 0 else 1 end + where (m.is_history = 1 or d.is_show_history); "); await conn.ExecuteAsync(sb.ToString());