字典表加组字段
This commit is contained in:
@@ -17,7 +17,7 @@ namespace IRaCIS.Application.Services
|
||||
private readonly IRepository<TrialUser> _trialUseRepository;
|
||||
private readonly IRepository<Trial> _trialRepository;
|
||||
|
||||
public TrialMaintenanceService(IRepository<TrialUser> trialUseRepository,IRepository<Trial> trialRepository)
|
||||
public TrialMaintenanceService(IRepository<TrialUser> trialUseRepository, IRepository<Trial> trialRepository)
|
||||
{
|
||||
_trialUseRepository = trialUseRepository;
|
||||
_trialRepository = trialRepository;
|
||||
@@ -33,7 +33,7 @@ namespace IRaCIS.Application.Services
|
||||
{
|
||||
|
||||
var query = _trialUseRepository.Where(t => t.TrialId == param.TrialId).IgnoreQueryFilters()
|
||||
.WhereIf(param.UserTypeId!=null, t => t.User.UserTypeId==param.UserTypeId)
|
||||
.WhereIf(param.UserTypeId != null, t => t.User.UserTypeId == param.UserTypeId)
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(param.UserName), t => t.User.UserName.Contains(param.UserName))
|
||||
|
||||
.WhereIf(param.IsDeleted != null, t => t.IsDeleted == param.IsDeleted)
|
||||
@@ -46,24 +46,44 @@ namespace IRaCIS.Application.Services
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> TrialUserListExport(Guid trialId)
|
||||
{
|
||||
var list = _trialUseRepository.Where(t => t.TrialId == trialId).IgnoreQueryFilters()
|
||||
.ProjectTo<TrialMaintenanceDTO>(_mapper.ConfigurationProvider).ToList();
|
||||
//[HttpGet]
|
||||
//public async Task<IActionResult> TrialUserListExport(Guid trialId)
|
||||
//{
|
||||
|
||||
// var exportInfo = new TrialUserExportDTO()
|
||||
// {
|
||||
// TrialInfo = await _trialRepository.ProjectTo<TrialSelectDTO>(_mapper.ConfigurationProvider).FirstOrDefaultAsync(),
|
||||
// TrialUserList = await _trialUseRepository.Where(t => t.TrialId == trialId).IgnoreQueryFilters().ProjectTo<TrialMaintenanceDTO>(_mapper.ConfigurationProvider).ToListAsync()
|
||||
// };
|
||||
|
||||
// IExporter exporter = new ExcelExporter();
|
||||
|
||||
// ////模板路径
|
||||
// //var tplPath = Path.Combine(Directory.GetCurrentDirectory(), "TestFiles", "ExportTemplates",
|
||||
// // "2020年春季教材订购明细样表.xlsx");
|
||||
// ////创建Excel导出对象
|
||||
// //IExportFileByTemplate exporter = new ExcelExporter();
|
||||
// ////导出路径
|
||||
// //var filePath = Path.Combine(Directory.GetCurrentDirectory(), nameof(ExportByTemplate_Test) + ".xlsx");
|
||||
// //if (File.Exists(filePath)) File.Delete(filePath);
|
||||
// ////根据模板导出
|
||||
// //await exporter.ExportByTemplate(filePath,
|
||||
// // new TextbookOrderInfo("湖南心莱信息科技有限公司", "湖南长沙岳麓区", "雪雁", "1367197xxxx", "雪雁", DateTime.Now.ToLongDateString(),
|
||||
// // new List<BookInfo>()
|
||||
// // {
|
||||
// // new BookInfo(1, "0000000001", "《XX从入门到放弃》", "张三", "机械工业出版社", "3.14", 100, "备注"),
|
||||
// // new BookInfo(2, "0000000002", "《XX从入门到放弃》", "张三", "机械工业出版社", "3.14", 100, "备注"),
|
||||
// // new BookInfo(3, "0000000003", "《XX从入门到放弃》", "张三", "机械工业出版社", "3.14", 100, "备注")
|
||||
// // }),
|
||||
// // tplPath);
|
||||
|
||||
// //var result = await exporter.ExportAsByteArray(list);
|
||||
|
||||
|
||||
//var trialInfo= _re
|
||||
|
||||
IExporter exporter = new ExcelExporter();
|
||||
|
||||
var result = await exporter.ExportAsByteArray(list);
|
||||
// return new XlsxFileResult(bytes: result, fileDownloadName: $"检查导出_{DateTime.Now.ToString("yyyy-MM-dd:hh:mm:ss")}.xlsx");
|
||||
|
||||
|
||||
return new XlsxFileResult(bytes: result, fileDownloadName: $"检查导出_{DateTime.Now.ToString("yyyy-MM-dd:hh:mm:ss")}.xlsx");
|
||||
|
||||
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user