[後台]後端 buildController getallfloor order by 程序補上 | 取得水電列表 api 調整

This commit is contained in:
dev01 2023-05-15 15:18:43 +08:00
parent a55aa592c7
commit 0adecac5d8
2 changed files with 14 additions and 2 deletions

View File

@ -707,7 +707,7 @@ namespace FrontendWebApi.ApiControllers
SELECT SELECT
floor_guid,full_name,building_tag floor_guid,full_name,building_tag
FROM floor FROM floor
where building_tag = @building_tag and deleted = 0"; where building_tag = @building_tag and deleted = 0 order by priority";
var floor = await backendRepository.GetAllAsync<Floor>(sWhere, new { building_tag = building_tag }); var floor = await backendRepository.GetAllAsync<Floor>(sWhere, new { building_tag = building_tag });
apiResult.Data = floor; apiResult.Data = floor;

View File

@ -53,6 +53,12 @@ namespace FrontendWebApi.ApiControllers
apiResult.Msg = "表單類別錯誤"; apiResult.Msg = "表單類別錯誤";
return BadRequest(apiResult); return BadRequest(apiResult);
} }
else if (input.floor_tag.Count == 0)
{
apiResult.Code = "0000";
apiResult.Data = new List<HydroMeterOutput>() { };
return Ok(apiResult);
}
try try
{ {
@ -172,6 +178,12 @@ namespace FrontendWebApi.ApiControllers
apiResult.Msg = "表單類別錯誤"; apiResult.Msg = "表單類別錯誤";
return BadRequest(apiResult); return BadRequest(apiResult);
} }
else if (input.floor_tag.Count == 0)
{
apiResult.Code = "0000";
apiResult.Data = new List<HydroMeterOutput>() { };
return Ok(apiResult);
}
try try
{ {
@ -282,7 +294,7 @@ namespace FrontendWebApi.ApiControllers
try try
{ {
apiResult.Code = "0000"; apiResult.Code = "0000";
apiResult.Data = await backendRepository.GetOneAsync<decimal>($@"select system_value from variable where system_type = {input.type}Price and deleted = 0"); apiResult.Data = await backendRepository.GetOneAsync<decimal>($@"select system_value from variable where system_type = '{input.type}Price' and deleted = 0");
} }
catch (Exception exception) catch (Exception exception)
{ {