修改欄位
This commit is contained in:
parent
7fd44ec6df
commit
5dacdc0f58
@ -1,6 +1,7 @@
|
||||
using FrontendWebApi.Models;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.CodeAnalysis.CSharp;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
@ -22,6 +23,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
{
|
||||
private readonly IBackendRepository backendRepository;
|
||||
private readonly IFrontendRepository frontendRepository;
|
||||
private string deviceKindFilePath = "upload/device_icon/";
|
||||
|
||||
public DeviceManageController
|
||||
(
|
||||
@ -194,7 +196,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
foreach (var f in fl)
|
||||
{
|
||||
List<DeviceLists> dl = new List<DeviceLists>();
|
||||
sqlString = $@"select d.device_guid, d.full_name, d.device_coordinate, dk.device_image, d.device_number,
|
||||
sqlString = $@"select d.device_guid, d.full_name, d.device_coordinate, dk.device_image, d.device_number, CONCAT('{baseURL}', '{deviceKindFilePath}', dk.device_image) AS device_image_url,
|
||||
dk.device_normal_point_id, dk.device_normal_point_guid, dk.device_normal_point_col, dk.device_normal_point_value, dk.device_normal_flashing,
|
||||
dk.device_close_point_id, dk.device_close_point_guid, dk.device_close_point_col, dk.device_close_point_value, dk.device_close_flashing,
|
||||
dk.device_error_point_id, dk.device_error_point_guid, dk.device_error_point_col, dk.device_error_point_value, dk.device_error_flashing
|
||||
@ -204,9 +206,25 @@ namespace FrontendWebApi.ApiControllers
|
||||
where d.deleted = 0 and d.device_name_tag = @sub_system_tag and d.device_building_tag = @building_tag and d.device_floor_tag = @floor_tag";
|
||||
var dlParam = new { @sub_system_tag = fd.sub_system_tag, @building_tag = fd.building_tag, @floor_tag = f.full_name };
|
||||
dl = await backendRepository.GetAllAsync<DeviceLists>(sqlString, dlParam);
|
||||
|
||||
foreach(var d in dl)
|
||||
{
|
||||
var sql_node = $@"SELECT
|
||||
dn.device_node_guid,
|
||||
dn.device_guid,
|
||||
dn.full_name AS Device_node_full_name,
|
||||
dn.device_node_coordinate,
|
||||
dn.priority
|
||||
FROM device_node dn
|
||||
WHERE dn.deleted = 0 AND dn.device_guid = @device_guid
|
||||
ORDER BY dn.priority ASC";
|
||||
|
||||
d.Device_nodes = await backendRepository.GetAllAsync<DeviceNode>(sql_node, new { device_guid = d.device_guid });
|
||||
}
|
||||
f.device_list = dl;
|
||||
}
|
||||
|
||||
|
||||
apiResult.Data = fl;
|
||||
apiResult.Code = "0000";
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
private ILogger<T> _logger;
|
||||
protected ILogger<T> Logger => _logger ?? (_logger = HttpContext?.RequestServices.GetService<ILogger<T>>());
|
||||
private IJwtHelpers jwt => HttpContext?.RequestServices.GetService<IJwtHelpers>();
|
||||
public string baseURL => HttpContext?.Request.Scheme + "://" + HttpContext?.Request.Host + "/";
|
||||
|
||||
public MyBaseApiController() { }
|
||||
protected JwtGet myUser;
|
||||
|
@ -65,6 +65,7 @@ namespace FrontendWebApi.Models
|
||||
public string device_error_point_col { get; set; }
|
||||
public string device_error_point_value { get; set; }
|
||||
public string device_error_flashing { get; set; }
|
||||
public List<DeviceNode> Device_nodes { get; set; }
|
||||
}
|
||||
|
||||
public class DeviceBaseInfo
|
||||
|
Loading…
Reference in New Issue
Block a user