[后台] 修改niagara 同步device_item 同步is_link, is_history 值
This commit is contained in:
parent
371e80eb89
commit
6458a10215
@ -170,12 +170,12 @@ namespace Backend
|
||||
);
|
||||
#endregion
|
||||
|
||||
#region 定時取得氣象API
|
||||
services.AddSingleton<WeatherAPIJob>();
|
||||
services.AddSingleton(
|
||||
new JobSchedule(jobType: typeof(WeatherAPIJob), cronExpression: Configuration.GetValue<string>("BackgroundServiceCron:WeatherAPIJob"))
|
||||
);
|
||||
#endregion
|
||||
//#region 定時取得氣象API
|
||||
//services.AddSingleton<WeatherAPIJob>();
|
||||
//services.AddSingleton(
|
||||
//new JobSchedule(jobType: typeof(WeatherAPIJob), cronExpression: Configuration.GetValue<string>("BackgroundServiceCron:WeatherAPIJob"))
|
||||
//);
|
||||
//#endregion
|
||||
|
||||
double loginExpireMinute = this.Configuration.GetValue<double>("LoginExpireMinute");
|
||||
services.AddSession(options =>
|
||||
|
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user