[FE API] 新增校區,回傳有哪些校區
This commit is contained in:
parent
6dca8ee11b
commit
716ecde2af
@ -296,7 +296,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
|
||||
try
|
||||
{
|
||||
var sqlString = $@"select b.building_tag, b.full_name, b.urn_3D, b.forge_light_group, SUBSTRING_INDEX(v.system_value, '/', 1) as getway
|
||||
var sqlString = $@"select b.building_tag, b.full_name, b.urn_3D, b.forge_light_group, b.school_zone, SUBSTRING_INDEX(v.system_value, '/', 1) as getway
|
||||
from building b
|
||||
left join variable v on v.system_key = b.building_tag and v.system_type = 'dashboard_total_elec'
|
||||
where b.deleted = 0 order by b.priority;";
|
||||
@ -315,6 +315,38 @@ namespace FrontendWebApi.ApiControllers
|
||||
return Ok(apiResult);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 校區種類
|
||||
/// </summary>
|
||||
/// <param name="account"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("api/Device/GetSchoolZone")]
|
||||
public async Task<ActionResult<ApiResult<List<SchoolZoneList>>>> GetSchoolZone()
|
||||
{
|
||||
ApiResult<List<SchoolZoneList>> apiResult = new ApiResult<List<SchoolZoneList>>();
|
||||
|
||||
try
|
||||
{
|
||||
var sqlString = $@"select system_key, system_value from variable
|
||||
where system_type = 'school_zone_type';";
|
||||
var bl = await backendRepository.GetAllAsync<SchoolZoneList>(sqlString);
|
||||
|
||||
Console.WriteLine(bl);
|
||||
|
||||
apiResult.Code = "0000";
|
||||
apiResult.Data = bl;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
apiResult.Code = "9999";
|
||||
apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||
return Ok(apiResult);
|
||||
}
|
||||
return Ok(apiResult);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 樓層列表
|
||||
/// </summary>
|
||||
|
@ -23,8 +23,14 @@ namespace FrontendWebApi.Models
|
||||
/// 0single_1group;燈控是否為群控/單獨(個別燈具)控制
|
||||
/// </summary>
|
||||
public Int16 forge_light_group { get; set; }
|
||||
public string school_zone { get; set; }
|
||||
public string getway { get; set; }
|
||||
}
|
||||
public class SchoolZoneList
|
||||
{
|
||||
public string system_key { get; set; }
|
||||
public string system_value { get; set; }
|
||||
}
|
||||
|
||||
public class FloorList
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user