[FrontendWebApi] 取得不可視3D模型類型 API 建置
This commit is contained in:
parent
d3f3ff828e
commit
745ee1d474
@ -898,6 +898,52 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
var param = new { @main_system_tag = fdi.main_system_tag, @sub_system_tag = fdi.sub_system_tag, @points = fdi.points };
|
var param = new { @main_system_tag = fdi.main_system_tag, @sub_system_tag = fdi.sub_system_tag, @points = fdi.points };
|
||||||
var fr = await backendRepository.GetAllAsync<DeviceItemViewModel>(sqlString, param);
|
var fr = await backendRepository.GetAllAsync<DeviceItemViewModel>(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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 取得 Forge 3D 模型不可見的類型
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[Route("api/Device/GetForgeInvType")]
|
||||||
|
public async Task<ActionResult<ApiResult<List<DeviceItemViewModel>>>> GetForgeInvType([FromBody] string search_tag)
|
||||||
|
{
|
||||||
|
ApiResult<List<ForgeInvisible>> apiResult = new ApiResult<List<ForgeInvisible>>();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var sqlString = $@"SELECT
|
||||||
|
v1.system_key AS 'invisible_type',
|
||||||
|
v1.system_value AS 'invisible_value',
|
||||||
|
v2.system_value AS 'sub_system_tag'
|
||||||
|
FROM variable v1
|
||||||
|
LEFT JOIN variable v2 ON v2.id = v1.system_parent_id AND v2.deleted = '0'
|
||||||
|
WHERE
|
||||||
|
v1.deleted = '0'
|
||||||
|
AND v1.system_type = 'forge_3d_invisible_type'
|
||||||
|
AND (
|
||||||
|
(@isDef = true AND v1.system_key = 'default_value')
|
||||||
|
OR (@isDef = false AND v2.system_value = @sub_system_tag)
|
||||||
|
OR (@isDef = false AND @sub_system_tag IS NULL AND v1.system_key = 'default_value')
|
||||||
|
OR (@isDef = false AND @sub_system_tag IS NULL AND v2.system_value = v2.system_value)
|
||||||
|
)";
|
||||||
|
|
||||||
|
var param = new { sub_system_tag = search_tag == "forge_default" ? null : search_tag, isDef = search_tag == "forge_default" };
|
||||||
|
|
||||||
|
var fr = await backendRepository.GetAllAsync<ForgeInvisible>(sqlString, param);
|
||||||
|
|
||||||
|
|
||||||
apiResult.Code = "0000";
|
apiResult.Code = "0000";
|
||||||
apiResult.Data = fr;
|
apiResult.Data = fr;
|
||||||
}
|
}
|
||||||
|
@ -164,4 +164,14 @@ namespace FrontendWebApi.Models
|
|||||||
public string points { get; set; }
|
public string points { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ForgeInvisible
|
||||||
|
{
|
||||||
|
public string invisible_type { get; set; }
|
||||||
|
public string invisible_value { get; set; }
|
||||||
|
public string sub_system_tag { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user