@model GenDbTableDto @{ var className = Model.EntityName; var classNameRemark = Model.DisplayName; }
using @(Model.Namespace).Api.Admin.ApplicationServices.Apps; using @(Model.Namespace).Repository.ChatAI.Admin.Entities.Apps; namespace @(Model.Namespace).Api.Admin.Controllers.Apps; ////// @(classNameRemark) 控制器 /// [ControllerDescriptor(MenuId = "请设置菜单Id 系统菜单表中查找,如果不设置不受权限保护!", DisplayName = "@(classNameRemark)")] public class @(className)Controller : AdminControllerBase<@($"{className}Service")> { public @(className)Controller(@(className)Service defaultService) : base(defaultService) { } ////// 获取列表 /// /// ///[ActionDescriptor(PermissionFunctionConsts.Function_Display, DisplayName = "查看数据")] [HttpPost] public Task<@("PagingView")> FindListAsync([FromBody] PagingSearchInput<@(className)> pagingSearchInput) { return this._defaultService.FindListAsync(pagingSearchInput); } /// /// 根据id数组删除 /// /// ids ///[ActionDescriptor(PermissionFunctionConsts.Function_Delete, DisplayName = "删除数据")] [HttpPost] public async Task<@("bool")> DeleteListAsync([FromBody] List<@("int")> ids) { await this._defaultService.DeleteListAsync(ids); return true; } /// /// 查询表单数据 /// /// id ///[ActionDescriptor(DisplayName = "查看表单")] [HttpGet("{id?}")] public Task<@Html.Raw("Dictionary ")> FindFormAsync([FromRoute] int id) { return this._defaultService.FindFormAsync(id); } /// /// 添加 /// /// ///[RequestLimitFilter(Duration = 1, LimitCount = 1)] [ActionDescriptor(PermissionFunctionConsts.Function_Insert, DisplayName = "创建表单")] [HttpPost] [ApiCheckModel] public Task CreateAsync([FromBody] @(className) form) { return this._defaultService.SaveFormAsync(form); } /// /// 编辑 /// /// ///[RequestLimitFilter(Duration = 1, LimitCount = 1)] [ActionDescriptor(PermissionFunctionConsts.Function_Update, DisplayName = "编辑表单")] [HttpPost] [ApiCheckModel] public Task UpdateAsync([FromBody] @(className) form) { return this._defaultService.SaveFormAsync(form); } /// /// 导出Excel /// /// ///[ActionDescriptor(PermissionFunctionConsts.Function_Export, DisplayName = "导出数据")] [ApiResourceCacheFilter(10)] [HttpPost] public async Task ExportExcelAsync([FromBody] PagingSearchInput<@(className)> pagingSearchInput) { var data = await this._defaultService.ExportExcelAsync(pagingSearchInput); var name = $"{PermissionUtil.GetControllerDisplayName(this.GetType())}列表数据 {DateTime.Now.ToString("yyyy-MM-dd")}.xls"; base.HttpContext.DownLoadFile(data, Tools.GetFileContentType[".xls"].ToStr(), name); } }