平安校园
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

315 rader
8.9 KiB

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