|
using AutoMapper;
|
using NPOI.SS.UserModel;
|
using NPOI.XSSF.UserModel;
|
using SqlSugar;
|
using System.Diagnostics.CodeAnalysis;
|
using System.Threading.Tasks;
|
using WIDESEAWCS_Common.Helper;
|
using WIDESEAWCS_Core;
|
using WIDESEAWCS_Core.BaseServices;
|
using WIDESEAWCS_Core.Helper;
|
using WIDESEAWCS_ITaskInfo_HtyRepository;
|
using WIDESEAWCS_ITaskInfo_HtyService;
|
using WIDESEAWCS_Model.Models;
|
|
namespace WIDESEAWCS_TaskInfo_HtyService
|
{
|
public partial class Task_HtyService : ServiceBase<Dt_Task_Hty, ITask_HtyRepository>, ITask_HtyService
|
{
|
public Task_HtyService(ITask_HtyRepository BaseDal) : base(BaseDal)
|
{
|
}
|
public override WebResponseContent Export(PageDataOptions options)
|
{
|
WebResponseContent content = new WebResponseContent();
|
try
|
{
|
string savePath = AppDomain.CurrentDomain.BaseDirectory + "ExcelExport";
|
|
// 确保目录存在
|
if (!Directory.Exists(savePath))
|
Directory.CreateDirectory(savePath);
|
|
// 获取数据
|
ISugarQueryable<Dt_Task_Hty> query = BaseDal.Db.Queryable<Dt_Task_Hty>();
|
var dataList = query.ToList();
|
var properties = typeof(Dt_Task_Hty).GetProperties();
|
string filePath = TExportHelper.GetExport(savePath, properties, dataList);
|
return WebResponseContent.Instance.OK(data: filePath);
|
}
|
catch (Exception ex)
|
{
|
content = WebResponseContent.Instance.Error(ex.Message);
|
}
|
return content;
|
}
|
}
|
}
|