[後端] 修改device_item history show 問題
[前端] 修改前端api
This commit is contained in:
parent
80be5b1fa2
commit
d02642ae27
@ -585,7 +585,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
left join floor f on d.device_floor_tag = f.full_name and f.deleted = 0
|
left join floor f on d.device_floor_tag = f.full_name and f.deleted = 0
|
||||||
{disasterjoinsql}
|
{disasterjoinsql}
|
||||||
LEFT JOIN building_menu bm ON d.device_building_tag = bm.building_tag AND d.device_system_tag = bm.main_system_tag AND d.device_name_tag = bm.sub_system_tag
|
LEFT JOIN building_menu bm ON d.device_building_tag = bm.building_tag AND d.device_system_tag = bm.main_system_tag AND d.device_name_tag = bm.sub_system_tag
|
||||||
where d.deleted = 0 and d.device_building_tag = '{post.building_tag}' {sWhere}
|
where d.deleted = 0 and d.is_link = 1 and d.device_building_tag = '{post.building_tag}' {sWhere}
|
||||||
order by d.priority ASC, left(device_serial_tag, LENGTH(device_serial_tag) - 1) ASC";
|
order by d.priority ASC, left(device_serial_tag, LENGTH(device_serial_tag) - 1) ASC";
|
||||||
|
|
||||||
var devicelist = await backendRepository.GetAllAsync<DeviceFloor>(sql);
|
var devicelist = await backendRepository.GetAllAsync<DeviceFloor>(sql);
|
||||||
|
@ -486,6 +486,22 @@ namespace Repository.BackendRepository.Implement
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
//device有,niagara有,is_link 更新成 1
|
||||||
|
sb.Append($@" SET SQL_SAFE_UPDATES = 0;
|
||||||
|
UPDATE device d
|
||||||
|
JOIN (
|
||||||
|
SELECT niagara_tags
|
||||||
|
FROM import_niagara_tag
|
||||||
|
LIMIT 100000
|
||||||
|
) i ON d.device_number = i.niagara_tags
|
||||||
|
SET d.is_link = 1");
|
||||||
|
using (TransactionScope scope = new TransactionScope((TransactionScopeOption)TransactionScopeAsyncFlowOption.Enabled))
|
||||||
|
{
|
||||||
|
await conn.ExecuteAsync(sb.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
sb.Clear();
|
||||||
|
|
||||||
//device有,niagara沒有,is_link 更新成 0
|
//device有,niagara沒有,is_link 更新成 0
|
||||||
sb.Append($@" SET SQL_SAFE_UPDATES = 0;
|
sb.Append($@" SET SQL_SAFE_UPDATES = 0;
|
||||||
UPDATE device d
|
UPDATE device d
|
||||||
@ -976,18 +992,34 @@ namespace Repository.BackendRepository.Implement
|
|||||||
using (IDbConnection conn = GetDbConnection())
|
using (IDbConnection conn = GetDbConnection())
|
||||||
{
|
{
|
||||||
conn.Open();
|
conn.Open();
|
||||||
using (TransactionScope scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
|
|
||||||
{
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
//先全部關閉
|
//先全部關閉
|
||||||
//sb.Append("update device_item set is_show_history=0;");
|
sb.Append("update device_item set is_show_history=0;");
|
||||||
sb.Append("update device_item set is_show_history = 0 " +
|
using (TransactionScope scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
|
||||||
"WHERE(device_system_tag, device_name_tag, points, full_name, is_show_history) NOT IN " +
|
{
|
||||||
"(select distinct device_system_tag, device_name_tag, device_point_name, full_name, is_history From import_niagara_item where is_history = 1);");
|
|
||||||
await conn.ExecuteAsync(sb.ToString());
|
await conn.ExecuteAsync(sb.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sb.Clear();
|
||||||
|
|
||||||
|
sb.Append($@"SET SQL_SAFE_UPDATES = 0;
|
||||||
|
update device_item di
|
||||||
|
JOIN (
|
||||||
|
select distinct device_system_tag, device_name_tag, device_point_name, full_name, device_building_tag from import_niagara_item where is_history = 1 limit 100000
|
||||||
|
) niagara
|
||||||
|
ON di.device_system_tag = niagara.device_system_tag
|
||||||
|
AND di.device_name_tag = niagara.device_name_tag
|
||||||
|
AND di.points = niagara.device_point_name
|
||||||
|
AND di.full_name = niagara.full_name
|
||||||
|
AND di.device_building_tag = niagara.device_building_tag
|
||||||
|
set di.is_show_history = 1");
|
||||||
|
using (TransactionScope scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
|
||||||
|
{
|
||||||
|
await conn.ExecuteAsync(sb.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
throw exception;
|
throw exception;
|
||||||
@ -996,7 +1028,7 @@ namespace Repository.BackendRepository.Implement
|
|||||||
{
|
{
|
||||||
conn.Close();
|
conn.Close();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user