[後端] 調整新需求架構
This commit is contained in:
parent
2f80407373
commit
0ec125e0e0
@ -1326,11 +1326,13 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
var device_item_infos = await frontendRepository.GetAllAsync<DeviceItemInfo>(sqlDeviceItemInfo, new { Device_number = device_number });
|
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 valueType = await backgroundServiceMsSqlRepository.GetOneAsync<string>($"select Data_Type from INFORMATION_SCHEMA.COLUMNS where table_name = '{tableName}' and column_name = 'Value'");
|
||||||
|
|
||||||
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,
|
||||||
|
{(valueType.Equals("bit") ? "Case when value = 1 then 'true' when value = 0 then 'false' else 'Unknow' End" : "round(value, 2)")} as Value
|
||||||
from {tableName}
|
from {tableName}
|
||||||
where replace(convert(varchar, [timestamp], 111), '/', '-') >= @startTime
|
where replace(convert(varchar, [timestamp], 111), '/', '-') >= @startTime
|
||||||
and replace(convert(varchar, [timestamp], 111), '/', '-') <= @endTime order by timestamp";
|
and replace(convert(varchar, [timestamp], 111), '/', '-') <= @endTime order by timestamp";
|
||||||
|
Loading…
Reference in New Issue
Block a user