| | |
| | | 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; |
| | |
| | | _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); |
| | | } |
| | | |
| | | public IActionResult PostDelTest(int id) |
| | | return new JsonResult(msg); |
| | | } |
| | | |
| | | /// <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); |
| | | } |
| | | } |
| | | } |