diff --git a/FrontendWebApi/ApiControllers/GraphManageController.cs b/FrontendWebApi/ApiControllers/GraphManageController.cs index e22bb18..7d66318 100644 --- a/FrontendWebApi/ApiControllers/GraphManageController.cs +++ b/FrontendWebApi/ApiControllers/GraphManageController.cs @@ -90,6 +90,7 @@ namespace FrontendWebApi.ApiControllers return apiResult; } + [HttpPost] public async Task>> GraManList([FromBody] GraphInfo gi) { @@ -133,6 +134,44 @@ namespace FrontendWebApi.ApiControllers return apiResult; } + [HttpPost] + public async Task> GraManRead([FromBody] GraphInfo gi) + { + ApiResult apiResult = new ApiResult(); + GraphList graManList = new GraphList(); + try + { + var sqlString = @$"SELECT * + FROM graph_manage gm + JOIN variable v1 ON v1.system_value = @main_system_tag and v1.system_type = @graph_manage_layer1 and v1.deleted = 0 + JOIN variable v2 ON v1.id = v2.system_parent_id AND v2.system_type = @graph_manage_layer2 AND v2.deleted = 0 + WHERE v2.system_value = @sub_system_tag AND gm.deleted = 0 AND gm.code = @code + ORDER BY gm.priority, gm.created_at desc"; + + var param = new { @graph_manage_layer1 = graph_manage_layer1, graph_manage_layer2 = graph_manage_layer2, @sub_system_tag = gi.sub_system_tag, @main_system_tag = gi.main_system_tag, @code = gi.code }; + + graManList = await backendRepository.GetOneAsync(sqlString, param); + + if (graManList == null) + { + apiResult.Code = "0002"; + apiResult.Msg = "找不到圖資"; + return apiResult; + } + + apiResult.Code = "0000"; + apiResult.Data = graManList; + } + catch (Exception exception) + { + apiResult.Code = "9999"; + apiResult.Msg = "系統內部錯誤,請聯絡管理者。"; + Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); + } + + return apiResult; + } + [HttpPost] public async Task> DelOneGraMan([FromBody] GraphInfo gi) {