wangxinhui
5 小时以前 5cf8be1f30878aeb2af568f471949d0b9190036a
ÏîÄ¿´úÂë/WCSServices/WIDESEAWCS_TaskInfoService/Task_HtyService.cs
@@ -1,8 +1,14 @@

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;
@@ -14,5 +20,29 @@
        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;
        }
    }
}