後台 [歷史資料] api 程序調整
This commit is contained in:
parent
d2624226ac
commit
faa2ddca2f
@ -1137,7 +1137,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
and di.device_system_tag COLLATE utf8mb4_unicode_ci = d.device_system_tag
|
and di.device_system_tag COLLATE utf8mb4_unicode_ci = d.device_system_tag
|
||||||
and di.device_name_tag COLLATE utf8mb4_unicode_ci = d.device_name_tag
|
and di.device_name_tag COLLATE utf8mb4_unicode_ci = d.device_name_tag
|
||||||
and d.deleted = 0
|
and d.deleted = 0
|
||||||
where di.deleted = 0 and di.unit is not null and d.device_number IN @Device_number
|
where di.deleted = 0 and di.unit is not null and d.device_number = @Device_number
|
||||||
) temp
|
) temp
|
||||||
inner join building b on temp.device_building_tag COLLATE utf8mb4_unicode_ci = b.building_tag and b.deleted = 0
|
inner join building b on temp.device_building_tag COLLATE utf8mb4_unicode_ci = b.building_tag and b.deleted = 0
|
||||||
inner join variable v1 on temp.device_system_tag COLLATE utf8mb4_unicode_ci = v1.system_value and v1.deleted = 0 and v1.system_type = 'device_system_category_layer2'
|
inner join variable v1 on temp.device_system_tag COLLATE utf8mb4_unicode_ci = v1.system_value and v1.deleted = 0 and v1.system_type = 'device_system_category_layer2'
|
||||||
@ -1149,12 +1149,12 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
var device_number = hi.Device_number_point.Split(":")[0];
|
var device_number = hi.Device_number_point.Split(":")[0];
|
||||||
var point = hi.Device_number_point.Split(":")[1];
|
var point = hi.Device_number_point.Split(":")[1];
|
||||||
//var tableName = await backgroundServiceMsSqlRepository.GetAllAsync<string>($"select table_name from INFORMATION_SCHEMA.TABLES where table_name like '%{device_number}%'");
|
//var tableName = await backgroundServiceMsSqlRepository.GetAllAsync<string>($"select table_name from INFORMATION_SCHEMA.TABLES where table_name like '%{device_number}%'");
|
||||||
var device_item_infos = await frontendRepository.GetAllAsync<DeviceItemInfo>(sqlDeviceItemInfo, new { Device_number = hi.Device_number_point });
|
var device_item_infos = await frontendRepository.GetAllAsync<DeviceItemInfo>(sqlDeviceItemInfo, new { Device_number = device_number });
|
||||||
|
|
||||||
var device_item_info = device_item_infos.Where(x => x.Device_number == device_number && x.Points == point).FirstOrDefault();
|
var device_item_info = device_item_infos.Where(x => x.Device_number == device_number && x.Points == point).FirstOrDefault();
|
||||||
|
|
||||||
var sql = $@"select '{device_item_info.Building_name}' as Building_name, '{device_item_info.Main_system_name}' as Main_system_name,
|
var sql = $@"select '{device_item_info.Building_name}' as Building_name, '{device_item_info.Main_system_name}' as Main_system_name,
|
||||||
'{device_item_info.Sub_system_name}' as Sub_system_name', {device_item_info.Device_number}' as Device_number,
|
'{device_item_info.Sub_system_name}' as Sub_system_name, '{device_item_info.Device_number}' as Device_number,
|
||||||
'{device_item_info.Device_name}' as Device_name, '{device_item_info.Item_name}' as Item_name, '{device_item_info.Points}' as Points,
|
'{device_item_info.Device_name}' as Device_name, '{device_item_info.Item_name}' as Item_name, '{device_item_info.Points}' as Points,
|
||||||
'{device_item_info.Unit}' as Unit, timestamp as Timestamp, round(value, 2) as Value
|
'{device_item_info.Unit}' as Unit, timestamp as Timestamp, round(value, 2) as Value
|
||||||
from FIC_CENTER_{device_number}_{point}
|
from FIC_CENTER_{device_number}_{point}
|
||||||
@ -1167,7 +1167,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
//{
|
//{
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
apiResult.Code = "0000";
|
||||||
apiResult.Data = apiResult.Data.OrderBy(x => x.Device_number).ThenBy(x => x.Timestamp).ToList();
|
apiResult.Data = apiResult.Data.OrderBy(x => x.Device_number).ThenBy(x => x.Timestamp).ToList();
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
|
@ -264,6 +264,7 @@ namespace FrontendWebApi.Models
|
|||||||
public class HistoryItem
|
public class HistoryItem
|
||||||
{
|
{
|
||||||
public string Device_number_point { get; set; }
|
public string Device_number_point { get; set; }
|
||||||
|
public string Device_number { get; set; }
|
||||||
public string Unit { get; set; }
|
public string Unit { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user