qwj
2023-08-09 ba230615ede7ae34b90ff1c22399daa28f184b50
资料分类维护数据接口
4个文件已修改
1个文件已添加
135 ■■■■ 已修改文件
DocumentServiceAPI.Application/DocManage/DocManageAppService.cs 96 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Application/DocManage/Dtos/Classification_Submit_Dto.cs 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Application/DocManage/Services/DocumentManageService.cs 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Application/DocumentServiceAPI.Application.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Utility/PageBaseSearch.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DocumentServiceAPI.Application/DocManage/DocManageAppService.cs
@@ -1,17 +1,13 @@
using 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;
using 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);
        }
    }
}
DocumentServiceAPI.Application/DocManage/Dtos/Classification_Submit_Dto.cs
New file
@@ -0,0 +1,22 @@
using 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; }
    }
}
DocumentServiceAPI.Application/DocManage/Services/DocumentManageService.cs
@@ -1,12 +1,6 @@
using 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 @@
        /// 分类代码
        /// </summary>
        public string Code { get; set; }
        /// <summary>
        /// 状态
        /// </summary>
        public int? Status { get; set; }
    }
    /// <summary>
DocumentServiceAPI.Application/DocumentServiceAPI.Application.csproj
@@ -29,7 +29,6 @@
    </ItemGroup>
    <ItemGroup>
      <Folder Include="DocManage\Dtos\" />
      <Folder Include="GlobalServices\" />
    </ItemGroup>
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; }