using Admin.Core.Common.Input;
using Admin.Core.Common.Output;
using Admin.Core.Service.Personnel.Employee;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using Admin.Core.Model.Personnel;
using Admin.Core.Service.Personnel.Employee.Input;
namespace Admin.Core.Controllers.Personnel
{
///
/// 员工管理
///
public class EmployeeController : AreaController
{
private readonly IEmployeeService _employeeService;
public EmployeeController(IEmployeeService employeeService)
{
_employeeService = employeeService;
}
///
/// 查询单条员工
///
///
///
[HttpGet]
public async Task Get(long id)
{
return await _employeeService.GetAsync(id);
}
///
/// 查询分页员工
///
///
///
[HttpPost]
//[ResponseCache(Duration = 60)]
public async Task GetPage(PageInput input)
{
return await _employeeService.PageAsync(input);
}
///
/// 新增员工
///
///
///
[HttpPost]
public async Task Add(EmployeeAddInput input)
{
return await _employeeService.AddAsync(input);
}
///
/// 修改员工
///
///
///
[HttpPut]
public async Task Update(EmployeeUpdateInput input)
{
return await _employeeService.UpdateAsync(input);
}
///
/// 删除员工
///
///
///
[HttpDelete]
public async Task SoftDelete(long id)
{
return await _employeeService.SoftDeleteAsync(id);
}
///
/// 批量删除员工
///
///
///
[HttpPut]
public async Task BatchSoftDelete(long[] ids)
{
return await _employeeService.BatchSoftDeleteAsync(ids);
}
}
}