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());