| | |
| | | import com.mindskip.xzs.base.BaseApiController; |
| | | import com.mindskip.xzs.base.RestResponse; |
| | | import com.mindskip.xzs.domain.ExamPaper; |
| | | import com.mindskip.xzs.domain.ExamPaperSubject; |
| | | import com.mindskip.xzs.service.ExamPaperService; |
| | | import com.mindskip.xzs.service.ExamPaperSubjectService; |
| | | import com.mindskip.xzs.utility.DateTimeUtil; |
| | | import com.mindskip.xzs.utility.PageInfoHelper; |
| | | import com.mindskip.xzs.viewmodel.admin.exam.ExamPaperPageRequestVM; |
| | |
| | | public class ExamPaperController extends BaseApiController { |
| | | |
| | | private final ExamPaperService examPaperService; |
| | | private final ExamPaperSubjectService examPaperSubjectService; |
| | | |
| | | @Autowired |
| | | public ExamPaperController(ExamPaperService examPaperService) { |
| | | public ExamPaperController(ExamPaperService examPaperService, ExamPaperSubjectService examPaperSubjectService) { |
| | | this.examPaperService = examPaperService; |
| | | this.examPaperSubjectService = examPaperSubjectService; |
| | | } |
| | | |
| | | @RequestMapping(value = "/page", method = RequestMethod.POST) |
| | |
| | | PageInfo<ExamResponseVM> page = PageInfoHelper.copyMap(pageInfo, e -> { |
| | | ExamResponseVM vm = modelMapper.map(e, ExamResponseVM.class); |
| | | vm.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime())); |
| | | vm.setSubjectId(examPaperSubjectService.getByExamPaperId(vm.getId()) |
| | | .stream().map(ExamPaperSubject::getSubjectId).toArray(Integer[]::new)); |
| | | return vm; |
| | | }); |
| | | return RestResponse.ok(page); |