[後端] 修改同步niagara_item full_name 問題, 修改即使歷史資料api輸出架構, 修改get floor問題
This commit is contained in:
parent
d312a3c293
commit
4fff1630c9
@ -288,7 +288,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
List<Floor> Floors = new List<Floor>();
|
||||
var floorsql = await backendRepository.GetAllAsync<Floorsql>($@"
|
||||
select * from (select * from sub_system_floor ssf where ssf.deleted = 0 and ssf.status = 0 and ssf.building_tag = '{get.building_tag}' and ssf.main_system_tag = '{get.main_system_tag}' and ssf.sub_system_tag = '{get.sub_system_tag}') a
|
||||
left join floor on floor.full_name = a.floor_tag order by floor.priority");
|
||||
left join floor on floor.full_name = a.floor_tag and a.building_tag = floor.building_tag order by floor.priority");
|
||||
Sub_system sub_System = new Sub_system()
|
||||
{
|
||||
sub_system_tag = sub_system.sub_system_tag,
|
||||
|
@ -1122,10 +1122,13 @@ namespace FrontendWebApi.ApiControllers
|
||||
{
|
||||
foreach (var tn in tableName)
|
||||
{
|
||||
var data = new HistoryRealTimeOutput();
|
||||
data.deviceNumber = tn;
|
||||
var sql = $@"select timestamp as timeStamp, round(value, 2) as value from {tn} where replace(convert(varchar, [timestamp], 111), '/', '-') >= @startTime and replace(convert(varchar, [timestamp], 111), '/', '-') <= @endTime ordr by timestamp";
|
||||
apiResult.Data.AddRange(
|
||||
await backgroundServiceMsSqlRepository.GetAllAsync<HistoryRealTimeOutput>(sql, new { startTime = input.startTime, endTime = input.endTime })
|
||||
data.HistoryRealTime.AddRange(
|
||||
await backgroundServiceMsSqlRepository.GetAllAsync<HistoryRealTime>(sql, new { startTime = input.startTime, endTime = input.endTime })
|
||||
);
|
||||
apiResult.Data.Add(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -304,6 +304,12 @@ namespace FrontendWebApi.Models
|
||||
}
|
||||
|
||||
public class HistoryRealTimeOutput
|
||||
{
|
||||
public string deviceNumber { get; set; }
|
||||
public List<HistoryRealTime> HistoryRealTime { get; set; }
|
||||
}
|
||||
|
||||
public class HistoryRealTime
|
||||
{
|
||||
public double value { get; set; }
|
||||
public DateTime timeStamp { get; set; }
|
||||
|
@ -249,8 +249,10 @@ namespace Repository.BackendRepository.Implement
|
||||
sb.Append($@" update import_niagara_item a join dic_system b
|
||||
on a.device_name_tag COLLATE utf8mb4_general_ci = b.s2_code
|
||||
set device_system_tag = b.s1_code
|
||||
where (device_system_tag <> 'S' and device_system_tag <> 'CWB')");
|
||||
where (device_system_tag <> 'S' and device_system_tag <> 'CWB');");
|
||||
}
|
||||
|
||||
sb.Append($@" update import_niagara_item set full_name = device_point_name where full_name = '' or full_name is null;");
|
||||
await conn.ExecuteAsync(sb.ToString());
|
||||
sb.Clear();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user