From 217519732242a41d4421dd644e9c83ff9af2722a Mon Sep 17 00:00:00 2001 From: liaoxujun@qq.com <liaoxujun@qq.com> Date: 星期四, 10 八月 2023 08:58:09 +0800 Subject: [PATCH] no message --- DocumentServiceAPI.Application/DocManage/DocManageAppService.cs | 110 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 110 insertions(+), 0 deletions(-) diff --git a/DocumentServiceAPI.Application/DocManage/DocManageAppService.cs b/DocumentServiceAPI.Application/DocManage/DocManageAppService.cs new file mode 100644 index 0000000..f09fa68 --- /dev/null +++ b/DocumentServiceAPI.Application/DocManage/DocManageAppService.cs @@ -0,0 +1,110 @@ +锘縰sing DocumentServiceAPI.Application.DocManage.Dtos; +using DocumentServiceAPI.Application.DocManage.Services; +using DocumentServiceAPI.Model.cyDocumentModel; +using DocumentServiceAPI.Utility; + +namespace DocumentServiceAPI.Application.DocManage +{ + /// <summary> + /// 璧勬枡鍒嗙被绠$悊 + /// </summary> + public class DocManageAppService : IDynamicApiController + { + private readonly DocClassificationService _classificationService; + + public DocManageAppService(DocClassificationService classificationService) + { + _classificationService = classificationService; + } + + /// <summary> + /// 鏍规嵁ID鏌ヨ瀵硅薄 + /// </summary> + /// <param name="id"></param> + /// <returns></returns> + public async Task<IActionResult> GetInfo(int id) + { + var model =await _classificationService.GetByIdAsync(id); + return new JsonResult(model); + } + + /// <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>(); + 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); + } + + /// <summary> + /// 娣诲姞鏁版嵁 + /// </summary> + /// <param name="info"></param> + /// <returns></returns> + public async Task<IActionResult> PostAddInfo(Classification_Submit_Dto info) + { + 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); + } + + /// <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; + + msg = await _classificationService.UpdateAsync(model); + } + + return new JsonResult(msg); + } + + /// <summary> + /// 鍒犻櫎鏁版嵁 + /// </summary> + /// <param name="id"></param> + /// <returns></returns> + public async Task<IActionResult> PostDelInfo(int id) + { + var msg = await _classificationService.DeleteByIdAsync(id); + return new JsonResult(msg); + } + } +} -- Gitblit v1.9.1