From 4149aab54266709599e769846e694c5926abfc52 Mon Sep 17 00:00:00 2001 From: dev02 Date: Wed, 9 Nov 2022 10:22:20 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0frombody=20accept=20param?= =?UTF-8?q?eter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ApiControllers/AlertController.cs | 4 ++-- .../ApiControllers/OperationController.cs | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/FrontendWebApi/ApiControllers/AlertController.cs b/FrontendWebApi/ApiControllers/AlertController.cs index 510b35c..5f752fa 100644 --- a/FrontendWebApi/ApiControllers/AlertController.cs +++ b/FrontendWebApi/ApiControllers/AlertController.cs @@ -25,7 +25,7 @@ namespace FrontendWebApi.ApiControllers } [HttpPost] - public FileResult OpeExportExcel(List alerts) + public FileResult OpeExportExcel([FromBody] List alerts) { var workbook = new XSSFWorkbook(); #region excel設定 @@ -169,7 +169,7 @@ namespace FrontendWebApi.ApiControllers } [HttpPost] - public async Task>> AlertList(List alerts) + public async Task>> AlertList([FromBody] List alerts) { ApiResult> apiResult = new ApiResult>(); try diff --git a/FrontendWebApi/ApiControllers/OperationController.cs b/FrontendWebApi/ApiControllers/OperationController.cs index 113a99e..445851c 100644 --- a/FrontendWebApi/ApiControllers/OperationController.cs +++ b/FrontendWebApi/ApiControllers/OperationController.cs @@ -65,7 +65,7 @@ namespace FrontendWebApi.ApiControllers } [HttpPost] - public async Task>> SubSysList(string main_system_tag) + public async Task>> SubSysList([FromBody] string main_system_tag) { ApiResult> apiResult = new ApiResult>(); List sub_system_list = new List(); @@ -133,7 +133,7 @@ namespace FrontendWebApi.ApiControllers /// /// [HttpPost] - public async Task>> DevList(BuildingList bl) + public async Task>> DevList([FromBody] BuildingList bl) { ApiResult> apiResult = new ApiResult>(); List d = new List(); @@ -165,7 +165,7 @@ namespace FrontendWebApi.ApiControllers /// /// [HttpPost] - public FileResult OpeExportExcel(byte? work_type) + public FileResult OpeExportExcel([FromBody] byte? work_type) { var workbook = new XSSFWorkbook(); #region excel設定 @@ -587,7 +587,7 @@ namespace FrontendWebApi.ApiControllers /// /// /// - public async Task>> OpeFirList(OperationFindList ofl) + public async Task>> OpeFirList([FromBody] OperationFindList ofl) { ApiResult> apiResult = new ApiResult>(); List opList = new List(); @@ -648,7 +648,7 @@ namespace FrontendWebApi.ApiControllers /// /// /// - public async Task> SaveOpeFirm(Operation_Firm of) + public async Task> SaveOpeFirm([FromBody] Operation_Firm of) { ApiResult apiResult = new ApiResult(); @@ -702,7 +702,7 @@ namespace FrontendWebApi.ApiControllers /// /// /// - public async Task> EdtOneOpeFirm(Operation_Firm of) + public async Task> EdtOneOpeFirm([FromBody] Operation_Firm of) { ApiResult apiResult = new ApiResult(); @@ -767,7 +767,7 @@ namespace FrontendWebApi.ApiControllers /// /// /// - public async Task>> OpeRecList(OperationFindList ofl) + public async Task>> OpeRecList([FromBody] OperationFindList ofl) { ApiResult> apiResult = new ApiResult>(); List orl = new List(); @@ -845,7 +845,7 @@ namespace FrontendWebApi.ApiControllers /// /// /// - public async Task> SavOpeRecord(Operation_Record or) + public async Task> SavOpeRecord([FromBody] Operation_Record or) { ApiResult apiResult = new ApiResult(); @@ -1012,7 +1012,7 @@ namespace FrontendWebApi.ApiControllers /// /// /// - public async Task> DelOpeRecord(Operation_Record or) + public async Task> DelOpeRecord([FromBody] Operation_Record or) { ApiResult apiResult = new ApiResult(); From 51f6b553f77eab49e7f79c070dd1ee536f276d3f Mon Sep 17 00:00:00 2001 From: dev02 Date: Wed, 9 Nov 2022 11:05:33 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9graph=5Fmanage=20modal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FrontendWebApi/ApiControllers/GraphManageController.cs | 8 ++++++-- FrontendWebApi/Models/GraphManage.cs | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/FrontendWebApi/ApiControllers/GraphManageController.cs b/FrontendWebApi/ApiControllers/GraphManageController.cs index aa62a28..ed7d9b8 100644 --- a/FrontendWebApi/ApiControllers/GraphManageController.cs +++ b/FrontendWebApi/ApiControllers/GraphManageController.cs @@ -140,9 +140,9 @@ namespace FrontendWebApi.ApiControllers try { - var sqlString = @$"UPDATE graph_manage SET deleted = 1 WHERE code = @code AND sub_system_tag = @sub_system_tag AND main_system_tag = @main_system_tag"; + var sqlString = @$"UPDATE graph_manage SET deleted = 1, updated_at = @time, updated_by = @user WHERE code = @code AND sub_system_tag = @sub_system_tag AND main_system_tag = @main_system_tag"; - var param = new { @code = gi.code, @sub_system_tag = gi.sub_system_tag, @main_system_tag = gi.main_system_tag }; + var param = new { @code = gi.code, @sub_system_tag = gi.sub_system_tag, @main_system_tag = gi.main_system_tag, @time = DateTime.Now, @user = myUser.userinfo_guid }; await backendRepository.ExecuteSql(sqlString, param); apiResult.Code = "0000"; @@ -229,6 +229,8 @@ namespace FrontendWebApi.ApiControllers graph_manage.Add("@name", gii.name); graph_manage.Add("@main_system_tag", gii.main_system_tag); graph_manage.Add("@sub_system_tag", gii.sub_system_tag); + graph_manage.Add("@updated_at", DateTime.Now); + graph_manage.Add("@updated_by", myUser.userinfo_guid); //graph_manage.Add("@priority", gii.priority); await backendRepository.UpdateOneByCustomTable(graph_manage, "graph_manage", "code='" + gm.code + "'" + " and sub_system_tag ='" + gm.sub_system_tag + "' and main_system_tag = '" + gm.main_system_tag + "'"); @@ -313,6 +315,8 @@ namespace FrontendWebApi.ApiControllers graph_manage.Add("@name", gii.name); graph_manage.Add("@deleted", 0); graph_manage.Add("@priority", newPriority + 1); + graph_manage.Add("@created_by", myUser.userinfo_guid ); + graph_manage.Add("@created_at", DateTime.Now); await backendRepository.AddOneByCustomTable(graph_manage, "graph_manage"); apiResult.Code = "0000"; diff --git a/FrontendWebApi/Models/GraphManage.cs b/FrontendWebApi/Models/GraphManage.cs index 950bca0..2a39fd5 100644 --- a/FrontendWebApi/Models/GraphManage.cs +++ b/FrontendWebApi/Models/GraphManage.cs @@ -33,7 +33,7 @@ namespace FrontendWebApi.Models public IFormFile donFile { get; set; } } - public class GraphInfo + public class GraphInfo: Actor { public string code { get; set; } public string main_system_tag { get; set; }