using ZhonTai.Admin.Core.Dto;
using ZhonTai.Admin.Services.Employee;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using ZhonTai.Admin.Domain.Employee.Input;
using Microsoft.AspNetCore.Mvc.ModelBinding;
namespace ZhonTai.Admin.HttpApi.Controllers;
///
/// 员工管理
///
public class EmployeeController : AreaController
{
private readonly IEmployeeService _employeeService;
public EmployeeController(IEmployeeService employeeService)
{
_employeeService = employeeService;
}
///
/// 查询员工
///
///
///
[HttpGet]
public async Task Get([BindRequired] long id)
{
return await _employeeService.GetAsync(id);
}
///
/// 查询员工列表
///
///
///
[HttpPost]
//[ResponseCache(Duration = 60)]
public async Task GetPage(PageInput input)
{
return await _employeeService.GetPageAsync(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);
}
}