EmployeeController.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. using Admin.Core.Common.Input;
  2. using Admin.Core.Common.Output;
  3. using Admin.Core.Service.Personnel.Employee;
  4. using Microsoft.AspNetCore.Mvc;
  5. using System.Threading.Tasks;
  6. using Admin.Core.Model.Personnel;
  7. using Admin.Core.Service.Personnel.Employee.Input;
  8. namespace Admin.Core.Controllers.Personnel
  9. {
  10. /// <summary>
  11. /// 员工管理
  12. /// </summary>
  13. public class EmployeeController : AreaController
  14. {
  15. private readonly IEmployeeService _employeeServices;
  16. public EmployeeController(
  17. IEmployeeService employeeServices
  18. )
  19. {
  20. _employeeServices = employeeServices;
  21. }
  22. /// <summary>
  23. /// 查询单条用户
  24. /// </summary>
  25. /// <param name="id"></param>
  26. /// <returns></returns>
  27. [HttpGet]
  28. public async Task<IResponseOutput> Get(long id)
  29. {
  30. return await _employeeServices.GetAsync(id);
  31. }
  32. /// <summary>
  33. /// 查询分页用户
  34. /// </summary>
  35. /// <param name="input"></param>
  36. /// <returns></returns>
  37. [HttpPost]
  38. //[ResponseCache(Duration = 60)]
  39. public async Task<IResponseOutput> GetPage(PageInput<EmployeeEntity> input)
  40. {
  41. return await _employeeServices.PageAsync(input);
  42. }
  43. /// <summary>
  44. /// 新增用户
  45. /// </summary>
  46. /// <param name="input"></param>
  47. /// <returns></returns>
  48. [HttpPost]
  49. public async Task<IResponseOutput> Add(EmployeeAddInput input)
  50. {
  51. return await _employeeServices.AddAsync(input);
  52. }
  53. /// <summary>
  54. /// 修改用户
  55. /// </summary>
  56. /// <param name="input"></param>
  57. /// <returns></returns>
  58. [HttpPut]
  59. public async Task<IResponseOutput> Update(EmployeeUpdateInput input)
  60. {
  61. return await _employeeServices.UpdateAsync(input);
  62. }
  63. /// <summary>
  64. /// 删除用户
  65. /// </summary>
  66. /// <param name="id"></param>
  67. /// <returns></returns>
  68. [HttpDelete]
  69. public async Task<IResponseOutput> SoftDelete(long id)
  70. {
  71. return await _employeeServices.SoftDeleteAsync(id);
  72. }
  73. /// <summary>
  74. /// 批量删除用户
  75. /// </summary>
  76. /// <param name="ids"></param>
  77. /// <returns></returns>
  78. [HttpPut]
  79. public async Task<IResponseOutput> BatchSoftDelete(long[] ids)
  80. {
  81. return await _employeeServices.BatchSoftDeleteAsync(ids);
  82. }
  83. }
  84. }