平安校园
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ISysUserService.cs 8.9 KiB

4 kuukautta sitten
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. 
  2. //
  3. namespace SafeCampus.System;
  4. /// <summary>
  5. /// 用户服务
  6. /// </summary>
  7. public interface ISysUserService : ITransient
  8. {
  9. #region 查询
  10. /// <summary>
  11. /// 根据用户ID获取按钮ID集合
  12. /// </summary>
  13. /// <param name="userId"></param>
  14. /// <returns></returns>
  15. Task<List<string>> GetButtonCodeList(long userId);
  16. /// <summary>
  17. /// 根据账号获取用户信息
  18. /// </summary>
  19. /// <param name="account">用户名</param>
  20. /// <param name="tenantId">租户ID</param>
  21. /// <returns>用户信息</returns>
  22. Task<SysUser> GetUserByAccount(string account, long? tenantId = null);
  23. /// <summary>
  24. /// 根据用户ID和机构ID获取角色权限
  25. /// </summary>
  26. /// <param name="userId"></param>
  27. /// <param name="orgId"></param>
  28. /// <returns></returns>
  29. Task<List<DataScope>> GetPermissionListByUserId(long userId, long orgId);
  30. /// <summary>
  31. /// 根据手机号获取用户账号
  32. /// </summary>
  33. /// <param name="phone">手机号</param>
  34. /// <param name="tenantId">租户ID</param>
  35. /// <returns>用户账号名称</returns>
  36. Task<long> GetIdByPhone(string phone, long? tenantId = null);
  37. /// <summary>
  38. /// 用户选择器
  39. /// </summary>
  40. /// <param name="input">查询参数</param>
  41. /// <returns></returns>
  42. Task<SqlSugarPagedList<UserSelectorOutPut>> Selector(UserSelectorInput input);
  43. /// <summary>
  44. /// 用户分页查询
  45. /// </summary>
  46. /// <param name="input">查询参数</param>
  47. /// <returns>用户分页列表</returns>
  48. Task<SqlSugarPagedList<SysUser>> Page(UserPageInput input);
  49. /// <summary>
  50. /// 用户列表
  51. /// </summary>
  52. /// <param name="input">查询</param>
  53. /// <returns></returns>
  54. Task<List<SysUser>> List(UserPageInput input);
  55. /// <summary>
  56. /// 根据用户Id获取用户信息
  57. /// </summary>
  58. /// <param name="userId">用户ID</param>
  59. /// <returns>用户信息</returns>
  60. Task<SysUser> GetUserById(long userId);
  61. /// <summary>
  62. /// 根据用户Id获取用户信息
  63. /// </summary>
  64. /// <param name="userId">用户ID</param>
  65. /// <typeparam name="T">转换的实体</typeparam>
  66. /// <returns></returns>
  67. Task<T> GetUserById<T>(long userId);
  68. /// <summary>
  69. /// 根据用户账号获取用户ID
  70. /// </summary>
  71. /// <param name="account">用户账号</param>
  72. /// <param name="tenantId">租户id</param>
  73. /// <returns></returns>
  74. Task<long> GetIdByAccount(string account, long? tenantId = null);
  75. /// <summary>
  76. /// 根据用户手机获取用户信息
  77. /// </summary>
  78. /// <param name="phone">手机号</param>
  79. /// <param name="tenantId">租户Id</param>
  80. /// <returns>用户信息</returns>
  81. Task<SysUser> GetUserByPhone(string phone, long? tenantId = null);
  82. /// <summary>
  83. /// 获取用户拥有角色
  84. /// </summary>
  85. /// <param name="input">用户ID</param>
  86. /// <returns></returns>
  87. Task<List<RoleSelectorOutPut>> OwnRole(BaseIdInput input);
  88. /// <summary>
  89. /// 获取用户拥有的资源
  90. /// </summary>
  91. /// <param name="input">用户id</param>
  92. /// <returns>资源列表</returns>
  93. Task<RoleOwnResourceOutput> OwnResource(BaseIdInput input);
  94. /// <summary>
  95. /// 获取用户拥有的权限
  96. /// </summary>
  97. /// <param name="input">用户id</param>
  98. /// <returns>权限列表</returns>
  99. Task<RoleOwnPermissionOutput> OwnPermission(BaseIdInput input);
  100. /// <summary>
  101. /// 用户权限树选择
  102. /// </summary>
  103. /// <param name="input">用户id</param>
  104. /// <returns>权限列表</returns>
  105. Task<List<string>> UserPermissionTreeSelector(BaseIdInput input);
  106. /// <summary>
  107. /// 根据id集合获取用户集合
  108. /// </summary>
  109. /// <param name="input">Id集合</param>
  110. /// <returns></returns>
  111. Task<List<UserSelectorOutPut>> GetUserListByIdList(IdListInput input);
  112. /// <summary>
  113. /// 用户详情
  114. /// </summary>
  115. /// <param name="input"></param>
  116. /// <returns></returns>
  117. Task<SysUser> Detail(BaseIdInput input);
  118. /// <summary>
  119. /// 获取用户头像
  120. /// </summary>
  121. /// <param name="userId">用户id</param>
  122. /// <returns>base64头像</returns>
  123. Task<string> GetUserAvatar(long userId);
  124. #endregion 查询
  125. #region 数据范围相关
  126. /// <summary>
  127. /// 获取当前API用户的数据范围
  128. /// null:代表拥有全部数据权限
  129. /// [xx,xx]:代表拥有部分机构的权限
  130. /// []:代表仅自己权限
  131. /// </summary>
  132. /// <returns>机构列表</returns>
  133. Task<List<long>?> GetLoginUserApiDataScope();
  134. /// <summary>
  135. /// 检查用户是否有机构的数据权限
  136. /// </summary>
  137. /// <param name="orgId">机构id</param>
  138. /// <param name="createUerId">创建者id</param>
  139. /// <param name="errMsg">错误提示:不为空则直接抛出异常</param>
  140. /// <returns>是否有权限</returns>
  141. Task<bool> CheckApiDataScope(long? orgId, long? createUerId, string errMsg = "");
  142. /// <summary>
  143. /// 检查用户是否有机构的数据权限
  144. /// </summary>
  145. /// <param name="orgIds">机构id列表</param>
  146. /// <param name="createUerIds">创建者id列表</param>
  147. /// <param name="errMsg">错误提示:不为空则直接抛出异常</param>
  148. /// <returns></returns>
  149. Task<bool> CheckApiDataScope(List<long> orgIds, List<long> createUerIds, string errMsg = "");
  150. #endregion
  151. #region 新增
  152. /// <summary>
  153. /// 添加用户
  154. /// </summary>
  155. /// <param name="input">添加参数</param>
  156. /// <returns></returns>
  157. Task Add(UserAddInput input);
  158. #endregion 新增
  159. #region 编辑
  160. /// <summary>
  161. /// 编辑
  162. /// </summary>
  163. /// <param name="input">编辑参数</param>
  164. /// <returns></returns>
  165. Task Edit(UserEditInput input);
  166. /// <summary>
  167. /// 启用用户
  168. /// </summary>
  169. /// <param name="input">用户Id</param>
  170. /// <returns></returns>
  171. Task EnableUser(BaseIdInput input);
  172. /// <summary>
  173. /// 禁用用户
  174. /// </summary>
  175. /// <param name="input">用户Id</param>
  176. /// <returns></returns>
  177. Task DisableUser(BaseIdInput input);
  178. /// <summary>
  179. /// 重置密码
  180. /// </summary>
  181. /// <param name="input">用户Id</param>
  182. /// <returns></returns>
  183. Task ResetPassword(BaseIdInput input);
  184. /// <summary>
  185. /// 给用户授权角色
  186. /// </summary>
  187. /// <param name="input">授权参数</param>
  188. /// <returns></returns>
  189. Task GrantRole(UserGrantRoleInput input);
  190. /// <summary>
  191. /// 给用户授权资源
  192. /// </summary>
  193. /// <param name="input">授权参数</param>
  194. /// <returns></returns>
  195. Task GrantResource(UserGrantResourceInput input);
  196. /// <summary>
  197. /// 给用户授权权限
  198. /// </summary>
  199. /// <param name="input"></param>
  200. /// <returns></returns>
  201. Task GrantPermission(GrantPermissionInput input);
  202. /// <summary>
  203. /// 设置用户默认值
  204. /// </summary>
  205. /// <param name="sysUsers"></param>
  206. /// <returns></returns>
  207. Task SetUserDefault(List<SysUser> sysUsers);
  208. /// <summary>
  209. /// 批量编辑
  210. /// </summary>
  211. /// <param name="input">批量编辑信息</param>
  212. /// <returns></returns>
  213. Task Edits(BatchEditInput input);
  214. #endregion 编辑
  215. #region 删除
  216. /// <summary>
  217. /// 删除用户
  218. /// </summary>
  219. /// <param name="input">Id列表</param>
  220. /// <returns></returns>
  221. Task Delete(BaseIdListInput input);
  222. /// <summary>
  223. /// 从redis中删除用户信息
  224. /// </summary>
  225. /// <param name="ids">用户ID列表</param>
  226. void DeleteUserFromRedis(List<long> ids);
  227. /// <summary>
  228. /// 从redis中删除用户信息
  229. /// </summary>
  230. /// <param name="userId">用户ID</param>
  231. void DeleteUserFromRedis(long userId);
  232. #endregion 删除
  233. #region 导入导出
  234. /// <summary>
  235. /// 导出用户
  236. /// </summary>
  237. /// <param name="input"></param>
  238. /// <returns></returns>
  239. Task<FileStreamResult> Export(UserPageInput input);
  240. /// <summary>
  241. /// 导入模板下载
  242. /// </summary>
  243. /// <returns>模板</returns>
  244. Task<FileStreamResult> Template();
  245. /// <summary>
  246. /// 导入预览
  247. /// </summary>
  248. /// <param name="input">预览参数</param>
  249. /// <returns>预览结果</returns>
  250. Task<ImportPreviewOutput<SysUserImportInput>> Preview(ImportPreviewInput input);
  251. /// <summary>
  252. /// 用户导入
  253. /// </summary>
  254. /// <param name="input"></param>
  255. /// <returns></returns>
  256. Task<ImportResultOutPut<SysUserImportInput>> Import(ImportResultInput<SysUserImportInput> input);
  257. /// <summary>
  258. /// 检查导入数据
  259. /// </summary>
  260. /// <param name="data">数据</param>
  261. /// <param name="clearError">是否初始化错误</param>
  262. /// <returns></returns>
  263. Task<List<T>> CheckImport<T>(List<T> data, bool clearError = false) where T : SysUserImportInput;
  264. #endregion 导入导出
  265. }