IDepartmentRepository.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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<DepartmentResult>> 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<DepartmentResult>> GetDepartmentById(int id, List<DepartmentResult> 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. /// <returns></returns>
  81. Task<List<DepartmentTreeResult>> GetAllDepartmentAsync();
  82. /// <summary>
  83. /// 获取所用下级部门
  84. /// </summary>
  85. /// <param name="id"></param>
  86. /// <param name="departments"></param>
  87. /// <returns></returns>
  88. Task<List<Department>> GetDepartmentByPid(int Pid, List<Department> departments, List<Department> allDepartments);
  89. Task<IEnumerable<Entity.Department>> GetUserInDepartmentAsync(List<int> departmentIds);
  90. }
  91. }