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/Dtos/Classification_Submit_Dto.cs | 22 +++++++
DocumentServiceAPI.Application/DocManage/Services/DocumentManageService.cs | 11 +--
DocumentServiceAPI.Application/DocManage/DocManageAppService.cs | 96 ++++++++++++++++++++++++--------
DocumentServiceAPI.Utility/PageBaseSearch.cs | 5 -
DocumentServiceAPI.Application/DocumentServiceAPI.Application.csproj | 1
5 files changed, 99 insertions(+), 36 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);
}
}
}
diff --git a/DocumentServiceAPI.Application/DocManage/Dtos/Classification_Submit_Dto.cs b/DocumentServiceAPI.Application/DocManage/Dtos/Classification_Submit_Dto.cs
new file mode 100644
index 0000000..cfd30fd
--- /dev/null
+++ b/DocumentServiceAPI.Application/DocManage/Dtos/Classification_Submit_Dto.cs
@@ -0,0 +1,22 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DocumentServiceAPI.Application.DocManage.Dtos
+{
+ public class Classification_Submit_Dto
+ {
+ public int id { get; set; }
+
+ public string name { get; set; }
+
+ /// <summary>
+ /// 鐖剁骇缂栫爜
+ /// </summary>
+ public string code { get; set; }
+
+ public int status { get; set; }
+ }
+}
diff --git a/DocumentServiceAPI.Application/DocManage/Services/DocumentManageService.cs b/DocumentServiceAPI.Application/DocManage/Services/DocumentManageService.cs
index 8a1e5f1..675d4d3 100644
--- a/DocumentServiceAPI.Application/DocManage/Services/DocumentManageService.cs
+++ b/DocumentServiceAPI.Application/DocManage/Services/DocumentManageService.cs
@@ -1,12 +1,6 @@
锘縰sing DocumentServiceAPI.Core;
-using DocumentServiceAPI.Model;
using DocumentServiceAPI.Model.cyDocumentModel;
using DocumentServiceAPI.Utility;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace DocumentServiceAPI.Application.DocManage.Services
{
@@ -16,6 +10,11 @@
/// 鍒嗙被浠g爜
/// </summary>
public string Code { get; set; }
+
+ /// <summary>
+ /// 鐘舵��
+ /// </summary>
+ public int? Status { get; set; }
}
/// <summary>
diff --git a/DocumentServiceAPI.Application/DocumentServiceAPI.Application.csproj b/DocumentServiceAPI.Application/DocumentServiceAPI.Application.csproj
index df6912c..a44c6d5 100644
--- a/DocumentServiceAPI.Application/DocumentServiceAPI.Application.csproj
+++ b/DocumentServiceAPI.Application/DocumentServiceAPI.Application.csproj
@@ -29,7 +29,6 @@
</ItemGroup>
<ItemGroup>
- <Folder Include="DocManage\Dtos\" />
<Folder Include="GlobalServices\" />
</ItemGroup>
diff --git a/DocumentServiceAPI.Utility/PageBaseSearch.cs b/DocumentServiceAPI.Utility/PageBaseSearch.cs
index 120752f..6411526 100644
--- a/DocumentServiceAPI.Utility/PageBaseSearch.cs
+++ b/DocumentServiceAPI.Utility/PageBaseSearch.cs
@@ -49,11 +49,6 @@
public int PageSize { get; set; }
/// <summary>
- /// 椤垫�绘暟
- /// </summary>
- public int TotalPage { get; set; }
-
- /// <summary>
/// 璁板綍鎬绘暟
/// </summary>
public int TotalCount { get; set; }
--
Gitblit v1.9.1