NoticeFolderController.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. using System.Collections.Generic;
  2. using System.Threading.Tasks;
  3. using GxPress.Auth;
  4. using GxPress.Repository.Interface;
  5. using GxPress.Request.App.Middle;
  6. using GxPress.Request.NoticeFolder;
  7. using GxPress.Result.NoticeFolder;
  8. using GxPress.Service.Interface.Middle;
  9. using Microsoft.AspNetCore.Mvc;
  10. namespace GxPress.Api.AppControllers
  11. {
  12. /// <summary>
  13. /// 通知文件夹
  14. /// </summary>
  15. [Route("api/app/notice-folder")]
  16. [ApiController]
  17. public class NoticeFolderController : ControllerBase
  18. {
  19. private readonly INoticeFolderRepository _noticeFolderRepository;
  20. private readonly ILoginContext _loginContext;
  21. private readonly IMiddleService _middleService;
  22. public NoticeFolderController(INoticeFolderRepository noticeFolderRepository, ILoginContext loginContext,
  23. IMiddleService middleService)
  24. {
  25. _noticeFolderRepository = noticeFolderRepository;
  26. _loginContext = loginContext;
  27. _middleService = middleService;
  28. }
  29. /// <summary>
  30. /// 创建通知文件夹
  31. /// </summary>
  32. /// <param name="request"></param>
  33. /// <returns></returns>
  34. [HttpPut("add")]
  35. public async Task<bool> Insert(NoticeFolderInRequest request)
  36. {
  37. request.UserId = _loginContext.AccountId;
  38. var middleInsertRequest = new MiddleInsertRequest
  39. {
  40. FolderName = request.FolderName,
  41. FolderType = 1,
  42. ParentId = request.ParentId,
  43. UserId = request.UserId
  44. };
  45. return await _middleService.InsertAsync(middleInsertRequest) > 0;
  46. }
  47. ///// <summary>
  48. ///// 删除通知文件夹
  49. ///// </summary>
  50. ///// <param name="id"></param>
  51. ///// <returns></returns>
  52. //[HttpDelete("{id}")]
  53. //public async Task<bool> Delete(int id)
  54. //{
  55. // return await _noticeFolderRepository.DeleteAsync(id);
  56. //}
  57. ///// <summary>
  58. ///// 修改通知文件夹
  59. ///// </summary>
  60. ///// <param name="request"></param>
  61. ///// <returns></returns>
  62. //[HttpPost("update")]
  63. //public async Task<bool> Update(NoticeFolderUpRequest request)
  64. //{
  65. // return await _noticeFolderRepository.UpdateAsync(request);
  66. //}
  67. ///// <summary>
  68. ///// 插入通知文件夹
  69. ///// </summary>
  70. ///// <param name="request"></param>
  71. ///// <returns></returns>
  72. //[HttpPost("add-notice")]
  73. //public async Task<bool> InsertNotice(NoticeFolderInNoticeRequest request)
  74. //{
  75. // return await _noticeFolderRepository.InsertNoticeAsync(request);
  76. //}
  77. ///// <summary>
  78. ///// 文件夹移除通知
  79. ///// </summary>
  80. ///// <param name="request"></param>
  81. ///// <returns></returns>
  82. //[HttpPost("remove-notice")]
  83. //public async Task<bool> NoticeFolderDeleteNotice(NoticeFolderDeleteNoticeRequest request)
  84. //{
  85. // return await _noticeFolderRepository.NoticeFolderDeleteNoticeAsync(request);
  86. //}
  87. /// <summary>
  88. /// 获取通知文件夹
  89. /// </summary>
  90. /// <returns></returns>
  91. [HttpPost("find")]
  92. public async Task<IEnumerable<NoticeFolderFindResult>> GetNoticeFolderByUserId(NoticeFolderFindRequest request)
  93. {
  94. request.UserId = _loginContext.AccountId;
  95. return await _noticeFolderRepository.GetNoticeFolderByUserIdAsync(request);
  96. }
  97. ///// <summary>
  98. ///// 设置文件夹置顶
  99. ///// </summary>
  100. ///// <param name="request"></param>
  101. ///// <returns></returns>
  102. //[HttpPost("set-is-top")]
  103. //public async Task<bool> SetNoticeFolderIsTop(NoticeFolderFindRequest request)
  104. //{
  105. // return await _noticeFolderRepository.SetNoticeFolderIsTopAsync(request);
  106. //}
  107. }
  108. }