[後端] 新增獲取棟別樓層api

This commit is contained in:
dev02 2023-05-11 17:01:45 +08:00
parent b3bbbb22a7
commit 9058055e15

View File

@ -690,5 +690,37 @@ namespace FrontendWebApi.ApiControllers
return Ok(apiResult);
}
[HttpPost]
[Route("api/GetAllfloor")]
public async Task<ActionResult<ApiResult<List<string>>>> GetAllfloor(string building_tag)
{
ApiResult<List<string>> apiResult = new ApiResult<List<string>>(jwt_str);
if (!jwtlife)
{
apiResult.Code = "5000";
return BadRequest(apiResult);
}
try
{
string sWhere = $@"
SELECT
full_name
FROM floor
where building_guid = @building_tag and deleted = 0";
var floor = await backendRepository.GetAllAsync<string>(sWhere, new { building_tag = building_tag });
apiResult.Data = floor;
apiResult.Code = "0000";
}
catch (Exception exception)
{
apiResult.Code = "9999";
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
return Ok(apiResult);
}
return Ok(apiResult);
}
}
}