namespace MiaoYu.Api.Admin.Controllers.Systems; /// /// 菜单控制器 /// [ControllerDescriptor(MenuId = "25", DisplayName = "菜单")] public class SysMenuController : AdminControllerBase { public SysMenuController(SysMenuService defaultService) : base(defaultService) { } /// /// 获取列表 /// /// /// //[ApiResourceCacheFilter(1)] [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] int id) { return await _defaultService.FindFormAsync(id); } /// /// 添加 /// /// /// [RequestLimitFilter] [ActionDescriptor(PermissionFunctionConsts.Function_Insert, DisplayName = "创建表单")] [HttpPost] [ApiCheckModel] public Task CreateAsync([FromBody] SysMenuFormDto form) { return _defaultService.SaveFormAsync(form); } /// /// 编辑 /// /// /// [RequestLimitFilter] [ActionDescriptor(PermissionFunctionConsts.Function_Update, DisplayName = "编辑表单")] [HttpPost] [ApiCheckModel] public Task UpdateAsync([FromBody] SysMenuFormDto form) { return _defaultService.SaveFormAsync(form); } /// /// 导出Excel /// /// /// [ActionDescriptor(DisplayName = "导出数据")] [ApiResourceCacheFilter(10)] [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"); /// /// 获取所有菜单 /// /// /// [ActionDescriptor(DisplayName = "获取所有的菜单")] [HttpPost] public async Task> GetAllAsync([FromBody] SysMenu search) { return await _defaultService.GetAllAsync(search); } /// /// 复制 /// /// /// [Transactional] [HttpPost("{id}")] public async Task CopyMenuAsync([FromRoute] int id) { return await this._defaultService.CopyMenuAsync(id); } /// /// 获取菜单国际化json /// /// [HttpGet] public async Task> GetGlobalNameJsonAsync() { return await this._defaultService.GetGlobalNameJsonAsync(); } }