|
@@ -2,6 +2,8 @@
|
|
using Exam.Share.ViewResponses.Question;
|
|
using Exam.Share.ViewResponses.Question;
|
|
using Hotline.Application.Exam.Constants.ApiRoutes;
|
|
using Hotline.Application.Exam.Constants.ApiRoutes;
|
|
using Hotline.Application.Exam.Interface.Questions;
|
|
using Hotline.Application.Exam.Interface.Questions;
|
|
|
|
+using Hotline.Application.ExportExcel;
|
|
|
|
+using Hotline.Exams.Questions;
|
|
using Hotline.Repository.SqlSugar.Exam.Interface;
|
|
using Hotline.Repository.SqlSugar.Exam.Interface;
|
|
using Hotline.Share.Dtos.Questions;
|
|
using Hotline.Share.Dtos.Questions;
|
|
using Hotline.Share.Requests.Question;
|
|
using Hotline.Share.Requests.Question;
|
|
@@ -15,11 +17,13 @@ namespace Hotline.Api.Controllers.Exam
|
|
{
|
|
{
|
|
private readonly IQuestionService _questionService;
|
|
private readonly IQuestionService _questionService;
|
|
private readonly IMapper _mapper;
|
|
private readonly IMapper _mapper;
|
|
|
|
+ private readonly IExportApplication _exportApplication;
|
|
|
|
|
|
- public QuestionController(IQuestionService questionService,IMapper mapper)
|
|
|
|
|
|
+ public QuestionController(IQuestionService questionService,IMapper mapper, IExportApplication exportApplication)
|
|
{
|
|
{
|
|
_questionService = questionService;
|
|
_questionService = questionService;
|
|
this._mapper = mapper;
|
|
this._mapper = mapper;
|
|
|
|
+ this._exportApplication = exportApplication;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -118,5 +122,15 @@ namespace Hotline.Api.Controllers.Exam
|
|
await _questionService.ImportExcel(files, HttpContext.RequestAborted);
|
|
await _questionService.ImportExcel(files, HttpContext.RequestAborted);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 下载Excel模版
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ [HttpGet(ExamManageApiRoute.Download)]
|
|
|
|
+ public FileStreamResult Download()
|
|
|
|
+ {
|
|
|
|
+ var list = new List<QuestionExcel>();
|
|
|
|
+ return _exportApplication.ExportData(list, "Template.xlsx");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|