IDepartmentRepository.cs 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. using System.Collections.Generic;
  2. using System.Threading.Tasks;
  3. using GxPress.Entity;
  4. using GxPress.Request.Department;
  5. using GxPress.Result.Department;
  6. using Datory;
  7. namespace GxPress.Repository.Interface
  8. {
  9. public interface IDepartmentRepository : IRepository
  10. {
  11. Task<bool> ExistsChildrenAsync(int parentId);
  12. Task<Department> GetAsync(int id);
  13. Task<Department> GetAsync(string name);
  14. Task<string> GetNameAsync(int id);
  15. Task<int> InsertAsync(Department department);
  16. Task<bool> UpdateAsync(Department department);
  17. Task<IEnumerable<Department>> GetListAsync(int parentId);
  18. /// <summary>
  19. /// 添加
  20. /// </summary>
  21. /// <param name="request"></param>
  22. /// <returns></returns>
  23. Task<Department> AddAsync(Department request);
  24. /// <summary>
  25. /// 删除
  26. /// </summary>
  27. /// <param name="id"></param>
  28. /// <returns></returns>
  29. Task<bool> DeleteAsync(int id);
  30. /// <summary>
  31. /// 删除
  32. /// </summary>
  33. /// <param name="query"></param>
  34. /// <returns></returns>
  35. Task<bool> DeleteAsync(SqlKata.Query query);
  36. /// <summary>
  37. /// 更新
  38. /// </summary>
  39. /// <param name="id"></param>
  40. /// <param name="request"></param>
  41. /// <returns></returns>
  42. Task<bool> UpdateAsync(int id, Department request);
  43. /// <summary>
  44. /// 获取树列表
  45. /// </summary>
  46. /// <param name="id"></param>
  47. /// <returns></returns>
  48. Task<List<DepartmentTreeResult>> GetTreeAsync(int id);
  49. /// <summary>
  50. /// 根据部门ID获取成员以及下级部门
  51. /// </summary>
  52. /// <param name="request"></param>
  53. /// <returns></returns>
  54. Task<DepartmentUserResult> GetDepartmentUserResultAsync(DepartmentUserRequest request);
  55. /// <summary>
  56. /// 根据PID获取所用部门
  57. /// </summary>
  58. /// <param name="id"></param>
  59. /// <param name="departments"></param>
  60. /// <returns></returns>
  61. /// <summary>
  62. /// 获取所用下级部门
  63. /// </summary>
  64. /// <param name="id"></param>
  65. /// <param name="departments"></param>
  66. /// <returns></returns>
  67. Task<List<Department>> GetDepartmentById(int id, List<Department> departments);
  68. Task<string> GetDepartmentFullPathAsync(int departmentId, string departmentName);
  69. /// <summary>
  70. /// 获取所用下级部门
  71. /// </summary>
  72. /// <param name="id"></param>
  73. /// <param name="departments"></param>
  74. /// <returns></returns>
  75. Task<List<Department>> GetDepartmentByPid(int Pid, List<Department> departments);
  76. Task<IEnumerable<Department>> GetAllAsync(SqlKata.Query query);
  77. /// <summary>
  78. /// 获取树列表
  79. /// </summary>
  80. /// <param name="id"></param>
  81. /// <returns></returns>
  82. Task<List<DepartmentTreeResult>> GetTreeAsync();
  83. }
  84. }