|
|
|
@ -2,12 +2,14 @@ |
|
|
|
|
using System.Data; |
|
|
|
|
using System.Dynamic; |
|
|
|
|
using System.Linq.Expressions; |
|
|
|
|
using System.Net.Mail; |
|
|
|
|
using AgileObjects.AgileMapper; |
|
|
|
|
using MathNet.Numerics.Distributions; |
|
|
|
|
using Microsoft.AspNetCore.Http; |
|
|
|
|
using MySqlX.XDevAPI.Common; |
|
|
|
|
using Newtonsoft.Json; |
|
|
|
|
using Newtonsoft.Json.Linq; |
|
|
|
|
using NPOI.HPSF; |
|
|
|
|
using NPOI.Util; |
|
|
|
|
using SqlSugar; |
|
|
|
|
using Tiobon.Core.Common; |
|
|
|
@ -817,7 +819,7 @@ public class BaseServices<TEntity, TEntityDto, TInsertDto, TEditDto> : IBaseServ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public async virtual Task<ServiceResult<string>> ImportExcel(IFormFile file) |
|
|
|
|
public async virtual Task<ServiceResult<ExcelData>> ImportExcel(IFormFile file) |
|
|
|
|
{ |
|
|
|
|
//long id = SnowFlakeSingle.instance.getID(); |
|
|
|
|
//var physicsPath = $"{Environment.CurrentDirectory}{Path.DirectorySeparatorChar}wwwroot"; |
|
|
|
@ -826,7 +828,19 @@ public class BaseServices<TEntity, TEntityDto, TInsertDto, TEditDto> : IBaseServ |
|
|
|
|
// Directory.CreateDirectory(physicsPath + path); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ServiceResult<string>.OprateSuccess("导入成功!"); |
|
|
|
|
return ServiceResult<ExcelData>.OprateSuccess("导入成功!"); |
|
|
|
|
} |
|
|
|
|
public async virtual Task<ServiceResult<string>> DownloadExcel() |
|
|
|
|
{ |
|
|
|
|
var physicsPath = $"{Environment.CurrentDirectory}{Path.DirectorySeparatorChar}wwwroot"; |
|
|
|
|
var path = $"{$"{Path.DirectorySeparatorChar}files{Path.DirectorySeparatorChar}ExcelTemplate{Path.DirectorySeparatorChar}"}"; |
|
|
|
|
if (!Directory.Exists(physicsPath + path)) |
|
|
|
|
Directory.CreateDirectory(physicsPath + path); |
|
|
|
|
|
|
|
|
|
Type entityType = typeof(TEntity); |
|
|
|
|
var fileName = entityType.GetEntityTableName() + ".xlsx"; |
|
|
|
|
var result = ServiceResult<string>.OprateSuccess(fileName, physicsPath + path + fileName); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public async Task<List<TResult>> QueryMuch<T, T2, T3, TResult>(Expression<Func<T, T2, T3, object[]>> joinExpression, Expression<Func<T, T2, T3, TResult>> selectExpression, Expression<Func<T, T2, T3, bool>> whereLambda = null) where T : class, new() |
|
|
|
|