平安校园
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.
 
 
 
 
 
 

223 lines
5.6 KiB

  1. namespace SafeCampus.Web.Core;
  2. /// <summary>
  3. /// 人员管理控制器
  4. /// </summary>
  5. [ApiDescriptionSettings("Application", Tag = "人员管理")]
  6. [Route("biz/organization/user")]
  7. [RolePermission]
  8. public class BizUserController : IDynamicApiController
  9. {
  10. private readonly IUserService _userService;
  11. private readonly IOrgService _orgService;
  12. private readonly IPositionService _positionService;
  13. public BizUserController(IUserService userService, IOrgService orgService, IPositionService positionService)
  14. {
  15. _userService = userService;
  16. _orgService = orgService;
  17. _positionService = positionService;
  18. }
  19. #region Get请求
  20. /// <summary>
  21. /// 导入预览
  22. /// </summary>
  23. /// <param name="input"></param>
  24. /// <returns></returns>
  25. [HttpPost("preview")]
  26. [DisableRequestSizeLimit]
  27. [SuppressMonitor]
  28. [DisplayName("导入预览")]
  29. public async Task<dynamic> Preview([FromForm] ImportPreviewInput input)
  30. {
  31. return await _userService.Preview(input);
  32. }
  33. /// <summary>
  34. /// 模板下载
  35. /// </summary>
  36. /// <returns></returns>
  37. [HttpGet(template: "template")]
  38. [SuppressMonitor]
  39. public async Task<dynamic> Template()
  40. {
  41. return await _userService.Template();
  42. }
  43. /// <summary>
  44. /// 人员分页查询
  45. /// </summary>
  46. /// <param name="input"></param>
  47. /// <returns></returns>
  48. [HttpGet("page")]
  49. [DisplayName("人员分页查询")]
  50. public async Task<dynamic> Page([FromQuery] UserPageInput input)
  51. {
  52. return await _userService.Page(input);
  53. }
  54. /// <summary>
  55. /// 获取人员选择器
  56. /// </summary>
  57. /// <returns></returns>
  58. [HttpGet("selector")]
  59. [DisplayName("人员选择器")]
  60. public async Task<dynamic> Selector([FromQuery] UserSelectorInput input)
  61. {
  62. return await _userService.Selector(input);
  63. }
  64. /// <summary>
  65. /// 获取人员拥有角色
  66. /// </summary>
  67. /// <param name="input"></param>
  68. /// <returns></returns>
  69. [HttpGet("ownRole")]
  70. [DisplayName("获取人员拥有角色")]
  71. public async Task<dynamic> OwnRole([FromQuery] BaseIdInput input)
  72. {
  73. return await _userService.OwnRole(input);
  74. }
  75. /// <summary>
  76. /// 人员详情
  77. /// </summary>
  78. /// <param name="input"></param>
  79. /// <returns></returns>
  80. [HttpGet("detail")]
  81. [DisplayName("人员详情")]
  82. public async Task<dynamic> Detail([FromQuery] BaseIdInput input)
  83. {
  84. return await _userService.Detail(input);
  85. }
  86. #endregion Get请求
  87. #region Post请求
  88. /// <summary>
  89. /// 添加人员
  90. /// </summary>
  91. /// <param name="input"></param>
  92. /// <returns></returns>
  93. [HttpPost("add")]
  94. [DisplayName("添加人员")]
  95. public async Task Add([FromBody] UserAddInput input)
  96. {
  97. await _userService.Add(input);
  98. }
  99. /// <summary>
  100. /// 修改人员
  101. /// </summary>
  102. /// <param name="input"></param>
  103. /// <returns></returns>
  104. [HttpPost("edit")]
  105. [DisplayName("修改人员")]
  106. public async Task Edit([FromBody] UserEditInput input)
  107. {
  108. await _userService.Edit(input);
  109. }
  110. /// <summary>
  111. /// 批量修改人员
  112. /// </summary>
  113. /// <param name="input"></param>
  114. /// <returns></returns>
  115. [HttpPost("edits")]
  116. [DisplayName("批量修改人员")]
  117. public async Task Edits([FromBody] BatchEditInput input)
  118. {
  119. await _userService.Edits(input);
  120. }
  121. /// <summary>
  122. /// 删除人员
  123. /// </summary>
  124. /// <param name="input"></param>
  125. /// <returns></returns>
  126. [HttpPost("delete")]
  127. [DisplayName("删除人员")]
  128. public async Task Delete([FromBody] BaseIdListInput input)
  129. {
  130. await _userService.Delete(input);
  131. }
  132. /// <summary>
  133. /// 禁用人员
  134. /// </summary>
  135. /// <param name="input"></param>
  136. /// <returns></returns>
  137. [HttpPost("disableUser")]
  138. [DisplayName("禁用人员")]
  139. public async Task DisableUser([FromBody] BaseIdInput input)
  140. {
  141. await _userService.DisableUser(input);
  142. }
  143. /// <summary>
  144. /// 启用人员
  145. /// </summary>
  146. /// <param name="input"></param>
  147. /// <returns></returns>
  148. [HttpPost("enableUser")]
  149. [DisplayName("启用人员")]
  150. public async Task EnableUser([FromBody] BaseIdInput input)
  151. {
  152. await _userService.EnableUser(input);
  153. }
  154. /// <summary>
  155. /// 重置密码
  156. /// </summary>
  157. /// <param name="input"></param>
  158. /// <returns></returns>
  159. [HttpPost("resetPassword")]
  160. [DisplayName("重置密码")]
  161. public async Task ResetPassword([FromBody] BaseIdInput input)
  162. {
  163. await _userService.ResetPassword(input);
  164. }
  165. /// <summary>
  166. /// 给人员授权角色
  167. /// </summary>
  168. /// <param name="input"></param>
  169. /// <returns></returns>
  170. [HttpPost("grantRole")]
  171. [DisplayName("授权角色")]
  172. public async Task GrantRole([FromBody] UserGrantRoleInput input)
  173. {
  174. await _userService.GrantRole(input);
  175. }
  176. /// <summary>
  177. /// 人员导入
  178. /// </summary>
  179. /// <param name="input"></param>
  180. /// <returns></returns>
  181. [HttpPost("import")]
  182. [DisplayName("人员导入")]
  183. public async Task<dynamic> Import([SuppressMonitor][FromBody] ImportResultInput<BizUserImportInput> input)
  184. {
  185. return await _userService.Import(input);
  186. }
  187. /// <summary>
  188. /// 人员导出
  189. /// </summary>
  190. /// <param name="input"></param>
  191. /// <returns></returns>
  192. [HttpPost("export")]
  193. [DisplayName("人员导出")]
  194. public async Task<dynamic> Export([FromBody] UserPageInput input)
  195. {
  196. return await _userService.Export(input);
  197. }
  198. #endregion Post请求
  199. }