| | |
| | | 锘縰sing HslCommunication.WebSocket; |
| | | using Magicodes.ExporterAndImporter.Core; |
| | | using Magicodes.ExporterAndImporter.Excel; |
| | | using MathNet.Numerics.Statistics.Mcmc; |
| | | using NPOI.Util.Collections; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; |
| | | using SqlSugar; |
| | |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | public override WebResponseContent Export(PageDataOptions options) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | string savePath = AppDomain.CurrentDomain.BaseDirectory + $"ExcelExport"; |
| | | IExporter exporter = new ExcelExporter(); |
| | | options.Page = 1; |
| | | options.Rows = 30; |
| | | options.Order = "asc"; |
| | | options.Sort = "id"; |
| | | |
| | | string where = string.Empty; |
| | | ISugarQueryable<Dt_LocationInfo> sugarQueryable = BaseDal.Db.Queryable<Dt_LocationInfo>(); |
| | | if (!string.IsNullOrEmpty(options.Wheres)) |
| | | { |
| | | try |
| | | { |
| | | List<SearchParameters> searchParametersList = options.Wheres.DeserializeObject<List<SearchParameters>>(); |
| | | if (searchParametersList?.Any() == true) |
| | | { |
| | | foreach (var param in searchParametersList) |
| | | { |
| | | switch (param.Name) |
| | | { |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | byte[] data = exporter.ExportAsByteArray(sugarQueryable.ToList()).Result; |
| | | |
| | | string fileName = "搴撲綅淇℃伅.xlsx"; |
| | | |
| | | FileHelper.WriteFile(savePath, fileName, data); |
| | | |
| | | content = WebResponseContent.Instance.OK(data: savePath + "\\" + fileName); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | } |
| | | } |