DocumentController.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. using System;
  2. using System.Threading.Tasks;
  3. using Microsoft.AspNetCore.Mvc;
  4. using Admin.Core.Model.Output;
  5. using Admin.Core.Service.Admin.Document;
  6. using Admin.Core.Service.Admin.Document.Input;
  7. namespace Admin.Core.Controllers.Admin
  8. {
  9. /// <summary>
  10. /// 文档管理
  11. /// </summary>
  12. public class DocumentController : AreaController
  13. {
  14. private readonly IDocumentService _documentServices;
  15. public DocumentController(IDocumentService documentServices)
  16. {
  17. _documentServices = documentServices;
  18. }
  19. /// <summary>
  20. /// 查询文档列表
  21. /// </summary>
  22. /// <param name="key"></param>
  23. /// <param name="start"></param>
  24. /// <param name="end"></param>
  25. /// <returns></returns>
  26. [HttpGet]
  27. public async Task<IResponseOutput> GetList(string key, DateTime? start, DateTime? end)
  28. {
  29. return await _documentServices.GetListAsync(key,start,end);
  30. }
  31. /// <summary>
  32. /// 查询单条分组
  33. /// </summary>
  34. /// <param name="id"></param>
  35. /// <returns></returns>
  36. [HttpGet]
  37. public async Task<IResponseOutput> GetGroup(long id)
  38. {
  39. return await _documentServices.GetGroupAsync(id);
  40. }
  41. /// <summary>
  42. /// 查询单条菜单
  43. /// </summary>
  44. /// <param name="id"></param>
  45. /// <returns></returns>
  46. [HttpGet]
  47. public async Task<IResponseOutput> GetMenu(long id)
  48. {
  49. return await _documentServices.GetMenuAsync(id);
  50. }
  51. /// <summary>
  52. /// 查询单条文档内容
  53. /// </summary>
  54. /// <param name="id"></param>
  55. /// <returns></returns>
  56. [HttpGet]
  57. public async Task<IResponseOutput> GetContent(long id)
  58. {
  59. return await _documentServices.GetContentAsync(id);
  60. }
  61. /// <summary>
  62. /// 查询精简文档列表
  63. /// </summary>
  64. /// <returns></returns>
  65. [HttpGet]
  66. public async Task<IResponseOutput> GetPlainList()
  67. {
  68. return await _documentServices.GetPlainListAsync();
  69. }
  70. /// <summary>
  71. /// 新增分组
  72. /// </summary>
  73. /// <param name="input"></param>
  74. /// <returns></returns>
  75. [HttpPost]
  76. public async Task<IResponseOutput> AddGroup(DocumentAddGroupInput input)
  77. {
  78. return await _documentServices.AddGroupAsync(input);
  79. }
  80. /// <summary>
  81. /// 新增菜单
  82. /// </summary>
  83. /// <param name="input"></param>
  84. /// <returns></returns>
  85. [HttpPost]
  86. public async Task<IResponseOutput> AddMenu(DocumentAddMenuInput input)
  87. {
  88. return await _documentServices.AddMenuAsync(input);
  89. }
  90. /// <summary>
  91. /// 修改分组
  92. /// </summary>
  93. /// <param name="input"></param>
  94. /// <returns></returns>
  95. [HttpPut]
  96. public async Task<IResponseOutput> UpdateGroup(DocumentUpdateGroupInput input)
  97. {
  98. return await _documentServices.UpdateGroupAsync(input);
  99. }
  100. /// <summary>
  101. /// 修改菜单
  102. /// </summary>
  103. /// <param name="input"></param>
  104. /// <returns></returns>
  105. [HttpPut]
  106. public async Task<IResponseOutput> UpdateMenu(DocumentUpdateMenuInput input)
  107. {
  108. return await _documentServices.UpdateMenuAsync(input);
  109. }
  110. /// <summary>
  111. /// 修改文档内容
  112. /// </summary>
  113. /// <param name="input"></param>
  114. /// <returns></returns>
  115. [HttpPut]
  116. public async Task<IResponseOutput> UpdateContent(DocumentUpdateContentInput input)
  117. {
  118. return await _documentServices.UpdateContentAsync(input);
  119. }
  120. /// <summary>
  121. /// 删除文档
  122. /// </summary>
  123. /// <param name="id"></param>
  124. /// <returns></returns>
  125. [HttpDelete]
  126. public async Task<IResponseOutput> SoftDelete(long id)
  127. {
  128. return await _documentServices.SoftDeleteAsync(id);
  129. }
  130. }
  131. }