namespace MiaoYu.Api.Admin.Controllers.Systems;
///
/// 岗位控制器
///
[ControllerDescriptor(MenuId = "20", DisplayName = "岗位")]
public class SysPostController : AdminControllerBase
{
public SysPostController(SysPostService defaultService) : base(defaultService)
{
}
///
/// 获取列表
///
///
///
[ActionDescriptor(DisplayName = "查看列表")]
[HttpPost]
public async Task FindListAsync([FromBody] PagingSearchInput pagingSearchInput)
{
return await _defaultService.FindListAsync(pagingSearchInput);
}
///
/// 根据id数组删除
///
///
///
[ActionDescriptor(DisplayName = "删除数据")]
[HttpPost]
public async Task DeleteListAsync([FromBody] List ids)
{
await _defaultService.DeleteListAsync(ids);
return true;
}
///
/// 查询表单数据
///
///
///
[ActionDescriptor(DisplayName = "查看表单")]
[HttpGet("{id?}")]
public async Task> FindFormAsync([FromRoute] Guid id)
{
return await _defaultService.FindFormAsync(id);
}
///
/// 添加
///
///
///
[RequestLimitFilter]
[ActionDescriptor(PermissionFunctionConsts.Function_Insert, DisplayName = "创建表单")]
[HttpPost]
[ApiCheckModel]
public Task CreateAsync([FromBody] SysPost form)
{
return _defaultService.SaveFormAsync(form);
}
///
/// 编辑
///
///
///
[RequestLimitFilter]
[ActionDescriptor(PermissionFunctionConsts.Function_Update, DisplayName = "编辑表单")]
[HttpPost]
[ApiCheckModel]
public Task UpdateAsync([FromBody] SysPost form)
{
return _defaultService.SaveFormAsync(form);
}
///
/// 导出Excel
///
///
///
[ActionDescriptor(DisplayName = "导出数据")]
[HttpPost]
public async Task ExportExcelAsync([FromBody] PagingSearchInput pagingSearchInput)
=> HttpContext.DownLoadFile(await _defaultService.ExportExcelAsync(pagingSearchInput), Tools.GetFileContentType[".xls"].ToStr(),
$"{PermissionUtil.GetControllerDisplayName(GetType())}列表数据 {DateTime.Now.ToString("yyyy-MM-dd")}.xls");
}