1
0

EmployeeController.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 _employeeService;
  16. public EmployeeController(IEmployeeService employeeService)
  17. {
  18. _employeeService = employeeService;
  19. }
  20. /// <summary>
  21. /// 查询单条员工
  22. /// </summary>
  23. /// <param name="id"></param>
  24. /// <returns></returns>
  25. [HttpGet]
  26. public async Task<IResponseOutput> Get(long id)
  27. {
  28. return await _employeeService.GetAsync(id);
  29. }
  30. /// <summary>
  31. /// 查询分页员工
  32. /// </summary>
  33. /// <param name="input"></param>
  34. /// <returns></returns>
  35. [HttpPost]
  36. //[ResponseCache(Duration = 60)]
  37. public async Task<IResponseOutput> GetPage(PageInput<EmployeeEntity> input)
  38. {
  39. return await _employeeService.PageAsync(input);
  40. }
  41. /// <summary>
  42. /// 新增员工
  43. /// </summary>
  44. /// <param name="input"></param>
  45. /// <returns></returns>
  46. [HttpPost]
  47. public async Task<IResponseOutput> Add(EmployeeAddInput input)
  48. {
  49. return await _employeeService.AddAsync(input);
  50. }
  51. /// <summary>
  52. /// 修改员工
  53. /// </summary>
  54. /// <param name="input"></param>
  55. /// <returns></returns>
  56. [HttpPut]
  57. public async Task<IResponseOutput> Update(EmployeeUpdateInput input)
  58. {
  59. return await _employeeService.UpdateAsync(input);
  60. }
  61. /// <summary>
  62. /// 删除员工
  63. /// </summary>
  64. /// <param name="id"></param>
  65. /// <returns></returns>
  66. [HttpDelete]
  67. public async Task<IResponseOutput> SoftDelete(long id)
  68. {
  69. return await _employeeService.SoftDeleteAsync(id);
  70. }
  71. /// <summary>
  72. /// 批量删除员工
  73. /// </summary>
  74. /// <param name="ids"></param>
  75. /// <returns></returns>
  76. [HttpPut]
  77. public async Task<IResponseOutput> BatchSoftDelete(long[] ids)
  78. {
  79. return await _employeeService.BatchSoftDeleteAsync(ids);
  80. }
  81. }
  82. }