This commit is contained in:
dev02 2023-03-28 15:26:15 +08:00
commit 27e8019b8f
2 changed files with 25 additions and 3 deletions

View File

@ -910,7 +910,7 @@ namespace FrontendWebApi.ApiControllers
} }
/// <summary> /// <summary>
/// 樓層列表 /// input user 所選樓層,回傳樓上那層,如果是頂樓 則回自己
/// </summary> /// </summary>
/// <param name="account"></param> /// <param name="account"></param>
/// <returns></returns> /// <returns></returns>
@ -934,8 +934,28 @@ namespace FrontendWebApi.ApiControllers
// 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))
// 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 sqlString = $@" SELECT * FROM floor WHERE floor_guid = @floor_guid;"; //找出同一棟 User 所選的上一樓(要拿掉天花板),如已經是頂樓則回傳自己
var param = new { @floor_guid = f.floor_guid }; var sqlString = $@"select * from
(
SELECT * FROM floor --
where building_tag = @building_tag and priority > (
select priority from floor
where building_tag = @building_tag and floor_guid = @floor_guid
)
order by priority limit 1
)a
union
select * from
(
SELECT * FROM floor --
where building_tag = @building_tag and priority >= (
select priority from floor
where building_tag = @building_tag and floor_guid = @floor_guid
)
order by priority limit 1
)b
order by priority desc limit 1 ";
var param = new { @building_tag = f.building_tag, @floor_guid = f.floor_guid };
var fr = await backendRepository.GetOneAsync<Floor>(sqlString, param); var fr = await backendRepository.GetOneAsync<Floor>(sqlString, param);
apiResult.Code = "0000"; apiResult.Code = "0000";

View File

@ -115,6 +115,8 @@ namespace FrontendWebApi.Models
public class Floor public class Floor
{ {
public string floor_guid { get; set; } public string floor_guid { get; set; }
public string building_tag { get; set; }
public string full_name { get; set; } public string full_name { get; set; }
public string InitMapName { get; set; } public string InitMapName { get; set; }
public string Floor_map_name { get; set; } public string Floor_map_name { get; set; }