From ba230615ede7ae34b90ff1c22399daa28f184b50 Mon Sep 17 00:00:00 2001 From: qwj <qwjzorro@163.com> Date: 星期三, 09 八月 2023 14:06:01 +0800 Subject: [PATCH] 资料分类维护数据接口 --- DocumentServiceAPI.Application/DocManage/DocManageAppService.cs | 96 ++++++++++++++++++++++++++++++++++++------------ 1 files changed, 72 insertions(+), 24 deletions(-) diff --git a/DocumentServiceAPI.Application/DocManage/DocManageAppService.cs b/DocumentServiceAPI.Application/DocManage/DocManageAppService.cs index 05ad3f6..f09fa68 100644 --- a/DocumentServiceAPI.Application/DocManage/DocManageAppService.cs +++ b/DocumentServiceAPI.Application/DocManage/DocManageAppService.cs @@ -1,17 +1,13 @@ -锘縰sing DocumentServiceAPI.Application.System.Services; -using DocumentServiceAPI.Application.System; -using DocumentServiceAPI.Utility; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +锘縰sing DocumentServiceAPI.Application.DocManage.Dtos; using DocumentServiceAPI.Application.DocManage.Services; -using DocumentServiceAPI.Model; using DocumentServiceAPI.Model.cyDocumentModel; +using DocumentServiceAPI.Utility; namespace DocumentServiceAPI.Application.DocManage { + /// <summary> + /// 璧勬枡鍒嗙被绠$悊 + /// </summary> public class DocManageAppService : IDynamicApiController { private readonly DocClassificationService _classificationService; @@ -21,42 +17,94 @@ _classificationService = classificationService; } - public IActionResult GetInfo() + /// <summary> + /// 鏍规嵁ID鏌ヨ瀵硅薄 + /// </summary> + /// <param name="id"></param> + /// <returns></returns> + public async Task<IActionResult> GetInfo(int id) { - var person = _classificationService.GetList(); - return new JsonResult(person); + var model =await _classificationService.GetByIdAsync(id); + return new JsonResult(model); } - public IActionResult PostListPage(DocClassificationPageSearch page) + /// <summary> + /// 鏍规嵁鍒嗛〉鏉′欢鏌ヨ鍒嗛〉鏁版嵁 + /// </summary> + /// <param name="page"></param> + /// <returns></returns> + public async Task<IActionResult> PostListPage(DocClassificationPageSearch page) { PageModel pg = new PageModel(); pg.PageSize = page.PageSize; pg.PageIndex = page.PageIndex; PageResult<Doc_Classification> result = new PageResult<Doc_Classification>(); - result.Items = _classificationService.GetPageListAsync(c => c.parent_code==page.Code, pg).Result; + if (page.Status.HasValue) + { + result.Items = await _classificationService.GetPageListAsync(c => c.status ==page.Status && c.parent_code == page.Code, pg); + } + else + { + result.Items = await _classificationService.GetPageListAsync(c => c.parent_code == page.Code, pg); + } result.TotalCount = pg.TotalCount; - + result.PageIndex = pg.PageIndex; + result.PageSize = pg.PageSize; return new JsonResult(result); } - public IActionResult PostAddTest(Doc_Classification info) + /// <summary> + /// 娣诲姞鏁版嵁 + /// </summary> + /// <param name="info"></param> + /// <returns></returns> + public async Task<IActionResult> PostAddInfo(Classification_Submit_Dto info) { - var person = _classificationService.InsertAsync(info); - return new JsonResult(person.Result); + Doc_Classification doc = new Doc_Classification(); + doc.add_time = DateTime.Now; + doc.doc_classification = info.name; + doc.doc_classification_code = ""; + doc.is_system = false; + doc.parent_code = info.code; + doc.sort_id = 99; + doc.status = info.status; + doc.tenant_code = ""; + + var msg =await _classificationService.InsertAsync(doc); + return new JsonResult(msg); } - public IActionResult PostEdtTest(Doc_Classification info) + /// <summary> + /// 淇敼鏁版嵁 + /// </summary> + /// <param name="info"></param> + /// <returns></returns> + public async Task<IActionResult> PostEdtInfo(Classification_Submit_Dto info) { + var msg = false; + var model = await _classificationService.GetByIdAsync(info.id); + if (model != null) + { + model.add_time = DateTime.Now; + model.doc_classification = info.name; + model.status = info.status; - var person = _classificationService.UpdateAsync(info); - return new JsonResult(person.Result); + msg = await _classificationService.UpdateAsync(model); + } + + return new JsonResult(msg); } - public IActionResult PostDelTest(int id) + /// <summary> + /// 鍒犻櫎鏁版嵁 + /// </summary> + /// <param name="id"></param> + /// <returns></returns> + public async Task<IActionResult> PostDelInfo(int id) { - var person = _classificationService.DeleteByIdAsync(id); - return new JsonResult(person.Result); + var msg = await _classificationService.DeleteByIdAsync(id); + return new JsonResult(msg); } } } -- Gitblit v1.9.1