[FrontendWebApi] GetNextFloor 取得 目標樓層之下一樓層 API 建置 | GetFloor 丟出 Floor_guid 程序調整 | forge 動態抓取 node id forge_node_name_system_type 改為 forge_check_tag_id

This commit is contained in:
dev01 2022-12-31 11:13:35 +08:00
parent e48240b6eb
commit a3a0a0c963
3 changed files with 44 additions and 3 deletions

View File

@ -219,7 +219,7 @@ namespace FrontendWebApi.ApiControllers
try
{
var sqlString = $@"select f.full_name as floor_tag
var sqlString = $@"select f.full_name as floor_tag, f.floor_guid
from sub_system_floor ssf
join floor f on ssf.floor_tag = f.full_name and ssf.building_tag = f.building_tag and f.deleted = 0
where ssf.deleted = 0 and f.building_tag = @building_tag and sub_system_tag = @sub_system_tag order by f.priority";
@ -789,5 +789,45 @@ namespace FrontendWebApi.ApiControllers
}
return Ok(apiResult);
}
/// <summary>
/// 樓層列表
/// </summary>
/// <param name="account"></param>
/// <returns></returns>
[HttpPost]
[Route("api/Device/GetNextFloor")]
public async Task<ActionResult<ApiResult<Floor>>> GetNextFloor([FromBody] Floor f)
{
ApiResult<Floor> apiResult = new ApiResult<Floor>();
if (string.IsNullOrEmpty(f.floor_guid))
{
apiResult.Code = "0002";
apiResult.Msg = "需傳入樓層guid";
return apiResult;
}
try
{
var sqlString = $@" SELECT * FROM floor WHERE
priority = (SELECT MIN(priority) FROM floor WHERE priority > (SELECT priority FROM floor WHERE floor_guid = @floor_guid)
AND building_tag = (SELECT building_tag FROM floor WHERE floor_guid = @floor_guid))
AND building_tag = (SELECT building_tag FROM floor WHERE floor_guid = @floor_guid)";
var param = new { @floor_guid = f.floor_guid };
var fr = await backendRepository.GetOneAsync<Floor>(sqlString, param);
apiResult.Code = "0000";
apiResult.Data = fr;
}
catch (Exception exception)
{
apiResult.Code = "9999";
apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
return Ok(apiResult);
}
return Ok(apiResult);
}
}
}

View File

@ -35,7 +35,7 @@ namespace FrontendWebApi.ApiControllers
public string actionName;
public string main_system_type = "device_system_category_layer2";
public string sub_system_type = "device_system_category_layer3";
public string forge_node_name_system_type = "forge_check_node_name";
public string forge_node_name_system_type = "forge_check_tag_id";
public ErrorCode errorCode = new ErrorCode();
[Authorize]
public override void OnActionExecuting(ActionExecutingContext filterContext)

View File

@ -24,6 +24,7 @@ namespace FrontendWebApi.Models
{
public string full_name { get; set; }
public string floor_tag { get; set; }
public string floor_guid { get; set; }
public string map_name { get; set; }
public string floor_map_name { get; set; }
public string urn_3D { get; set; }