1
0

PositionController.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. using Admin.Core.Common.Input;
  2. using Admin.Core.Common.Output;
  3. using Admin.Core.Model.Personnel;
  4. using Admin.Core.Service.Personnel.Position;
  5. using Admin.Core.Service.Personnel.Position.Input;
  6. using Microsoft.AspNetCore.Mvc;
  7. using System.Threading.Tasks;
  8. namespace Admin.Core.Controllers.Personnel
  9. {
  10. /// <summary>
  11. /// 职位管理
  12. /// </summary>
  13. public class PositionController : AreaController
  14. {
  15. private readonly IPositionService _positionService;
  16. public PositionController(IPositionService positionService)
  17. {
  18. _positionService = positionService;
  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 _positionService.GetAsync(id);
  29. }
  30. /// <summary>
  31. /// 查询分页职位
  32. /// </summary>
  33. /// <param name="model"></param>
  34. /// <returns></returns>
  35. [HttpPost]
  36. public async Task<IResponseOutput> GetPage(PageInput<PositionEntity> model)
  37. {
  38. return await _positionService.PageAsync(model);
  39. }
  40. /// <summary>
  41. /// 新增职位
  42. /// </summary>
  43. /// <param name="input"></param>
  44. /// <returns></returns>
  45. [HttpPost]
  46. public async Task<IResponseOutput> Add(PositionAddInput input)
  47. {
  48. return await _positionService.AddAsync(input);
  49. }
  50. /// <summary>
  51. /// 修改职位
  52. /// </summary>
  53. /// <param name="input"></param>
  54. /// <returns></returns>
  55. [HttpPut]
  56. public async Task<IResponseOutput> Update(PositionUpdateInput input)
  57. {
  58. return await _positionService.UpdateAsync(input);
  59. }
  60. /// <summary>
  61. /// 删除职位
  62. /// </summary>
  63. /// <param name="id"></param>
  64. /// <returns></returns>
  65. [HttpDelete]
  66. public async Task<IResponseOutput> SoftDelete(long id)
  67. {
  68. return await _positionService.SoftDeleteAsync(id);
  69. }
  70. /// <summary>
  71. /// 批量删除职位
  72. /// </summary>
  73. /// <param name="ids"></param>
  74. /// <returns></returns>
  75. [HttpPut]
  76. public async Task<IResponseOutput> BatchSoftDelete(long[] ids)
  77. {
  78. return await _positionService.BatchSoftDeleteAsync(ids);
  79. }
  80. }
  81. }